mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 20:54:00 -06: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
@ -11,7 +11,8 @@ 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('categories'), category);
|
||||
!_.contains(self.get('blacklist') || [], category) &&
|
||||
!_.contains(self.get('categories'), category) ;
|
||||
});
|
||||
},
|
||||
onChangeItems: function(items) {
|
||||
|
@ -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 New Issue
Block a user