Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3373498
D13029.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13029.diff
View Options
diff --git a/web/shared-worker/worker/shared-worker.js b/web/shared-worker/worker/shared-worker.js
--- a/web/shared-worker/worker/shared-worker.js
+++ b/web/shared-worker/worker/shared-worker.js
@@ -364,6 +364,26 @@
message.messageID,
message.deviceID,
);
+ } else if (
+ message.type === workerRequestMessageTypes.RESET_OUTBOUND_P2P_MESSAGES
+ ) {
+ let messageIDs: $ReadOnlyArray<string> = [];
+ try {
+ sqliteQueryExecutor.beginTransaction();
+ messageIDs = sqliteQueryExecutor.resetOutboundP2PMessagesForDevice(
+ message.deviceID,
+ );
+ sqliteQueryExecutor.commitTransaction();
+ } catch (e) {
+ sqliteQueryExecutor.rollbackTransaction();
+ console.log('Error while resetting outbound P2P messages: ', e);
+ throw e;
+ }
+
+ return {
+ type: workerResponseMessageTypes.RESET_OUTBOUND_P2P_MESSAGES,
+ messageIDs,
+ };
}
persistNeeded = true;
diff --git a/web/types/worker-types.js b/web/types/worker-types.js
--- a/web/types/worker-types.js
+++ b/web/types/worker-types.js
@@ -47,6 +47,7 @@
GET_RELATED_MESSAGES: 21,
GET_OUTBOUND_P2P_MESSAGES_BY_ID: 22,
SEARCH_MESSAGES: 23,
+ RESET_OUTBOUND_P2P_MESSAGES: 24,
});
export const workerWriteRequests: $ReadOnlyArray<number> = [
@@ -59,6 +60,7 @@
workerRequestMessageTypes.REMOVE_INBOUND_P2P_MESSAGES,
workerRequestMessageTypes.MARK_OUTBOUND_P2P_MESSAGE_AS_SENT,
workerRequestMessageTypes.REMOVE_OUTBOUND_P2P_MESSAGES,
+ workerRequestMessageTypes.RESET_OUTBOUND_P2P_MESSAGES,
];
export const workerOlmAPIRequests: $ReadOnlyArray<number> = [
@@ -210,6 +212,11 @@
+messageIDCursor: ?string,
};
+export type ResetOutboundP2PMessagesRequestMessage = {
+ +type: 24,
+ +deviceID: string,
+};
+
export type WorkerRequestMessage =
| PingWorkerRequestMessage
| InitWorkerRequestMessage
@@ -234,7 +241,8 @@
| RemoveOutboundP2PMessagesRequestMessage
| GetRelatedMessagesRequestMessage
| GetOutboundP2PMessagesByIDRequestMessage
- | SearchMessagesRequestMessage;
+ | SearchMessagesRequestMessage
+ | ResetOutboundP2PMessagesRequestMessage;
export type WorkerRequestProxyMessage = {
+id: number,
@@ -252,6 +260,7 @@
GET_INBOUND_P2P_MESSAGES: 6,
GET_OUTBOUND_P2P_MESSAGES: 7,
GET_MESSAGES: 8,
+ RESET_OUTBOUND_P2P_MESSAGES: 9,
});
export type PongWorkerResponseMessage = {
@@ -299,6 +308,11 @@
+messages: $ReadOnlyArray<ClientDBMessageInfo>,
};
+export type ResetOutboundP2PMessagesResponseMessage = {
+ +type: 9,
+ +messageIDs: $ReadOnlyArray<string>,
+};
+
export type WorkerResponseMessage =
| PongWorkerResponseMessage
| ClientStoreResponseMessage
@@ -308,7 +322,8 @@
| CallOLMApiMethodResponseMessage
| GetInboundP2PMessagesResponseMessage
| GetOutboundP2PMessagesResponseMessage
- | GetMessagesResponse;
+ | GetMessagesResponse
+ | ResetOutboundP2PMessagesResponseMessage;
export type WorkerResponseProxyMessage = {
+id?: number,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 10:02 AM (21 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2590107
Default Alt Text
D13029.diff (2 KB)
Attached To
Mode
D13029: [web] introduce resetting Outbound P2P Messages to shared worker
Attached
Detach File
Event Timeline
Log In to Comment