mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 20:34:52 +00:00
FIX: Conditionally hide Add Alternate Email
button based on site setting (#22525)
Hide button in UI if `max_allowed_secondary_emails` site setting is 0.
This commit is contained in:
parent
3136f6766b
commit
69e0c23f41
@ -140,6 +140,14 @@ export default Controller.extend(CanCheckEmails, {
|
|||||||
return findAll().length > 0;
|
return findAll().length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@discourseComputed(
|
||||||
|
"siteSettings.max_allowed_secondary_emails",
|
||||||
|
"model.can_edit_email"
|
||||||
|
)
|
||||||
|
canAddEmail(maxAllowedSecondaryEmails, canEditEmail) {
|
||||||
|
return maxAllowedSecondaryEmails > 0 && canEditEmail;
|
||||||
|
},
|
||||||
|
|
||||||
@action
|
@action
|
||||||
resendConfirmationEmail(email, event) {
|
resendConfirmationEmail(email, event) {
|
||||||
event?.preventDefault();
|
event?.preventDefault();
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if this.model.can_edit_email}}
|
{{#if this.canAddEmail}}
|
||||||
<LinkTo
|
<LinkTo
|
||||||
@route="preferences.email"
|
@route="preferences.email"
|
||||||
@query={{hash new=1}}
|
@query={{hash new=1}}
|
||||||
|
@ -235,3 +235,15 @@ acceptance(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
acceptance("User Preference - No Secondary Emails Allowed", function (needs) {
|
||||||
|
needs.user();
|
||||||
|
needs.pretender(preferencesPretender);
|
||||||
|
needs.settings({ max_allowed_secondary_emails: 0 });
|
||||||
|
|
||||||
|
test("Add Alternate Email Button is unvailable", async function (assert) {
|
||||||
|
await visit("/u/eviltrout/preferences");
|
||||||
|
|
||||||
|
assert.dom(".pref-email a").doesNotExist();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -2019,6 +2019,7 @@ rate_limits:
|
|||||||
max_allowed_secondary_emails:
|
max_allowed_secondary_emails:
|
||||||
default: 10
|
default: 10
|
||||||
hidden: true
|
hidden: true
|
||||||
|
client: true
|
||||||
max_batch_presign_multipart_per_minute:
|
max_batch_presign_multipart_per_minute:
|
||||||
default: 20
|
default: 20
|
||||||
hidden: true
|
hidden: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user