mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-25 07:54:11 -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}}
|
{{i18n topic.loading}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{boundCategoryLink category}}
|
{{categoryLink category}}
|
||||||
|
|
||||||
{{#if view.topic.can_edit}}
|
{{#if view.topic.can_edit}}
|
||||||
<a href='#' {{action editTopic target="view"}} class='edit-topic' title='{{i18n edit}}'><i class="icon-pencil"></i></a>
|
<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
|
// Triggered whenever any posts are rendered, debounced to save over calling
|
||||||
postsRendered: Discourse.debounce(function() {
|
postsRendered: Discourse.debounce(function() {
|
||||||
this.set('renderedPosts', $('.topic-post'));
|
|
||||||
this.updatePosition(false);
|
this.updatePosition(false);
|
||||||
}, 50),
|
}, 50),
|
||||||
|
|
||||||
|
@ -421,7 +420,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
title, info, rows, screenTrack, _this, currentPost;
|
title, info, rows, screenTrack, _this, currentPost;
|
||||||
|
|
||||||
_this = this;
|
_this = this;
|
||||||
rows = this.get('renderedPosts');
|
rows = $('.topic-post');
|
||||||
|
|
||||||
if (!rows || rows.length === 0) { return; }
|
if (!rows || rows.length === 0) { return; }
|
||||||
info = Discourse.Eyeline.analyze(rows);
|
info = Discourse.Eyeline.analyze(rows);
|
||||||
|
@ -449,10 +448,20 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
||||||
currentPost = currentPost || seen;
|
currentPost = currentPost || seen;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.nonUrgentPositionUpdate({
|
var currentForPositionUpdate = currentPost;
|
||||||
userActive: userActive,
|
if (!currentForPositionUpdate) {
|
||||||
currentPost: currentPost || this.getPost($(rows[info.bottom])).get('post_number')
|
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();
|
offset = window.pageYOffset || $('html').scrollTop();
|
||||||
firstLoaded = this.get('firstPostLoaded');
|
firstLoaded = this.get('firstPostLoaded');
|
||||||
|
|
Loading…
Reference in a new issue