Only show unique badge titles in the Badge Title dropdown
Filter the preference Badge Title to only show unique badge title names. https://meta.discourse.org/t/set-title-dialog-shows-multiple-instances-of-the-same-badge/19071
This commit is contained in:
parent
bf5563e2fc
commit
04cd3c0551
|
@ -19,7 +19,9 @@ export default Ember.ArrayController.extend({
|
|||
}.property('saving'),
|
||||
|
||||
selectableUserBadges: function() {
|
||||
var items = this.get('model').filterBy('badge.allow_title', true);
|
||||
var items = new Array();
|
||||
this.get('model').filterBy('badge.allow_title', true).forEach(function(item, index, arr) {
|
||||
if(!items.findBy('badge.name', item.badge.name)) items.push(item); });
|
||||
items.unshiftObject(Em.Object.create({
|
||||
badge: Discourse.Badge.create({name: I18n.t('badges.no_title')})
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue