From 54fed60ecb62d6608599a2a1a2a01ca1081ff78e Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 1 Jul 2013 12:23:34 +1000 Subject: [PATCH] firefox / concurrency fix, would not navigate correctly to a post. posts can be in the DOM in a non-ready state between willInsertElement and didInsertElement didInsertElement takes care of the scrolling, ignore analysing anything about that post until its properly inserted --- app/assets/javascripts/discourse/views/post_view.js | 1 + app/assets/javascripts/discourse/views/topic_view.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/views/post_view.js b/app/assets/javascripts/discourse/views/post_view.js index eddef490877..15c9f009cca 100644 --- a/app/assets/javascripts/discourse/views/post_view.js +++ b/app/assets/javascripts/discourse/views/post_view.js @@ -243,6 +243,7 @@ Discourse.PostView = Discourse.View.extend({ // Find all the quotes this.insertQuoteControls(); + $post.addClass('ready'); // be sure that eyeline tracked it var controller = this.get('controller'); if (controller && controller.postRendered) { diff --git a/app/assets/javascripts/discourse/views/topic_view.js b/app/assets/javascripts/discourse/views/topic_view.js index e1c84aa6ee6..d6485c367f0 100644 --- a/app/assets/javascripts/discourse/views/topic_view.js +++ b/app/assets/javascripts/discourse/views/topic_view.js @@ -397,7 +397,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, { updatePosition: function(userActive) { - var rows = $('.topic-post'); + var rows = $('.topic-post.ready'); if (!rows || rows.length === 0) { return; } // if we have no rows @@ -486,7 +486,8 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, { latestLink: "" + (Em.String.i18n("topic.view_latest_topics")) + "" }; - if (category = this.get('controller.content.category')) { + category = this.get('controller.content.category'); + if (category) { opts.catLink = Discourse.Utilities.categoryLink(category); } else { opts.catLink = "" + (Em.String.i18n("topic.browse_all_categories")) + "";