mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 11:32:46 +08:00
FIX: Hide 'show associated accounts' button if moderators can't see emails
And minor prettier code alignments
This commit is contained in:
parent
2d247cc4e9
commit
ed0120171c
|
@ -92,9 +92,9 @@ export default Ember.Controller.extend(
|
|||
return userId !== this.get("currentUser.id");
|
||||
},
|
||||
|
||||
@computed("model.second_factor_enabled")
|
||||
canUpdateAssociatedAccounts(secondFactorEnabled) {
|
||||
if (secondFactorEnabled) {
|
||||
@computed("model.second_factor_enabled", "CanCheckEmails")
|
||||
canUpdateAssociatedAccounts(secondFactorEnabled, canCheckEmails) {
|
||||
if (secondFactorEnabled || !canCheckEmails) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -106,8 +106,13 @@ export default Ember.Controller.extend(
|
|||
|
||||
@computed("showAllAuthTokens", "model.user_auth_tokens")
|
||||
authTokens(showAllAuthTokens, tokens) {
|
||||
tokens.sort((a, b) =>
|
||||
a.is_active ? -1 : b.is_active ? 1 : b.seen_at.localeCompare(a.seen_at)
|
||||
tokens.sort(
|
||||
(a, b) =>
|
||||
a.is_active
|
||||
? -1
|
||||
: b.is_active
|
||||
? 1
|
||||
: b.seen_at.localeCompare(a.seen_at)
|
||||
);
|
||||
|
||||
return showAllAuthTokens
|
||||
|
|
|
@ -17,5 +17,9 @@ QUnit.test("updating of associated accounts", function(assert) {
|
|||
|
||||
controller.set("model.second_factor_enabled", false);
|
||||
|
||||
assert.equal(controller.get("canUpdateAssociatedAccounts"), false);
|
||||
|
||||
controller.set("CanCheckEmails", true);
|
||||
|
||||
assert.equal(controller.get("canUpdateAssociatedAccounts"), true);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user