FIX: do not update tag name on /tags/intersection

FIX: do not update tag name on /tags/intersection

diff --git a/app/assets/javascripts/discourse/routes/tags-show.js.es6 b/app/assets/javascripts/discourse/routes/tags-show.js.es6
index c4d7edd..73e992a 100644
--- a/app/assets/javascripts/discourse/routes/tags-show.js.es6
+++ b/app/assets/javascripts/discourse/routes/tags-show.js.es6
@@ -109,7 +109,7 @@ export default Discourse.Route.extend({
       params,
       {}
     ).then(list => {
-      if (list.topic_list.tags) {
+      if (list.topic_list.tags && list.topic_list.tags.length === 1) {
         tag.set("id", list.topic_list.tags[0].name); // Update name of tag (case might be different)
       }
       controller.setProperties({
diff --git a/test/javascripts/acceptance/tags-intersection-test.js.es6 b/test/javascripts/acceptance/tags-intersection-test.js.es6
index 85787a6..1025266 100644
--- a/test/javascripts/acceptance/tags-intersection-test.js.es6
+++ b/test/javascripts/acceptance/tags-intersection-test.js.es6
@@ -19,8 +19,8 @@ acceptance("Tags intersection", {
           draft_key: "new_topic",
           topics: [{ id: 16, posters: [] }],
           tags: [
-            { id: 1, name: "first", topic_count: 1 },
-            { id: 2, name: "second", topic_count: 1 }
+            { id: 1, name: "second", topic_count: 1 },
+            { id: 2, name: "first", topic_count: 1 }
           ]
         }
       });

GitHub sha: 6ea9f5c9

Why was this changed?

This change replicates the error we were observing. Without the fix this test fails with response "second, second". This is to ensure that we do not regress here.

1 Like