mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +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 list = ForumPosts.getList(forum.id, 'archived');
|
||||||
const {pinned, active, archived} = buildForumPostList({
|
const {pinned, active, archived} = buildForumPostList({
|
||||||
active: ChannelThreads.getActiveThreadsForParent(forum.id),
|
known: ChannelThreads.getThreadsForParent(forum.id),
|
||||||
extra: resolvePosts(forum.id, list.ids),
|
extra: resolvePosts(forum.id, list.ids),
|
||||||
sortOrder: ForumPosts.getSortOrder(forum),
|
sortOrder: ForumPosts.getSortOrder(forum),
|
||||||
tagIds: ForumPosts.getTagFilter(forum.id),
|
tagIds: ForumPosts.getTagFilter(forum.id),
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export function matchesTagFilter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface ForumPostListInput {
|
export interface ForumPostListInput {
|
||||||
active: ReadonlyArray<Channel>;
|
known: ReadonlyArray<Channel>;
|
||||||
extra: ReadonlyArray<Channel>;
|
extra: ReadonlyArray<Channel>;
|
||||||
sortOrder: ForumSortOrderType;
|
sortOrder: ForumSortOrderType;
|
||||||
tagIds: ReadonlyArray<string>;
|
tagIds: ReadonlyArray<string>;
|
||||||
@@ -44,7 +44,7 @@ export interface ForumPostListResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function buildForumPostList({
|
export function buildForumPostList({
|
||||||
active,
|
known,
|
||||||
extra,
|
extra,
|
||||||
sortOrder,
|
sortOrder,
|
||||||
tagIds,
|
tagIds,
|
||||||
@@ -54,7 +54,7 @@ export function buildForumPostList({
|
|||||||
const activePosts: Array<Channel> = [];
|
const activePosts: Array<Channel> = [];
|
||||||
const archivedPosts: Array<Channel> = [];
|
const archivedPosts: Array<Channel> = [];
|
||||||
let pinned: Channel | null = null;
|
let pinned: Channel | null = null;
|
||||||
for (const post of [...active, ...extra]) {
|
for (const post of [...known, ...extra]) {
|
||||||
if (seen.has(post.id)) continue;
|
if (seen.has(post.id)) continue;
|
||||||
seen.add(post.id);
|
seen.add(post.id);
|
||||||
if (!matchesTagFilter(post.appliedTags, tagIds, tagSetting)) continue;
|
if (!matchesTagFilter(post.appliedTags, tagIds, tagSetting)) continue;
|
||||||
@@ -67,5 +67,6 @@ export function buildForumPostList({
|
|||||||
const byKey = (a: Channel, b: Channel) =>
|
const byKey = (a: Channel, b: Channel) =>
|
||||||
SnowflakeUtils.compare(postSortKey(b, sortOrder), postSortKey(a, sortOrder));
|
SnowflakeUtils.compare(postSortKey(b, sortOrder), postSortKey(a, sortOrder));
|
||||||
activePosts.sort(byKey);
|
activePosts.sort(byKey);
|
||||||
|
archivedPosts.sort(byKey);
|
||||||
return {pinned, active: activePosts, archived: archivedPosts};
|
return {pinned, active: activePosts, archived: archivedPosts};
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user