mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 12:13:40 +08: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;
|
||||
},
|
||||
|
||||
@discourseComputed(
|
||||
"siteSettings.max_allowed_secondary_emails",
|
||||
"model.can_edit_email"
|
||||
)
|
||||
canAddEmail(maxAllowedSecondaryEmails, canEditEmail) {
|
||||
return maxAllowedSecondaryEmails > 0 && canEditEmail;
|
||||
},
|
||||
|
||||
@action
|
||||
resendConfirmationEmail(email, event) {
|
||||
event?.preventDefault();
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
{{/each}}
|
||||
</div>
|
||||
|
||||
{{#if this.model.can_edit_email}}
|
||||
{{#if this.canAddEmail}}
|
||||
<LinkTo
|
||||
@route="preferences.email"
|
||||
@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:
|
||||
default: 10
|
||||
hidden: true
|
||||
client: true
|
||||
max_batch_presign_multipart_per_minute:
|
||||
default: 20
|
||||
hidden: true
|
||||
|
|
Loading…
Reference in New Issue
Block a user