mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 22:23:00 +08:00
FIX: preference page error when badges are disabled
This commit is contained in:
parent
1b351a3355
commit
d7ea6f93e7
|
@ -6,10 +6,14 @@ export default RestrictedUserRoute.extend({
|
||||||
|
|
||||||
model: function() {
|
model: function() {
|
||||||
const user = this.modelFor('user');
|
const user = this.modelFor('user');
|
||||||
return UserBadge.findByUsername(this.modelFor('user').get('username')).then(userBadges => {
|
if (this.siteSettings.enable_badges) {
|
||||||
user.set('badges', userBadges.map(ub => ub.badge));
|
return UserBadge.findByUsername(this.modelFor('user').get('username')).then(userBadges => {
|
||||||
return user;
|
user.set('badges', userBadges.map(ub => ub.badge));
|
||||||
});
|
return user;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, user) {
|
setupController(controller, user) {
|
||||||
|
|
|
@ -121,3 +121,19 @@ QUnit.test("second factor", assert => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
acceptance("User Preferences when badges are disabled", {
|
||||||
|
loggedIn: true,
|
||||||
|
settings: {
|
||||||
|
enable_badges: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
QUnit.test("visit my preferences", assert => {
|
||||||
|
visit("/u/eviltrout/preferences");
|
||||||
|
andThen(() => {
|
||||||
|
assert.ok($('body.user-preferences-page').length, "has the body class");
|
||||||
|
assert.equal(currentURL(), '/u/eviltrout/preferences/account', "defaults to account tab");
|
||||||
|
assert.ok(exists('.user-preferences'), 'it shows the preferences');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user