Skip to content

Commit

Permalink
fix: #8538, go to first unread instead of last read
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Jul 31, 2020
1 parent 029f477 commit 519e665
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions public/src/client/topic.js
Expand Up @@ -136,7 +136,7 @@ define('forum/topic', [
timeout: 0,
type: 'info',
clickfn: function () {
navigator.scrollToIndex(parseInt(bookmark - 1, 10), true);
navigator.scrollToIndex(parseInt(bookmark, 10), true);
},
closefn: function () {
storage.removeItem('topic:' + tid + ':bookmark');
Expand Down Expand Up @@ -259,7 +259,7 @@ define('forum/topic', [
if (err) {
return app.alertError(err.message);
}
ajaxify.data.bookmark = index;
ajaxify.data.bookmark = index + 1;
});
} else {
storage.setItem(bookmarkKey, index);
Expand Down
4 changes: 3 additions & 1 deletion src/topics/index.js
Expand Up @@ -119,7 +119,9 @@ Topics.getTopicsByTids = async function (tids, options) {
topic.isOwner = topic.uid === parseInt(uid, 10);
topic.ignored = isIgnored[i];
topic.unread = !hasRead[i] && !isIgnored[i];
topic.bookmark = sortOldToNew ? Math.max(1, topic.postcount + 2 - bookmarks[i]) : bookmarks[i];
topic.bookmark = sortOldToNew ?
Math.max(1, topic.postcount + 2 - bookmarks[i]) :
Math.min(topic.postcount, bookmarks[i] + 1);
topic.unreplied = !topic.teaser;

topic.icons = [];
Expand Down

0 comments on commit 519e665

Please sign in to comment.