mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: User can't save gravatar as profile picture after refresh.
https://meta.discourse.org/t/gravatar-issue-cant-save-changes/95076
This commit is contained in:
parent
8b5e42ea16
commit
9c3ba98ef1
@ -61,7 +61,11 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||||||
this.set("gravatarFailed", true);
|
this.set("gravatarFailed", true);
|
||||||
} else {
|
} else {
|
||||||
this.set("gravatarFailed", false);
|
this.set("gravatarFailed", false);
|
||||||
this.get("user").setProperties(result);
|
|
||||||
|
this.get("user").setProperties({
|
||||||
|
gravatar_avatar_upload_id: result.gravatar_upload_id,
|
||||||
|
gravatar_avatar_template: result.gravatar_avatar_template
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => this.set("gravatarRefreshDisabled", false));
|
.finally(() => this.set("gravatarRefreshDisabled", false));
|
||||||
|
@ -15,7 +15,13 @@
|
|||||||
<div class="avatar-choice">
|
<div class="avatar-choice">
|
||||||
{{radio-button id="gravatar" name="avatar" value="gravatar" selection=selected}}
|
{{radio-button id="gravatar" name="avatar" value="gravatar" selection=selected}}
|
||||||
<label class="radio" for="gravatar">{{bound-avatar-template user.gravatar_avatar_template "large"}} {{{i18n 'user.change_avatar.gravatar'}}} {{user.email}}</label>
|
<label class="radio" for="gravatar">{{bound-avatar-template user.gravatar_avatar_template "large"}} {{{i18n 'user.change_avatar.gravatar'}}} {{user.email}}</label>
|
||||||
{{d-button action="refreshGravatar" title="user.change_avatar.refresh_gravatar_title" disabled=gravatarRefreshDisabled icon="refresh"}}
|
|
||||||
|
{{d-button action="refreshGravatar"
|
||||||
|
title="user.change_avatar.refresh_gravatar_title"
|
||||||
|
disabled=gravatarRefreshDisabled
|
||||||
|
icon="refresh"
|
||||||
|
class="avatar-selector-refresh-gravatar"}}
|
||||||
|
|
||||||
{{#if gravatarFailed}}
|
{{#if gravatarFailed}}
|
||||||
<p class="error">{{I18n 'user.change_avatar.gravatar_failed'}}</p>
|
<p class="error">{{I18n 'user.change_avatar.gravatar_failed'}}</p>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
import User from "discourse/models/user";
|
||||||
|
|
||||||
acceptance("User Preferences", {
|
acceptance("User Preferences", {
|
||||||
loggedIn: true,
|
loggedIn: true,
|
||||||
pretend(server, helper) {
|
pretend(server, helper) {
|
||||||
@ -24,6 +26,13 @@ acceptance("User Preferences", {
|
|||||||
success: true
|
success: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
server.post("/user_avatar/eviltrout/refresh_gravatar.json", () => {
|
||||||
|
return helper.response({
|
||||||
|
gravatar_upload_id: 6543,
|
||||||
|
gravatar_avatar_template: "something"
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -172,6 +181,14 @@ QUnit.test("default avatar selector", async assert => {
|
|||||||
|
|
||||||
await click(".pref-avatar .btn");
|
await click(".pref-avatar .btn");
|
||||||
assert.ok(exists(".avatar-choice", "opens the avatar selection modal"));
|
assert.ok(exists(".avatar-choice", "opens the avatar selection modal"));
|
||||||
|
|
||||||
|
await click(".avatar-selector-refresh-gravatar");
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
User.currentProp("gravatar_avatar_upload_id"),
|
||||||
|
6543,
|
||||||
|
"it should set the gravatar_avatar_upload_id property"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
acceptance("Avatar selector when selectable avatars is enabled", {
|
acceptance("Avatar selector when selectable avatars is enabled", {
|
||||||
|
Loading…
Reference in New Issue
Block a user