FIX: allow mods to choose restricted categories as parent category.

FIX: allow mods to choose restricted categories as parent category.

Currently moderators can’t choose a category with only “See” permission as a parent in edit-category modal.

diff --git a/app/assets/javascripts/discourse/app/templates/components/edit-category-general.hbs b/app/assets/javascripts/discourse/app/templates/components/edit-category-general.hbs
index 75590db..23e2981 100644
--- a/app/assets/javascripts/discourse/app/templates/components/edit-category-general.hbs
+++ b/app/assets/javascripts/discourse/app/templates/components/edit-category-general.hbs
@@ -18,6 +18,7 @@
         categories=parentCategories
         allowSubCategories=true
         allowUncategorized=false
+        allowRestrictedCategories=true
         onChange=(action (mut category.parent_category_id))
       }}
     </section>
diff --git a/app/assets/javascripts/select-kit/addon/components/category-chooser.js b/app/assets/javascripts/select-kit/addon/components/category-chooser.js
index 72d0167..9f6daff 100644
--- a/app/assets/javascripts/select-kit/addon/components/category-chooser.js
+++ b/app/assets/javascripts/select-kit/addon/components/category-chooser.js
@@ -138,7 +138,7 @@ export default ComboBoxComponent.extend({
       }
 
       const permissionType = this.selectKit.options.permissionType;
-      if (permissionType) {
+      if (permissionType && !this.allowRestrictedCategories) {
         return permissionType === category.permission;
       }
 

GitHub sha: fc511150

1 Like

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

https://meta.discourse.org/t/cannot-chose-category-if-permission-is-read-only-in-parent-as-moderator/158447/4

Can you also add a test to ensure this does not regress?

1 Like