mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 13:16:43 +08:00
FIX: correctly hides admin settings in channel settings (#19384)
This would need even more test which are being created in a separate branch.
This commit is contained in:
parent
44191dd850
commit
c2fd9d5116
|
@ -61,7 +61,7 @@ export default class ChatChannelSettingsView extends Component {
|
||||||
@computed("autoJoinAvailable", "togglingChannelWideMentionsAvailable")
|
@computed("autoJoinAvailable", "togglingChannelWideMentionsAvailable")
|
||||||
get adminSectionAvailable() {
|
get adminSectionAvailable() {
|
||||||
return (
|
return (
|
||||||
this.chatGuardian.canEditChatChannel &&
|
this.chatGuardian.canEditChatChannel() &&
|
||||||
(this.autoJoinAvailable || this.togglingChannelWideMentionsAvailable)
|
(this.autoJoinAvailable || this.togglingChannelWideMentionsAvailable)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ module(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
componentTest("allow channel wide mentions", {
|
componentTest("hide channel wide mentions", {
|
||||||
template: hbs`{{chat-channel-settings-view channel=channel}}`,
|
template: hbs`{{chat-channel-settings-view channel=channel}}`,
|
||||||
|
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
|
@ -127,23 +127,21 @@ module(
|
||||||
},
|
},
|
||||||
|
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
pretender.put(`/chat/api/chat_channels/${this.channel.id}.json`, () => {
|
assert
|
||||||
return [
|
.dom(".channel-settings-view__channel-wide-mentions-selector")
|
||||||
200,
|
.doesNotExist();
|
||||||
{ "Content-Type": "application/json" },
|
},
|
||||||
{
|
});
|
||||||
allow_channel_wide_mentions: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
const sk = selectKit(
|
componentTest("hide channel auto join", {
|
||||||
".channel-settings-view__channel-wide-mentions-selector"
|
template: hbs`{{chat-channel-settings-view channel=channel}}`,
|
||||||
);
|
|
||||||
await sk.expand();
|
|
||||||
await sk.selectRowByName("No");
|
|
||||||
|
|
||||||
assert.equal(sk.header().value(), "false");
|
beforeEach() {
|
||||||
|
this.set("channel", fabricators.chatChannel());
|
||||||
|
},
|
||||||
|
|
||||||
|
async test(assert) {
|
||||||
|
assert.dom(".channel-settings-view__auto-join-selector").doesNotExist();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -253,7 +251,7 @@ module(
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
componentTest("allow channel wide mentions", {
|
componentTest("hide channel wide mentions", {
|
||||||
template: hbs`{{chat-channel-settings-view channel=channel}}`,
|
template: hbs`{{chat-channel-settings-view channel=channel}}`,
|
||||||
|
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
|
@ -271,5 +269,22 @@ module(
|
||||||
.doesNotExist();
|
.doesNotExist();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
componentTest("hide channel auto join", {
|
||||||
|
template: hbs`{{chat-channel-settings-view channel=channel}}`,
|
||||||
|
|
||||||
|
beforeEach() {
|
||||||
|
this.set(
|
||||||
|
"channel",
|
||||||
|
fabricators.chatChannel({
|
||||||
|
chatable_type: CHATABLE_TYPES.directMessageChannel,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
async test(assert) {
|
||||||
|
assert.dom(".channel-settings-view__auto-join-selector").doesNotExist();
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user