Page MenuHomePhabricator

D9235.id31288.diff
No OneTemporary

D9235.id31288.diff

diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -88,6 +88,7 @@
UserInfos,
AccountUserInfo,
LoggedInUserInfo,
+ UserInfo,
} from '../types/user-types.js';
import {
useDispatchActionPromise,
@@ -398,16 +399,42 @@
return threadInfoFromRawThreadInfo(rawThreadInfo, viewerID, userInfos);
}
-function createPendingThreadItem(
+type PendingPersonalThread = {
+ +threadInfo: ThreadInfo,
+ +pendingPersonalThreadUserInfo: UserInfo,
+};
+
+function createPendingPersonalThread(
loggedInUserInfo: LoggedInUserInfo,
- user: UserIDAndUsername,
-): ChatThreadItem {
+ userID: string,
+ username: string,
+): PendingPersonalThread {
+ const pendingPersonalThreadUserInfo = {
+ id: userID,
+ username: username,
+ };
+
+ const pendingThreadMembers = [
+ loggedInUserInfo,
+ pendingPersonalThreadUserInfo,
+ ];
+
const threadInfo = createPendingThread({
viewerID: loggedInUserInfo.id,
threadType: threadTypes.PERSONAL,
- members: [loggedInUserInfo, user],
+ members: pendingThreadMembers,
});
+ return { threadInfo, pendingPersonalThreadUserInfo };
+}
+
+function createPendingThreadItem(
+ loggedInUserInfo: LoggedInUserInfo,
+ user: UserIDAndUsername,
+): ChatThreadItem {
+ const { threadInfo, pendingPersonalThreadUserInfo } =
+ createPendingPersonalThread(loggedInUserInfo, user.id, user.username);
+
return {
type: 'chatThreadItem',
threadInfo,
@@ -416,10 +443,7 @@
lastUpdatedTime: threadInfo.creationTime,
lastUpdatedTimeIncludingSidebars: threadInfo.creationTime,
sidebars: [],
- pendingPersonalThreadUserInfo: {
- id: user.id,
- username: user.username,
- },
+ pendingPersonalThreadUserInfo,
};
}
@@ -1791,6 +1815,7 @@
getPendingThreadID,
parsePendingThreadID,
createPendingThread,
+ createPendingPersonalThread,
createUnresolvedPendingSidebar,
extractNewMentionedParentMembers,
createPendingSidebar,

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 21, 10:55 PM (18 m, 58 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2558835
Default Alt Text
D9235.id31288.diff (1 KB)

Event Timeline