diff --git a/app/assets/javascripts/discourse/templates/topic.js.handlebars b/app/assets/javascripts/discourse/templates/topic.js.handlebars index ff179c83fdc..1a09bc300ac 100644 --- a/app/assets/javascripts/discourse/templates/topic.js.handlebars +++ b/app/assets/javascripts/discourse/templates/topic.js.handlebars @@ -27,7 +27,7 @@ {{i18n topic.loading}} {{/if}} {{/if}} - {{boundCategoryLink category}} + {{categoryLink category}} {{#if view.topic.can_edit}} diff --git a/app/assets/javascripts/discourse/views/topic_view.js b/app/assets/javascripts/discourse/views/topic_view.js index dc29b84ac5d..9e977848408 100644 --- a/app/assets/javascripts/discourse/views/topic_view.js +++ b/app/assets/javascripts/discourse/views/topic_view.js @@ -175,7 +175,6 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, { // Triggered whenever any posts are rendered, debounced to save over calling postsRendered: Discourse.debounce(function() { - this.set('renderedPosts', $('.topic-post')); this.updatePosition(false); }, 50), @@ -421,7 +420,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, { title, info, rows, screenTrack, _this, currentPost; _this = this; - rows = this.get('renderedPosts'); + rows = $('.topic-post'); if (!rows || rows.length === 0) { return; } info = Discourse.Eyeline.analyze(rows); @@ -449,10 +448,20 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, { currentPost = currentPost || seen; }); - this.nonUrgentPositionUpdate({ - userActive: userActive, - currentPost: currentPost || this.getPost($(rows[info.bottom])).get('post_number') - }); + var currentForPositionUpdate = currentPost; + if (!currentForPositionUpdate) { + var postView = this.getPost($(rows[info.bottom])); + if (postView) { currentForPositionUpdate = postView.get('post_number'); } + } + + if (currentForPositionUpdate) { + this.nonUrgentPositionUpdate({ + userActive: userActive, + currentPost: currentPost || currentForPositionUpdate + }); + } else { + console.error("can't update position "); + } offset = window.pageYOffset || $('html').scrollTop(); firstLoaded = this.get('firstPostLoaded');