FEATURE: allow group membership to unmute categories and tags

FEATURE: allow group membership to unmute categories and tags

For sites that are configured to mute some or all categories and tags for users by default, groups can now be configured to set members’ notification level to normal from the group manage UI.

diff --git a/app/assets/javascripts/discourse/app/controllers/group-manage-categories.js b/app/assets/javascripts/discourse/app/controllers/group-manage-categories.js
index 629679c..0105951 100644
--- a/app/assets/javascripts/discourse/app/controllers/group-manage-categories.js
+++ b/app/assets/javascripts/discourse/app/controllers/group-manage-categories.js
@@ -6,9 +6,12 @@ export default Controller.extend({
     "model.watchingCategories.[]",
     "model.watchingFirstPostCategories.[]",
     "model.trackingCategories.[]",
+    "model.regularCategories.[]",
     "model.mutedCategories.[]"
   )
-  selectedCategories(watching, watchingFirst, tracking, muted) {
-    return [].concat(watching, watchingFirst, tracking, muted).filter(t => t);
+  selectedCategories(watching, watchingFirst, tracking, regular, muted) {
+    return []
+      .concat(watching, watchingFirst, tracking, regular, muted)
+      .filter(t => t);
   }
 });
diff --git a/app/assets/javascripts/discourse/app/controllers/group-manage-tags.js b/app/assets/javascripts/discourse/app/controllers/group-manage-tags.js
index 151365c..0066b58 100644
--- a/app/assets/javascripts/discourse/app/controllers/group-manage-tags.js
+++ b/app/assets/javascripts/discourse/app/controllers/group-manage-tags.js
@@ -6,9 +6,12 @@ export default Controller.extend({
     "model.watching_tags.[]",
     "model.watching_first_post_tags.[]",
     "model.tracking_tags.[]",
+    "model.regular_tags.[]",
     "model.muted_tags.[]"
   )
-  selectedTags(watching, watchingFirst, tracking, muted) {
-    return [].concat(watching, watchingFirst, tracking, muted).filter(t => t);
+  selectedTags(watching, watchingFirst, tracking, regular, muted) {
+    return []
+      .concat(watching, watchingFirst, tracking, regular, muted)
+      .filter(t => t);
   }
 });
diff --git a/app/assets/javascripts/discourse/app/models/group.js b/app/assets/javascripts/discourse/app/models/group.js
index 883aedc..1f3681b 100644
--- a/app/assets/javascripts/discourse/app/models/group.js
+++ b/app/assets/javascripts/discourse/app/models/group.js
@@ -200,6 +200,14 @@ const Group = RestModel.extend({
     );
   },
 
+  @observes("regular_category_ids")
+  _updateRegularCategories() {
+    this.set(
+      "regularCategories",
+      Category.findByIds(this.regular_category_ids)
+    );
+  },
+
   @observes("muted_category_ids")
   _updateMutedCategories() {
     this.set("mutedCategories", Category.findByIds(this.muted_category_ids));
@@ -240,25 +248,27 @@ const Group = RestModel.extend({
       publish_read_state: this.publish_read_state
     };
 
-    ["muted", "watching", "tracking", "watching_first_post"].forEach(s => {
-      let prop =
-        s === "watching_first_post"
-          ? "watchingFirstPostCategories"
-          : s + "Categories";
+    ["muted", "regular", "watching", "tracking", "watching_first_post"].forEach(
+      s => {
+        let prop =
+          s === "watching_first_post"
+            ? "watchingFirstPostCategories"
+            : s + "Categories";
 
-      let categories = this.get(prop);
+        let categories = this.get(prop);
 
-      if (categories) {
-        attrs[s + "_category_ids"] =
-          categories.length > 0 ? categories.map(c => c.get("id")) : [-1];
-      }
+        if (categories) {
+          attrs[s + "_category_ids"] =
+            categories.length > 0 ? categories.map(c => c.get("id")) : [-1];
+        }
 
-      let tags = this.get(s + "_tags");
+        let tags = this.get(s + "_tags");
 
-      if (tags) {
-        attrs[s + "_tags"] = tags.length > 0 ? tags : [""];
+        if (tags) {
+          attrs[s + "_tags"] = tags.length > 0 ? tags : [""];
+        }
       }
-    });
+    );
 
     if (this.flair_type === "icon") {
       attrs["flair_icon"] = this.flair_icon;
diff --git a/app/assets/javascripts/discourse/app/templates/group/manage/categories.hbs b/app/assets/javascripts/discourse/app/templates/group/manage/categories.hbs
index c130ce5..61af9de 100644
--- a/app/assets/javascripts/discourse/app/templates/group/manage/categories.hbs
+++ b/app/assets/javascripts/discourse/app/templates/group/manage/categories.hbs
@@ -5,11 +5,11 @@
   </div>
 
   <div class="control-group">
-    <label>{{d-icon "d-watching"}} {{i18n "user.watched_categories"}}</label>
+    <label>{{d-icon "d-watching"}} {{i18n "groups.notifications.watching.title"}}</label>
 
     {{category-selector
       categories=model.watchingCategories
-      blacklist=selectedCategories
+      blocklist=selectedCategories
       onChange=(action (mut model.watchingCategories))
     }}
 
@@ -19,11 +19,11 @@
   </div>
 
   <div class="control-group">
-    <label>{{d-icon "d-tracking"}} {{i18n "user.tracked_categories"}}</label>
+    <label>{{d-icon "d-tracking"}} {{i18n "groups.notifications.tracking.title"}}</label>
 
     {{category-selector
       categories=model.trackingCategories
-      blacklist=selectedCategories
+      blocklist=selectedCategories
       onChange=(action (mut model.trackingCategories))
     }}
 
@@ -33,11 +33,11 @@
   </div>
 
   <div class="control-group">
-    <label>{{d-icon "d-watching-first"}} {{i18n "user.watched_first_post_categories"}}</label>
+    <label>{{d-icon "d-watching-first"}} {{i18n "groups.notifications.watching_first_post.title"}}</label>
 
     {{category-selector
       categories=model.watchingFirstPostCategories
-      blacklist=selectedCategories
+      blocklist=selectedCategories
       onChange=(action (mut model.watchingFirstPostCategories))
     }}
 
@@ -47,11 +47,25 @@
   </div>
 
   <div class="control-group">
-    <label>{{d-icon "d-muted"}} {{i18n "user.muted_categories"}}</label>
+    <label>{{d-icon "d-regular"}} {{i18n "groups.notifications.regular.title"}}</label>
+
+    {{category-selector
+      categories=model.regularCategories
+      blocklist=selectedCategories
+      onChange=(action (mut model.regularCategories))
+    }}
+
+    <div class="control-instructions">
+      {{i18n "groups.manage.categories.regular_categories_instructions"}}
+    </div>
+  </div>
+
+  <div class="control-group">
+    <label>{{d-icon "d-muted"}} {{i18n "groups.notifications.muted.title"}}</label>
 
     {{category-selector
       categories=model.mutedCategories
-      blacklist=selectedCategories
+      blocklist=selectedCategories
       onChange=(action (mut model.mutedCategories))
     }}
 
diff --git a/app/assets/javascripts/discourse/app/templates/group/manage/tags.hbs b/app/assets/javascripts/discourse/app/templates/group/manage/tags.hbs
index 6a5a910..604ac18 100644
--- a/app/assets/javascripts/discourse/app/templates/group/manage/tags.hbs
+++ b/app/assets/javascripts/discourse/app/templates/group/manage/tags.hbs
@@ -5,7 +5,7 @@
   </div>
 
   <div class="control-group">
-    <label>{{d-icon "d-watching"}} {{i18n "user.watched_tags"}}</label>
+    <label>{{d-icon "d-watching"}} {{i18n "groups.notifications.watching.title"}}</label>
 
     {{tag-chooser
       tags=model.watching_tags
@@ -21,7 +21,7 @@
   </div>
 
   <div class="control-group">
-    <label>{{d-icon "d-tracking"}} {{i18n "user.tracked_tags"}}</label>
+    <label>{{d-icon "d-tracking"}} {{i18n "groups.notifications.tracking.title"}}</label>
 
     {{tag-chooser
       tags=model.tracking_tags
@@ -37,7 +37,7 @@
   </div>
 
   <div class="control-group">
-    <label>{{d-icon "d-watching-first"}} {{i18n "user.watched_first_post_tags"}}</label>
+    <label>{{d-icon "d-watching-first"}} {{i18n "groups.notifications.watching_first_post.title"}}</label>
 
     {{tag-chooser
       tags=model.watching_first_post_tags
@@ -53,7 +53,23 @@
   </div>
 
   <div class="control-group">
-    <label>{{d-icon "d-muted"}} {{i18n "user.muted_tags"}}</label>
+    <label>{{d-icon "d-regular"}} {{i18n "groups.notifications.regular.title"}}</label>
+
+    {{tag-chooser
+      tags=model.regular_tags
+      blacklist=selectedTags
+      allowCreate=false
+      everyTag=true
+      unlimitedTagCount=true
+    }}
+

[... diff too long, it was truncated ...]

GitHub sha: d65a8395