Page MenuHomePhabricator

D13557.id44751.diff
No OneTemporary

D13557.id44751.diff

diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js
--- a/lib/selectors/thread-selectors.js
+++ b/lib/selectors/thread-selectors.js
@@ -33,7 +33,6 @@
roleIsAdminRole,
threadIsPending,
getPendingThreadID,
- pendingThreadType,
} from '../shared/thread-utils.js';
import type { ClientAvatar, ClientEmojiAvatar } from '../types/avatar-types';
import type { EntryInfo } from '../types/entry-types.js';
@@ -49,7 +48,10 @@
threadTypeIsThick,
threadTypeIsCommunityRoot,
type ThreadType,
+ threadTypes,
threadTypeIsSidebar,
+ threadTypeIsPrivate,
+ threadTypeIsPersonal,
} from '../types/thread-types-enum.js';
import type {
MixedRawThreadInfos,
@@ -459,17 +461,38 @@
) {
continue;
}
+
const actualMemberIDs = rawThreadInfo.members
.filter(member => member.role)
.map(member => member.id);
+
// In this function we're generating possible pending thread IDs that
// could become `rawThreadInfos`. It is possible that a thick pending
// thread becomes a thin thread, so we're including it twice in a map -
// for each possible pending thread ID.
- const possiblePendingThreadTypes = [
- pendingThreadType(actualMemberIDs.length - 1, 'thin'),
- pendingThreadType(actualMemberIDs.length - 1, 'thick'),
- ];
+ let possiblePendingThreadTypes;
+ if (threadTypeIsPersonal(rawThreadInfo.type)) {
+ possiblePendingThreadTypes = [
+ threadTypes.PERSONAL,
+ threadTypes.GENESIS_PERSONAL,
+ ];
+ } else if (threadTypeIsPrivate(rawThreadInfo.type)) {
+ possiblePendingThreadTypes = [
+ threadTypes.PRIVATE,
+ threadTypes.GENESIS_PRIVATE,
+ ];
+ } else if (threadTypeIsSidebar(rawThreadInfo.type)) {
+ possiblePendingThreadTypes = [
+ threadTypes.THICK_SIDEBAR,
+ threadTypes.SIDEBAR,
+ ];
+ } else {
+ possiblePendingThreadTypes = [
+ threadTypes.LOCAL,
+ threadTypes.COMMUNITY_SECRET_SUBTHREAD,
+ ];
+ }
+
for (const type of possiblePendingThreadTypes) {
const pendingThreadID = getPendingThreadID(
type,

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 8:09 AM (19 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2543795
Default Alt Text
D13557.id44751.diff (2 KB)

Event Timeline