feat: show ignored/watched topics in topic list, closes #10974

This commit is contained in:
Barış Soner Uşaklı
2024-05-25 12:28:39 -04:00
parent e0515080a0
commit 29dbe92d6e
4 changed files with 11 additions and 6 deletions

View File

@@ -103,10 +103,10 @@
"nodebb-plugin-ntfy": "1.7.4", "nodebb-plugin-ntfy": "1.7.4",
"nodebb-plugin-spam-be-gone": "2.2.2", "nodebb-plugin-spam-be-gone": "2.2.2",
"nodebb-rewards-essentials": "1.0.0", "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-lavender": "7.1.8",
"nodebb-theme-peace": "2.2.5", "nodebb-theme-peace": "2.2.5",
"nodebb-theme-persona": "13.3.19", "nodebb-theme-persona": "13.3.20",
"nodebb-widget-essentials": "7.0.16", "nodebb-widget-essentials": "7.0.16",
"nodemailer": "6.9.13", "nodemailer": "6.9.13",
"nprogress": "0.2.0", "nprogress": "0.2.0",

View File

@@ -156,6 +156,8 @@ TopicObject:
type: boolean type: boolean
ignored: ignored:
type: boolean type: boolean
followed:
type: boolean
unread: unread:
type: boolean type: boolean
bookmark: bookmark:

View File

@@ -176,6 +176,8 @@ get:
type: boolean type: boolean
ignored: ignored:
type: boolean type: boolean
followed:
type: boolean
unread: unread:
type: boolean type: boolean
bookmark: bookmark:

View File

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