A platform for community discussion. Free, open, simple.
FIX: Show tag chooser if can_tag_pms (#18107)
Bianca Nenciuf3512006838c
diff --git a/app/assets/javascripts/discourse/app/controllers/composer.js b/app/assets/javascripts/discourse/app/controllers/composer.jsindex 574b992653c..7aa93052ead 100644--- a/app/assets/javascripts/discourse/app/controllers/composer.js+++ b/app/assets/javascripts/discourse/app/controllers/composer.js@@ -204,14 +204,17 @@ export default Controller.extend({@discourseComputed("model.canEditTitle", "model.creatingPrivateMessage")canEditTags(canEditTitle, creatingPrivateMessage) {- if (creatingPrivateMessage && (this.site.mobileView || !this.isStaffUser)) {+ if (creatingPrivateMessage && this.site.mobileView) {return false;}+ const isPrivateMessage =+ creatingPrivateMessage || this.get("model.topic.isPrivateMessage");+return (- this.site.can_tag_topics &&canEditTitle &&- (!this.get("model.topic.isPrivateMessage") || this.site.can_tag_pms)+ this.site.can_tag_topics &&+ (!isPrivateMessage || this.site.can_tag_pms));},diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.jsindex 3ea0d2fe9e3..fcea9970858 100644--- a/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.js@@ -1,5 +1,6 @@import {acceptance,+ exists,query,updateCurrentUser,} from "discourse/tests/helpers/qunit-helpers";@@ -98,4 +99,28 @@ acceptance("Composer - Tags", function (needs) {await click("#reply-control button.create");assert.notStrictEqual(currentURL(), "/");});++ test("users who cannot tag PMs do not see the selector", async function (assert) {+ await visit("/u/charlie");+ await click("button.compose-pm");++ assert.notOk(exists(".composer-fields .mini-tag-chooser"));+ });+});++acceptance("Composer - Tags (PMs)", function (needs) {+ needs.user();+ needs.pretender((server, helper) => {+ server.post("/uploads/lookup-urls", () => {+ return helper.response([]);+ });+ });+ needs.site({ can_tag_topics: true, can_tag_pms: true });++ test("users who can tag PMs see the selector", async function (assert) {+ await visit("/u/charlie");+ await click("button.compose-pm");++ assert.ok(exists(".composer-fields .mini-tag-chooser"));+ });});