Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3343801
D9235.id31353.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.id31353.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,37 @@
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 threadInfo = createPendingThread({
viewerID: loggedInUserInfo.id,
threadType: threadTypes.PERSONAL,
- members: [loggedInUserInfo, user],
+ members: [loggedInUserInfo, pendingPersonalThreadUserInfo],
});
+ 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 +438,7 @@
lastUpdatedTime: threadInfo.creationTime,
lastUpdatedTimeIncludingSidebars: threadInfo.creationTime,
sidebars: [],
- pendingPersonalThreadUserInfo: {
- id: user.id,
- username: user.username,
- },
+ pendingPersonalThreadUserInfo,
};
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 4:07 AM (18 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2568071
Default Alt Text
D9235.id31353.diff (1 KB)
Attached To
Mode
D9235: [lib] introduce createPendingPersonalThread function
Attached
Detach File
Event Timeline
Log In to Comment