mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:16:41 +08:00
FIX: fix select badge as user title on badge page (#7682)
This commit is contained in:
parent
5819e446dd
commit
2863e7c181
|
@ -13,16 +13,19 @@ export default Ember.Component.extend(BadgeSelectController, {
|
|||
|
||||
const badge_id = this.selectedUserBadgeId || 0;
|
||||
|
||||
ajax(this.get("user.path") + "/preferences/badge_title", {
|
||||
ajax(this.currentUser.path + "/preferences/badge_title", {
|
||||
type: "PUT",
|
||||
data: { user_badge_id: badge_id }
|
||||
}).then(
|
||||
() => {
|
||||
this.setProperties({
|
||||
saved: true,
|
||||
saving: false,
|
||||
"user.title": this.get("selectedUserBadge.badge.name")
|
||||
saving: false
|
||||
});
|
||||
this.currentUser.set(
|
||||
"title",
|
||||
this.get("selectedUserBadge.badge.name")
|
||||
);
|
||||
},
|
||||
() => {
|
||||
bootbox.alert(I18n.t("generic_error"));
|
||||
|
|
|
@ -30,15 +30,16 @@ export default Discourse.Route.extend({
|
|||
},
|
||||
|
||||
afterModel(model, transition) {
|
||||
const username =
|
||||
const usernameFromParams =
|
||||
transition.to.queryParams && transition.to.queryParams.username;
|
||||
|
||||
const userBadgesGrant = UserBadge.findByBadgeId(model.get("id"), {
|
||||
username
|
||||
username: usernameFromParams
|
||||
}).then(userBadges => {
|
||||
this.userBadgesGrant = userBadges;
|
||||
});
|
||||
|
||||
const username = this.currentUser && this.currentUser.username_lower;
|
||||
const userBadgesAll = UserBadge.findByUsername(username).then(
|
||||
userBadges => {
|
||||
this.userBadgesAll = userBadges;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label"></label>
|
||||
<div class="controls">
|
||||
{{combo-box
|
||||
value=selectedUserBadgeId
|
||||
|
|
Loading…
Reference in New Issue
Block a user