mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 12:02:46 +08:00
FIX: no reply as a new topic without permission (#25641)
`create topic allowed groups` site setting controls permission to create a new topic. If a user cannot create a topic, a reply as a new topic button should not be visible as well.
This commit is contained in:
parent
021a02c3d8
commit
949b5f3fa9
|
@ -153,6 +153,18 @@ acceptance("Composer Actions", function (needs) {
|
||||||
assert.ok(!exists(".dialog-body"));
|
assert.ok(!exists(".dialog-body"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("reply_as_new_topic without a permission to create topic", async function (assert) {
|
||||||
|
updateCurrentUser({ can_create_topic: false });
|
||||||
|
await visit("/t/internationalization-localization/280");
|
||||||
|
await click(".create.reply");
|
||||||
|
const composerActions = selectKit(".composer-actions");
|
||||||
|
await composerActions.expand();
|
||||||
|
assert.ok(
|
||||||
|
!exists(".composer-actions svg.d-icon-plus"),
|
||||||
|
"reply as new topic icon is not visible"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("reply_as_new_group_message", async function (assert) {
|
test("reply_as_new_group_message", async function (assert) {
|
||||||
await visit("/t/lorem-ipsum-dolor-sit-amet/130");
|
await visit("/t/lorem-ipsum-dolor-sit-amet/130");
|
||||||
await click(".create.reply");
|
await click(".create.reply");
|
||||||
|
|
|
@ -137,6 +137,7 @@ export default DropdownSelectBoxComponent.extend({
|
||||||
this.topic &&
|
this.topic &&
|
||||||
!this.topic.isPrivateMessage &&
|
!this.topic.isPrivateMessage &&
|
||||||
!this.isEditing &&
|
!this.isEditing &&
|
||||||
|
this.currentUser.can_create_topic &&
|
||||||
_topicSnapshot
|
_topicSnapshot
|
||||||
) {
|
) {
|
||||||
items.push({
|
items.push({
|
||||||
|
@ -222,7 +223,7 @@ export default DropdownSelectBoxComponent.extend({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items.length === 0) {
|
if (items.length === 0 && this.currentUser.can_create_topic) {
|
||||||
items.push({
|
items.push({
|
||||||
name: I18n.t("composer.composer_actions.create_topic.label"),
|
name: I18n.t("composer.composer_actions.create_topic.label"),
|
||||||
description: I18n.t("composer.composer_actions.create_topic.desc"),
|
description: I18n.t("composer.composer_actions.create_topic.desc"),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user