DEV: correct performance hack

DEV: correct performance hack

This code was intended to bypass iterating through tags in absence of a new or unread topic.

Instead it always fired cause it was checking for function existence which was clearly always true.

diff --git a/app/assets/javascripts/discourse/app/models/topic-tracking-state.js b/app/assets/javascripts/discourse/app/models/topic-tracking-state.js
index 014b176..7a0c537 100644
--- a/app/assets/javascripts/discourse/app/models/topic-tracking-state.js
+++ b/app/assets/javascripts/discourse/app/models/topic-tracking-state.js
@@ -456,7 +456,7 @@ const TopicTrackingState = EmberObject.extend({
       ) {
         let newTopic = isNew(topic);
         let unreadTopic = isUnread(topic);
-        if (isUnread || isNew) {
+        if (newTopic || unreadTopic) {
           tags.forEach(tag => {
             if (topic.tags.indexOf(tag) > -1) {
               if (unreadTopic) {

GitHub sha: 179335b5

1 Like