FIX: tag input says tags are optional when they're required

FIX: tag input says tags are optional when they’re required

diff --git a/app/assets/javascripts/discourse/app/controllers/topic.js b/app/assets/javascripts/discourse/app/controllers/topic.js
index 2c2ebdc..ba7caf5 100644
--- a/app/assets/javascripts/discourse/app/controllers/topic.js
+++ b/app/assets/javascripts/discourse/app/controllers/topic.js
@@ -185,6 +185,13 @@ export default Controller.extend(bufferedProperty("model"), {
     );
   },
 
+  @discourseComputed("model.category")
+  minimumRequiredTags(category) {
+    return category && category.minimum_required_tags > 0
+      ? category.minimum_required_tags
+      : null;
+  },
+
   _forceRefreshPostStream() {
     this.appEvents.trigger("post-stream:refresh", { force: true });
   },
diff --git a/app/assets/javascripts/discourse/app/templates/topic.hbs b/app/assets/javascripts/discourse/app/templates/topic.hbs
index 488970c..d5e22f5 100644
--- a/app/assets/javascripts/discourse/app/templates/topic.hbs
+++ b/app/assets/javascripts/discourse/app/templates/topic.hbs
@@ -36,6 +36,7 @@
                 options=(hash
                   filterable=true
                   categoryId=buffered.category_id
+                  minimum=minimumRequiredTags
                 )
               }}
             {{/if}}

GitHub sha: 5a71c51d

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/regression-in-showing-optional-tags-when-tags-are-required/152068/4