mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 09:22:42 +08:00
FEATURE: channels can allow/disallow @all/@here mentions (#19317)
The settings tab of each category channel should now present the option to allow or disallow channel wide mentions: @here and @all. When disallowed, using these mentions in the channel should have no effect.
This commit is contained in:
@ -9,7 +9,14 @@ import { CHATABLE_TYPES } from "discourse/plugins/chat/discourse/models/chat-cha
|
||||
import { module } from "qunit";
|
||||
|
||||
function membershipFixture(id, options = {}) {
|
||||
options = Object.assign({}, options, { muted: false, following: true });
|
||||
options = Object.assign(
|
||||
{},
|
||||
{
|
||||
muted: false,
|
||||
following: true,
|
||||
},
|
||||
options
|
||||
);
|
||||
|
||||
return {
|
||||
following: options.following,
|
||||
@ -99,7 +106,7 @@ module(
|
||||
return [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
membershipFixture(this.channel.id, { muted: true }),
|
||||
membershipFixture(this.channel.id, { muted: false }),
|
||||
];
|
||||
}
|
||||
);
|
||||
@ -111,6 +118,34 @@ module(
|
||||
assert.equal(sk.header().value(), "false");
|
||||
},
|
||||
});
|
||||
|
||||
componentTest("allow channel wide mentions", {
|
||||
template: hbs`{{chat-channel-settings-view channel=channel}}`,
|
||||
|
||||
beforeEach() {
|
||||
this.set("channel", fabricators.chatChannel());
|
||||
},
|
||||
|
||||
async test(assert) {
|
||||
pretender.put(`/chat/api/chat_channels/${this.channel.id}.json`, () => {
|
||||
return [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
{
|
||||
allow_channel_wide_mentions: false,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
const sk = selectKit(
|
||||
".channel-settings-view__channel-wide-mentions-selector"
|
||||
);
|
||||
await sk.expand();
|
||||
await sk.selectRowByName("No");
|
||||
|
||||
assert.equal(sk.header().value(), "false");
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@ -205,7 +240,7 @@ module(
|
||||
return [
|
||||
200,
|
||||
{ "Content-Type": "application/json" },
|
||||
membershipFixture(this.channel.id, { muted: true }),
|
||||
membershipFixture(this.channel.id, { muted: false }),
|
||||
];
|
||||
}
|
||||
);
|
||||
@ -217,5 +252,24 @@ module(
|
||||
assert.equal(sk.header().value(), "false");
|
||||
},
|
||||
});
|
||||
|
||||
componentTest("allow channel wide mentions", {
|
||||
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__channel-wide-mentions-selector")
|
||||
.doesNotExist();
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user