Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32176968
D4455.1765068916.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D4455.1765068916.diff
View Options
diff --git a/keyserver/src/responders/website-responders.js b/keyserver/src/responders/website-responders.js
--- a/keyserver/src/responders/website-responders.js
+++ b/keyserver/src/responders/website-responders.js
@@ -15,13 +15,18 @@
import { freshMessageStore } from 'lib/reducers/message-reducer';
import { mostRecentlyReadThread } from 'lib/selectors/thread-selectors';
import { mostRecentMessageTimestamp } from 'lib/shared/message-utils';
-import { threadHasPermission, threadIsPending } from 'lib/shared/thread-utils';
+import {
+ threadHasPermission,
+ threadIsPending,
+ parseLocallyUniqueThreadID,
+ createPendingThread,
+} from 'lib/shared/thread-utils';
import { defaultWebEnabledApps } from 'lib/types/enabled-apps';
import { defaultCalendarFilters } from 'lib/types/filter-types';
import { defaultNumberPerThread } from 'lib/types/message-types';
import { defaultEnabledReports } from 'lib/types/report-types';
import { defaultConnectionInfo } from 'lib/types/socket-types';
-import { threadPermissions } from 'lib/types/thread-types';
+import { threadPermissions, threadTypes } from 'lib/types/thread-types';
import type { CurrentUserInfo } from 'lib/types/user-types';
import { currentDateInTimeZone } from 'lib/utils/date-utils';
import { ServerError } from 'lib/utils/errors';
@@ -188,9 +193,16 @@
})();
const navInfoPromise = (async () => {
- const [{ threadInfos }, messageStore] = await Promise.all([
+ const [
+ { threadInfos },
+ messageStore,
+ currentUserInfo,
+ userStore,
+ ] = await Promise.all([
threadInfoPromise,
messageStorePromise,
+ currentUserInfoPromise,
+ userStorePromise,
]);
const finalNavInfo = initialNavInfo;
@@ -216,6 +228,33 @@
}
}
+ if (
+ finalNavInfo.activeChatThreadID &&
+ threadIsPending(finalNavInfo.activeChatThreadID) &&
+ finalNavInfo.pendingThread?.id !== finalNavInfo.activeChatThreadID
+ ) {
+ const pendingThreadData = parseLocallyUniqueThreadID(
+ finalNavInfo.activeChatThreadID,
+ );
+ if (
+ pendingThreadData &&
+ pendingThreadData.threadType !== threadTypes.SIDEBAR &&
+ currentUserInfo.id
+ ) {
+ const { userInfos } = userStore;
+ const members = pendingThreadData.memberIDs
+ .map(id => userInfos[id])
+ .filter(Boolean);
+ const newPendingThread = createPendingThread({
+ viewerID: currentUserInfo.id,
+ threadType: pendingThreadData.threadType,
+ members,
+ });
+ finalNavInfo.activeChatThreadID = newPendingThread.id;
+ finalNavInfo.pendingThread = newPendingThread;
+ }
+ }
+
return finalNavInfo;
})();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 12:55 AM (2 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5841541
Default Alt Text
D4455.1765068916.diff (2 KB)
Attached To
Mode
D4455: [web] Introduce pending thread creation in `websiteResponder` if it is missing
Attached
Detach File
Event Timeline
Log In to Comment