diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js index bff44219372..7ff978bd411 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js @@ -153,6 +153,18 @@ acceptance("Composer Actions", function (needs) { 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) { await visit("/t/lorem-ipsum-dolor-sit-amet/130"); await click(".create.reply"); diff --git a/app/assets/javascripts/select-kit/addon/components/composer-actions.js b/app/assets/javascripts/select-kit/addon/components/composer-actions.js index 19228385a1a..370d50ad451 100644 --- a/app/assets/javascripts/select-kit/addon/components/composer-actions.js +++ b/app/assets/javascripts/select-kit/addon/components/composer-actions.js @@ -137,6 +137,7 @@ export default DropdownSelectBoxComponent.extend({ this.topic && !this.topic.isPrivateMessage && !this.isEditing && + this.currentUser.can_create_topic && _topicSnapshot ) { 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({ name: I18n.t("composer.composer_actions.create_topic.label"), description: I18n.t("composer.composer_actions.create_topic.desc"),