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

@@ -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),
]);
@@ -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));