Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3332131
D9235.id31288.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9235.id31288.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D9235: [lib] introduce createPendingPersonalThread function
Attached
Detach File
Event Timeline
Log In to Comment