Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2839035
D13291.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
D13291.diff
View Options
diff --git a/lib/shared/dm-ops/leave-thread-spec.js b/lib/shared/dm-ops/leave-thread-spec.js
--- a/lib/shared/dm-ops/leave-thread-spec.js
+++ b/lib/shared/dm-ops/leave-thread-spec.js
@@ -9,8 +9,12 @@
} from './dm-op-spec.js';
import type { DMLeaveThreadOperation } from '../../types/dm-ops.js';
import { messageTypes } from '../../types/message-types-enum.js';
+import type { ThickRawThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js';
import { threadTypes } from '../../types/thread-types-enum.js';
+import type { RawThreadInfos } from '../../types/thread-types.js';
import { updateTypes } from '../../types/update-types-enum.js';
+import type { ClientUpdateInfo } from '../../types/update-types.js';
+import { values } from '../../utils/objects.js';
import { rawMessageInfoFromMessageData } from '../message-utils.js';
import { userIsMember } from '../thread-utils.js';
@@ -24,6 +28,29 @@
};
}
+function createLeaveThreadSubthreadsUpdates(
+ dmOperation: DMLeaveThreadOperation,
+ threadInfo: ThickRawThreadInfo,
+ viewerID: string,
+ threadInfos: RawThreadInfos,
+): $ReadOnlyArray<ClientUpdateInfo> {
+ const updates = [];
+ for (const thread of values(threadInfos)) {
+ if (thread.parentThreadID !== threadInfo.id) {
+ continue;
+ }
+
+ updates.push({
+ type: updateTypes.DELETE_THREAD,
+ id: uuid.v4(),
+ time: dmOperation.time,
+ threadID: thread.id,
+ });
+ }
+
+ return updates;
+}
+
const leaveThreadSpec: DMOperationSpec<DMLeaveThreadOperation> = Object.freeze({
notificationsCreationData: async (dmOperation: DMLeaveThreadOperation) => {
const messageData = createMessageDataFromDMOperation(dmOperation);
@@ -60,6 +87,12 @@
time,
threadID,
},
+ ...createLeaveThreadSubthreadsUpdates(
+ dmOperation,
+ threadInfo,
+ viewerID,
+ utilities.threadInfos,
+ ),
],
};
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Sep 30, 12:31 AM (6 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2203176
Default Alt Text
D13291.diff (1 KB)
Attached To
Mode
D13291: [lib] Leave thread sidebars while leaving the parent thread
Attached
Detach File
Event Timeline
Log In to Comment