Skip to content

Commit

Permalink
Fix live updating unread count
Browse files Browse the repository at this point in the history
  • Loading branch information
gdpelican committed Aug 4, 2015
1 parent 11ef644 commit ffd5713
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions assets/javascripts/discourse/components/babble-icon.js.es6
Expand Up @@ -23,21 +23,16 @@ export default Ember.Component.extend({
}

var topic = Discourse.Topic.create(data)
var postStream = Discourse.PostStream.create(topic.post_stream)
topic.last_read_post_number = data.last_read_post_number || Discourse.Babble.topic.last_read_post_number
topic.highest_post_number = data.highest_post_number || Discourse.Babble.topic.highest_post_number

var postStream = Discourse.PostStream.create(topic.post_stream)
postStream.posts = topic.post_stream.posts
postStream.topic = topic

Discourse.Babble.topic = topic
Discourse.Babble.postStream = postStream

var updateIfGiven = function(field, data) {
Discourse.Babble.topic[field] = data[field] || Discourse.Babble.topic[field]
}

updateIfGiven('last_read_post_number', data)
updateIfGiven('highest_post_number', data)

self.set('topicVersion', self.get('topicVersion') + 1)
}
}
Expand Down

0 comments on commit ffd5713

Please sign in to comment.