From 5dd9009718b2216c746cd8f869fd4901e94d71f7 Mon Sep 17 00:00:00 2001 From: James Kiesel Date: Mon, 15 Aug 2016 15:36:28 -0400 Subject: [PATCH] Clean up additionalTags impl --- .../javascripts/discourse/routes/tags-show.js.es6 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/routes/tags-show.js.es6 b/app/assets/javascripts/discourse/routes/tags-show.js.es6 index 4fab00b9351..79e6ea987a7 100644 --- a/app/assets/javascripts/discourse/routes/tags-show.js.es6 +++ b/app/assets/javascripts/discourse/routes/tags-show.js.es6 @@ -15,10 +15,9 @@ export default Discourse.Route.extend({ f = ''; if (params.additional_tags) { - this.set("additionalTags", _.compact(params.additional_tags.split('/')).map((tag) => { - return this.store.createRecord("tag", { id: Handlebars.Utils.escapeExpression(tag) }); + this.set("additionalTags", params.additional_tags.split('/').map((tag) => { + return this.store.createRecord("tag", { id: Handlebars.Utils.escapeExpression(tag) }).id; })); - this.set("additionalTagIds", _.pluck(this.get("additionalTags"), 'id')); } if (params.category) { @@ -63,8 +62,8 @@ export default Discourse.Route.extend({ } this.set('category', category); - } else if (_.any(this.get("additionalTags"))) { - params.filter = `tags/intersection/${tag_id}/${this.get('additionalTagIds').join('/')}`; + } else if (this.get("additionalTags")) { + params.filter = `tags/intersection/${tag_id}/${this.get('additionalTags').join('/')}`; this.set('category', null); } else { params.filter = `tags/${tag_id}/l/${filter}`; @@ -134,7 +133,7 @@ export default Discourse.Route.extend({ // Pre-fill the tags input field if (controller.get('model.id')) { var c = self.controllerFor('composer').get('model'); - c.set('tags', _.flatten([controller.get('model.id')], controller.get('additionalTagIds'))); + c.set('tags', _.flatten([controller.get('model.id')], controller.get('additionalTags'))); } }); },