A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(forum): keep closed posts visible without a reload (#3309)
Hampus89fa895a0a10
diff --git a/fluxer_app/src/features/forum/hooks/useForumPosts.ts b/fluxer_app/src/features/forum/hooks/useForumPosts.tsindex 1ead51947..edaf6008d 100644--- a/fluxer_app/src/features/forum/hooks/useForumPosts.ts+++ b/fluxer_app/src/features/forum/hooks/useForumPosts.ts@@ -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),diff --git a/fluxer_app/src/features/forum/utils/ForumPostList.ts b/fluxer_app/src/features/forum/utils/ForumPostList.tsindex 2ed939abc..4a816f4bf 100644--- a/fluxer_app/src/features/forum/utils/ForumPostList.ts+++ b/fluxer_app/src/features/forum/utils/ForumPostList.ts@@ -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};}