mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
FIX: Javascript errors when navigating to some topics
This commit is contained in:
parent
2ca734c118
commit
7b70330e85
2 changed files with 16 additions and 7 deletions
|
@ -27,7 +27,7 @@
|
|||
{{i18n topic.loading}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{boundCategoryLink category}}
|
||||
{{categoryLink category}}
|
||||
|
||||
{{#if view.topic.can_edit}}
|
||||
<a href='#' {{action editTopic target="view"}} class='edit-topic' title='{{i18n edit}}'><i class="icon-pencil"></i></a>
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
||||
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 || this.getPost($(rows[info.bottom])).get('post_number')
|
||||
currentPost: currentPost || currentForPositionUpdate
|
||||
});
|
||||
} else {
|
||||
console.error("can't update position ");
|
||||
}
|
||||
|
||||
offset = window.pageYOffset || $('html').scrollTop();
|
||||
firstLoaded = this.get('firstPostLoaded');
|
||||
|
|
Loading…
Reference in a new issue