diff --git a/app/assets/javascripts/discourse/helpers/application_helpers.js b/app/assets/javascripts/discourse/helpers/application_helpers.js index 34ee470db11..89a58dc9040 100644 --- a/app/assets/javascripts/discourse/helpers/application_helpers.js +++ b/app/assets/javascripts/discourse/helpers/application_helpers.js @@ -32,7 +32,7 @@ Handlebars.registerHelper('topicLink', function(property, options) { var title, topic; topic = Ember.Handlebars.get(this, property, options); title = topic.get('fancy_title') || topic.get('title'); - return "" + title + ""; + return "" + title + ""; }); /** diff --git a/app/assets/javascripts/discourse/models/topic.js b/app/assets/javascripts/discourse/models/topic.js index e6c1686c8d0..af80f678cd5 100644 --- a/app/assets/javascripts/discourse/models/topic.js +++ b/app/assets/javascripts/discourse/models/topic.js @@ -78,6 +78,11 @@ Discourse.Topic = Discourse.Model.extend({ return this.urlForPostNumber(this.get('last_read_post_number')); }.property('url', 'last_read_post_number'), + lastUnreadUrl: function() { + var postNumber = Math.min(this.get('last_read_post_number') + 1, this.get('highest_post_number')); + return this.urlForPostNumber(postNumber); + }.property('url', 'last_read_post_number', 'highest_post_number'), + lastPostUrl: function() { return this.urlForPostNumber(this.get('highest_post_number')); }.property('url', 'highest_post_number'), @@ -86,8 +91,9 @@ Discourse.Topic = Discourse.Model.extend({ // tells us if we are still asynchronously flushing our "recently read" data. // So take what the browser has seen into consideration. displayNewPosts: function() { - var delta, highestSeen, result; - if (highestSeen = Discourse.Session.currentProp('highestSeenByTopic')[this.get('id')]) { + var delta, result; + var highestSeen = Discourse.Session.currentProp('highestSeenByTopic')[this.get('id')]; + if (highestSeen) { delta = highestSeen - this.get('last_read_post_number'); if (delta > 0) { result = this.get('new_posts') - delta; diff --git a/app/assets/javascripts/discourse/templates/featured_topics.js.handlebars b/app/assets/javascripts/discourse/templates/featured_topics.js.handlebars index f8b34f1399b..36d5c13fe5b 100644 --- a/app/assets/javascripts/discourse/templates/featured_topics.js.handlebars +++ b/app/assets/javascripts/discourse/templates/featured_topics.js.handlebars @@ -29,20 +29,20 @@ {{{topicLink this}}} {{#if unread}} - {{unbound unread}} + {{unbound unread}} {{/if}} {{#if new_posts}} - {{unbound new_posts}} + {{unbound new_posts}} {{/if}} {{#if unseen}} - + {{/if}} {{#if hasExcerpt}}