mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
fix(forum): keep closed posts visible without a reload (#3309)
This commit is contained in:
1 parent
334fef52e1
commit
89fa895a0a
2 files changed
+5
-4
No files matched your search
@@ -38,7 +38,7 @@ export function getForumPostListView(forum: Channel): ForumPostListView {
|
||||
}
|
||||
const list = ForumPosts.getList(forum.id, 'archived');
|
||||
const {pinned, active, archived} = buildForumPostList({
|
||||
active: ChannelThreads.getActiveThreadsForParent(forum.id),
|
||||
known: ChannelThreads.getThreadsForParent(forum.id),
|
||||
extra: resolvePosts(forum.id, list.ids),
|
||||
sortOrder: ForumPosts.getSortOrder(forum),
|
||||
tagIds: ForumPosts.getTagFilter(forum.id),
|
||||
|
||||
@@ -30,7 +30,7 @@ export function matchesTagFilter(
|
||||
}
|
||||
|
||||
export interface ForumPostListInput {
|
||||
active: ReadonlyArray<Channel>;
|
||||
known: ReadonlyArray<Channel>;
|
||||
extra: ReadonlyArray<Channel>;
|
||||
sortOrder: ForumSortOrderType;
|
||||
tagIds: ReadonlyArray<string>;
|
||||
@@ -44,7 +44,7 @@ export interface ForumPostListResult {
|
||||
}
|
||||
|
||||
export function buildForumPostList({
|
||||
active,
|
||||
known,
|
||||
extra,
|
||||
sortOrder,
|
||||
tagIds,
|
||||
@@ -54,7 +54,7 @@ export function buildForumPostList({
|
||||
const activePosts: Array<Channel> = [];
|
||||
const archivedPosts: Array<Channel> = [];
|
||||
let pinned: Channel | null = null;
|
||||
for (const post of [...active, ...extra]) {
|
||||
for (const post of [...known, ...extra]) {
|
||||
if (seen.has(post.id)) continue;
|
||||
seen.add(post.id);
|
||||
if (!matchesTagFilter(post.appliedTags, tagIds, tagSetting)) continue;
|
||||
@@ -67,5 +67,6 @@ export function buildForumPostList({
|
||||
const byKey = (a: Channel, b: Channel) =>
|
||||
SnowflakeUtils.compare(postSortKey(b, sortOrder), postSortKey(a, sortOrder));
|
||||
activePosts.sort(byKey);
|
||||
archivedPosts.sort(byKey);
|
||||
return {pinned, active: activePosts, archived: archivedPosts};
|
||||
}
|
||||
Reference in new issue
Block a user