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:
Guo Xiang Tan
2018-08-20 10:28:16 +08:00
parent 8b5e42ea16
commit 9c3ba98ef1
3 changed files with 29 additions and 2 deletions

View File

@@ -1,4 +1,6 @@
import { acceptance } from "helpers/qunit-helpers";
import User from "discourse/models/user";
acceptance("User Preferences", {
loggedIn: true,
pretend(server, helper) {
@@ -24,6 +26,13 @@ acceptance("User Preferences", {
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");
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", {