Skip to content

Commit

Permalink
feat: show ignored/watched topics in topic list, closes #10974
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed May 25, 2024
1 parent e051508 commit 29dbe92
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions install/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@
"nodebb-plugin-ntfy": "1.7.4",
"nodebb-plugin-spam-be-gone": "2.2.2",
"nodebb-rewards-essentials": "1.0.0",
"nodebb-theme-harmony": "1.2.56",
"nodebb-theme-harmony": "1.2.57",
"nodebb-theme-lavender": "7.1.8",
"nodebb-theme-peace": "2.2.5",
"nodebb-theme-persona": "13.3.19",
"nodebb-theme-persona": "13.3.20",
"nodebb-widget-essentials": "7.0.16",
"nodemailer": "6.9.13",
"nprogress": "0.2.0",
Expand Down
2 changes: 2 additions & 0 deletions public/openapi/components/schemas/TopicObject.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ TopicObject:
type: boolean
ignored:
type: boolean
followed:
type: boolean
unread:
type: boolean
bookmark:
Expand Down
2 changes: 2 additions & 0 deletions public/openapi/read/unread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ get:
type: boolean
ignored:
type: boolean
followed:
type: boolean
unread:
type: boolean
bookmark:
Expand Down
9 changes: 5 additions & 4 deletions src/topics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ Topics.getTopicsByTids = async function (tids, options) {
};
}

const [result, hasRead, isIgnored, bookmarks, callerSettings] = await Promise.all([
const [result, hasRead, followData, bookmarks, callerSettings] = await Promise.all([
loadTopics(),
Topics.hasReadTopics(tids, uid),
Topics.isIgnoring(tids, uid),
Topics.getFollowData(tids, uid),
Topics.getUserBookmarks(tids, uid),
user.getSettings(uid),
]);
Expand All @@ -136,8 +136,9 @@ Topics.getTopicsByTids = async function (tids, options) {
}
topic.teaser = result.teasers[i] || null;
topic.isOwner = topic.uid === parseInt(uid, 10);
topic.ignored = isIgnored[i];
topic.unread = parseInt(uid, 10) <= 0 || (!hasRead[i] && !isIgnored[i]);
topic.ignored = followData[i].ignoring;
topic.followed = followData[i].following;
topic.unread = parseInt(uid, 10) <= 0 || (!hasRead[i] && !topic.ignored[i]);
topic.bookmark = bookmarks[i] && (sortNewToOld ?
Math.max(1, topic.postcount + 2 - bookmarks[i]) :
Math.min(topic.postcount, bookmarks[i] + 1));
Expand Down

0 comments on commit 29dbe92

Please sign in to comment.