FIX: `Discourse.ajax` is deprecated.

This commit is contained in:
Guo Xiang Tan 2016-12-13 15:53:04 +08:00
parent fbd3727c7d
commit 5a2794a0c7
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import computed from "ember-addons/ember-computed-decorators"; import computed from "ember-addons/ember-computed-decorators";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
import { ajax } from 'discourse/lib/ajax';
import { allowsImages } from 'discourse/lib/utilities'; import { allowsImages } from 'discourse/lib/utilities';
@ -34,8 +35,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
refreshGravatar() { refreshGravatar() {
this.set("gravatarRefreshDisabled", true); this.set("gravatarRefreshDisabled", true);
return Discourse return ajax(`/user_avatar/${this.get("username")}/refresh_gravatar.json`, { method: "POST" })
.ajax(`/user_avatar/${this.get("username")}/refresh_gravatar.json`, { method: "POST" })
.then(result => this.setProperties({ .then(result => this.setProperties({
gravatar_avatar_template: result.gravatar_avatar_template, gravatar_avatar_template: result.gravatar_avatar_template,
gravatar_avatar_upload_id: result.gravatar_upload_id, gravatar_avatar_upload_id: result.gravatar_upload_id,