mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-21 16:00:26 +01:00
Topic await errors (#7727)
* feat: derp await * feat: restore user.getSettings * feat: cleanup * feat: make tid const * feat: cleanup * fix: tests * feat: deprecate filter:controllers.topic.get * feat: rewrite post-index logic * feat: change calculation to match others * fix: use .async * feat: remove try/catch wrapper
This commit is contained in:
committed by
GitHub
parent
5e46cf9b09
commit
bd640a1107
@@ -61,7 +61,7 @@ define('forum/topic', [
|
||||
addDropupHandler();
|
||||
addRepliesHandler();
|
||||
|
||||
navigator.init('[component="post"]', ajaxify.data.postcount, Topic.toTop, Topic.toBottom, Topic.navigatorCallback, Topic.calculateIndex);
|
||||
navigator.init('[component="post"]', ajaxify.data.postcount, Topic.toTop, Topic.toBottom, Topic.navigatorCallback);
|
||||
|
||||
handleBookmark(tid);
|
||||
|
||||
@@ -110,9 +110,7 @@ define('forum/topic', [
|
||||
if (err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
if (config.topicPostSort !== 'oldest_to_newest') {
|
||||
postCount = 2;
|
||||
}
|
||||
|
||||
navigator.scrollBottom(postCount - 1);
|
||||
});
|
||||
};
|
||||
@@ -122,7 +120,7 @@ define('forum/topic', [
|
||||
var bookmark = ajaxify.data.bookmark || storage.getItem('topic:' + tid + ':bookmark');
|
||||
var postIndex = ajaxify.data.postIndex;
|
||||
|
||||
if (postIndex > 0) {
|
||||
if (postIndex > 1) {
|
||||
if (components.get('post/anchor', postIndex - 1).length) {
|
||||
return navigator.scrollToPostIndex(postIndex - 1, true, 0);
|
||||
}
|
||||
@@ -200,13 +198,6 @@ define('forum/topic', [
|
||||
}
|
||||
}
|
||||
|
||||
Topic.calculateIndex = function (index, elementCount) {
|
||||
if (index !== 1 && config.topicPostSort !== 'oldest_to_newest') {
|
||||
return elementCount - index + 2;
|
||||
}
|
||||
return index;
|
||||
};
|
||||
|
||||
Topic.navigatorCallback = function (index, elementCount) {
|
||||
var path = ajaxify.removeRelativePath(window.location.pathname.slice(1));
|
||||
if (!path.startsWith('topic')) {
|
||||
|
||||
Reference in New Issue
Block a user