UX: respect email_editable site setting in user activation page. (#11835)

Previously, when both `enable_local_logins` and `email_editable` are disabled still user can change the email in  user activation page.
This commit is contained in:
Vinoth Kannan 2021-01-25 22:19:26 +05:30 committed by GitHub
parent afe6db5f33
commit c7781f1139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 5 deletions

View File

@ -1,4 +1,10 @@
import Component from "@ember/component";
import { or } from "@ember/object/computed";
export default Component.extend({
classNames: "activation-controls",
canEditEmail: or(
"siteSettings.enable_local_logins",
"siteSettings.email_editable"
),
});

View File

@ -5,7 +5,9 @@
class="btn-primary resend"}}
{{/unless}}
{{d-button action=editActivationEmail
label="login.change_email"
icon="pencil-alt"
class="edit-email"}}
{{#if canEditEmail}}
{{d-button action=editActivationEmail
label="login.change_email"
icon="pencil-alt"
class="edit-email"}}
{{/if}}

View File

@ -0,0 +1,25 @@
import componentTest, {
setupRenderingTest,
} from "discourse/tests/helpers/component-test";
import {
discourseModule,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
discourseModule("Integration | Component | activation-controls", function (
hooks
) {
setupRenderingTest(hooks);
componentTest("hides change email button", {
template: `{{activation-controls}}`,
beforeEach() {
this.siteSettings.enable_local_logins = false;
this.siteSettings.email_editable = false;
},
test(assert) {
assert.equal(queryAll("button.edit-email").length, 0);
},
});
});

View File

@ -541,7 +541,9 @@ users:
max: 10
block_common_passwords: true
username_change_period: 3
email_editable: true
email_editable:
client: true
default: true
logout_redirect:
client: true
default: ""