mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 17:03:13 +08:00
Only show unique badge titles in the Badge Title dropdown
Filter the preference Badge Title to only show unique badge title names. Updated to use lodash https://meta.discourse.org/t/set-title-dialog-shows-multiple-instances-of-the-same-badge/19071
This commit is contained in:
parent
04cd3c0551
commit
765b099513
|
@ -19,9 +19,8 @@ export default Ember.ArrayController.extend({
|
|||
}.property('saving'),
|
||||
|
||||
selectableUserBadges: function() {
|
||||
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); });
|
||||
var items = this.get('model').filterBy('badge.allow_title', true);
|
||||
items = _.uniq(items, true, function(e) { return e.get('badge.name'); });
|
||||
items.unshiftObject(Em.Object.create({
|
||||
badge: Discourse.Badge.create({name: I18n.t('badges.no_title')})
|
||||
}));
|
||||
|
|
Loading…
Reference in New Issue
Block a user