mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Prevent user from selecting the same category twice for different notification levels in their preferences
This commit is contained in:
parent
6daef624c3
commit
72a6566bfd
3 changed files with 9 additions and 4 deletions
|
@ -11,6 +11,7 @@ Discourse.CategoryGroupComponent = Ember.Component.extend({
|
|||
return Discourse.Category.list().filter(function(category){
|
||||
var regex = new RegExp(term, "i");
|
||||
return category.get("name").match(regex) &&
|
||||
!_.contains(self.get('blacklist') || [], category) &&
|
||||
!_.contains(self.get('categories'), category) ;
|
||||
});
|
||||
},
|
||||
|
|
|
@ -15,6 +15,10 @@ Discourse.PreferencesController = Discourse.ObjectController.extend({
|
|||
return Discourse.SiteSettings.allow_user_locale;
|
||||
}.property(),
|
||||
|
||||
selectedCategories: function(){
|
||||
return [].concat(this.get("watchedCategories"), this.get("trackedCategories"), this.get("mutedCategories"));
|
||||
}.property("watchedCategories", "trackedCategories", "mutedCategories"),
|
||||
|
||||
// By default we haven't saved anything
|
||||
saved: false,
|
||||
|
||||
|
|
|
@ -187,17 +187,17 @@
|
|||
<label class="control-label">{{i18n user.categories_settings}}</label>
|
||||
<div class="controls category-controls">
|
||||
<label>{{i18n user.watched_categories}}</label>
|
||||
{{category-group categories=watchedCategories}}
|
||||
{{category-group categories=watchedCategories blacklist=selectedCategories}}
|
||||
</div>
|
||||
<div class="instructions">{{i18n user.watched_categories_instructions}}</div>
|
||||
<div class="controls category-controls">
|
||||
<label>{{i18n user.tracked_categories}}</label>
|
||||
{{category-group categories=trackedCategories}}
|
||||
{{category-group categories=trackedCategories blacklist=selectedCategories}}
|
||||
</div>
|
||||
<div class="instructions">{{i18n user.tracked_categories_instructions}}</div>
|
||||
<div class="controls category-controls">
|
||||
<label>{{i18n user.muted_categories}}</label>
|
||||
{{category-group categories=mutedCategories}}
|
||||
{{category-group categories=mutedCategories blacklist=selectedCategories}}
|
||||
</div>
|
||||
<div class="instructions">{{i18n user.muted_categories_instructions}}</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue