mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05: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
1 changed files with 2 additions and 3 deletions
|
@ -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 a new issue