mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06: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");
|
return userId !== this.get("currentUser.id");
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("model.second_factor_enabled")
|
@computed("model.second_factor_enabled", "CanCheckEmails")
|
||||||
canUpdateAssociatedAccounts(secondFactorEnabled) {
|
canUpdateAssociatedAccounts(secondFactorEnabled, canCheckEmails) {
|
||||||
if (secondFactorEnabled) {
|
if (secondFactorEnabled || !canCheckEmails) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,8 +106,13 @@ export default Ember.Controller.extend(
|
|||||||
|
|
||||||
@computed("showAllAuthTokens", "model.user_auth_tokens")
|
@computed("showAllAuthTokens", "model.user_auth_tokens")
|
||||||
authTokens(showAllAuthTokens, tokens) {
|
authTokens(showAllAuthTokens, tokens) {
|
||||||
tokens.sort((a, b) =>
|
tokens.sort(
|
||||||
a.is_active ? -1 : b.is_active ? 1 : b.seen_at.localeCompare(a.seen_at)
|
(a, b) =>
|
||||||
|
a.is_active
|
||||||
|
? -1
|
||||||
|
: b.is_active
|
||||||
|
? 1
|
||||||
|
: b.seen_at.localeCompare(a.seen_at)
|
||||||
);
|
);
|
||||||
|
|
||||||
return showAllAuthTokens
|
return showAllAuthTokens
|
||||||
|
@ -17,5 +17,9 @@ QUnit.test("updating of associated accounts", function(assert) {
|
|||||||
|
|
||||||
controller.set("model.second_factor_enabled", false);
|
controller.set("model.second_factor_enabled", false);
|
||||||
|
|
||||||
|
assert.equal(controller.get("canUpdateAssociatedAccounts"), false);
|
||||||
|
|
||||||
|
controller.set("CanCheckEmails", true);
|
||||||
|
|
||||||
assert.equal(controller.get("canUpdateAssociatedAccounts"), true);
|
assert.equal(controller.get("canUpdateAssociatedAccounts"), true);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user