mirror of
https://github.com/discourse/discourse.git
synced 2025-01-19 07:02:46 +08:00
FIX: ensures group automatic membership dropdown works (#9022)
This commit also fixes a deprecation warning as the previous component was overriding a computed property from the group model. Finally a test has been added as this is the only place where we use list-setting outside of the settings, this was highly subject to regressions.
This commit is contained in:
parent
90e701b470
commit
69a2ad626b
|
@ -46,9 +46,16 @@ export default Component.extend({
|
|||
return allowMembershipRequests || visibility_level > 1;
|
||||
},
|
||||
|
||||
emailDomains: computed("model.emailDomains", function() {
|
||||
return this.model.emailDomains.split(this.tokenSeparator).filter(Boolean);
|
||||
}),
|
||||
|
||||
actions: {
|
||||
onChangeEmailDomainsSetting(value) {
|
||||
this.set("model.emailDomains", value.join(this.tokenSeparator));
|
||||
this.set(
|
||||
"model.automatic_membership_email_domains",
|
||||
value.join(this.tokenSeparator)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -8,9 +8,14 @@
|
|||
|
||||
{{list-setting
|
||||
name="automatic_membership"
|
||||
settingValue=model.emailDomains
|
||||
class="group-form-automatic-membership-automatic"
|
||||
value=emailDomains
|
||||
choices=emailDomains
|
||||
settingName="name"
|
||||
nameProperty=null
|
||||
valueProperty=null
|
||||
onChange=(action "onChangeEmailDomainsSetting")
|
||||
options=(hash allowAny=true)
|
||||
}}
|
||||
|
||||
<label>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
|
||||
import selectKit from "helpers/select-kit-helper";
|
||||
|
||||
acceptance("Managing Group Membership", {
|
||||
loggedIn: true
|
||||
|
@ -65,6 +66,13 @@ QUnit.test("As an admin", async assert => {
|
|||
1,
|
||||
"it should display the membership request template field"
|
||||
);
|
||||
|
||||
const emailDomains = selectKit(".group-form-automatic-membership-automatic");
|
||||
await emailDomains.expand();
|
||||
await emailDomains.fillInFilter("foo.com");
|
||||
await emailDomains.keyboard("enter");
|
||||
|
||||
assert.equal(emailDomains.header().value(), "foo.com");
|
||||
});
|
||||
|
||||
QUnit.test("As a group owner", async assert => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user