Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3332262
D13909.id45794.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
15 KB
Referenced Files
None
Subscribers
None
D13909.id45794.diff
View Options
diff --git a/lib/tunnelbroker/peer-to-peer-context.js b/lib/tunnelbroker/peer-to-peer-context.js
--- a/lib/tunnelbroker/peer-to-peer-context.js
+++ b/lib/tunnelbroker/peer-to-peer-context.js
@@ -160,7 +160,7 @@
}
}
} else {
- const allMessages = await sqliteAPI.getAllOutboundP2PMessages();
+ const allMessages = await sqliteAPI.getUnsentOutboundP2PMessages();
messages = allMessages.filter(message => message.supportsAutoRetry);
}
diff --git a/lib/types/sqlite-types.js b/lib/types/sqlite-types.js
--- a/lib/types/sqlite-types.js
+++ b/lib/types/sqlite-types.js
@@ -45,7 +45,7 @@
+getInboundP2PMessagesByID: (
ids: $ReadOnlyArray<string>,
) => Promise<Array<InboundP2PMessage>>,
- +getAllOutboundP2PMessages: () => Promise<Array<OutboundP2PMessage>>,
+ +getUnsentOutboundP2PMessages: () => Promise<Array<OutboundP2PMessage>>,
+getRelatedMessages: (
messageID: string,
) => Promise<Array<ClientDBMessageInfo>>,
diff --git a/lib/utils/__mocks__/config.js b/lib/utils/__mocks__/config.js
--- a/lib/utils/__mocks__/config.js
+++ b/lib/utils/__mocks__/config.js
@@ -38,7 +38,7 @@
getInboundP2PMessagesByID: jest.fn(),
removeInboundP2PMessages: jest.fn(),
processDBStoreOperations: jest.fn(),
- getAllOutboundP2PMessages: jest.fn(),
+ getUnsentOutboundP2PMessages: jest.fn(),
markOutboundP2PMessageAsSent: jest.fn(),
removeOutboundP2PMessage: jest.fn(),
resetOutboundP2PMessagesForDevice: jest.fn(),
diff --git a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
--- a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
+++ b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h
@@ -155,7 +155,8 @@
const std::vector<OutboundP2PMessage> &messages) const = 0;
virtual std::vector<OutboundP2PMessage>
getOutboundP2PMessagesByID(const std::vector<std::string> &ids) const = 0;
- virtual std::vector<OutboundP2PMessage> getAllOutboundP2PMessages() const = 0;
+ virtual std::vector<OutboundP2PMessage>
+ getUnsentOutboundP2PMessages() const = 0;
virtual void removeOutboundP2PMessage(
std::string confirmedMessageID,
std::string deviceID) const = 0;
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h
@@ -174,7 +174,7 @@
const std::vector<OutboundP2PMessage> &messages) const override;
std::vector<OutboundP2PMessage> getOutboundP2PMessagesByID(
const std::vector<std::string> &ids) const override;
- std::vector<OutboundP2PMessage> getAllOutboundP2PMessages() const override;
+ std::vector<OutboundP2PMessage> getUnsentOutboundP2PMessages() const override;
void removeOutboundP2PMessage(
std::string confirmedMessageID,
std::string deviceID) const override;
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
@@ -2547,7 +2547,7 @@
}
std::vector<OutboundP2PMessage>
-SQLiteQueryExecutor::getAllOutboundP2PMessages() const {
+SQLiteQueryExecutor::getUnsentOutboundP2PMessages() const {
std::string query =
"SELECT * FROM outbound_p2p_messages "
"WHERE status != 'sent' "
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.h
@@ -246,10 +246,10 @@
virtual jsi::Value
removeInboundP2PMessages(jsi::Runtime &rt, jsi::Array ids) override;
virtual jsi::Value
- getOutboundP2PMessagesByID(jsi::Runtime &rt, jsi::Array ids) override;
- virtual jsi::Value getAllOutboundP2PMessages(jsi::Runtime &rt) override;
- virtual jsi::Value
getInboundP2PMessagesByID(jsi::Runtime &rt, jsi::Array ids) override;
+ virtual jsi::Value
+ getOutboundP2PMessagesByID(jsi::Runtime &rt, jsi::Array ids) override;
+ virtual jsi::Value getUnsentOutboundP2PMessages(jsi::Runtime &rt) override;
virtual jsi::Value markOutboundP2PMessageAsSent(
jsi::Runtime &rt,
jsi::String messageID,
diff --git a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
--- a/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
+++ b/native/cpp/CommonCpp/NativeModules/CommCoreModule.cpp
@@ -2888,7 +2888,7 @@
});
}
-jsi::Value CommCoreModule::getAllOutboundP2PMessages(jsi::Runtime &rt) {
+jsi::Value CommCoreModule::getUnsentOutboundP2PMessages(jsi::Runtime &rt) {
return createPromiseAsJSIValue(
rt, [=](jsi::Runtime &innerRt, std::shared_ptr<Promise> promise) {
taskType job = [=, &innerRt]() {
@@ -2896,8 +2896,8 @@
std::vector<OutboundP2PMessage> messages;
try {
- messages =
- DatabaseManager::getQueryExecutor().getAllOutboundP2PMessages();
+ messages = DatabaseManager::getQueryExecutor()
+ .getUnsentOutboundP2PMessages();
} catch (std::system_error &e) {
error = e.what();
diff --git a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
--- a/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
+++ b/native/cpp/CommonCpp/_generated/commJSI-generated.cpp
@@ -217,8 +217,8 @@
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getOutboundP2PMessagesByID(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getOutboundP2PMessagesByID(rt, args[0].asObject(rt).asArray(rt));
}
-static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getAllOutboundP2PMessages(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
- return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getAllOutboundP2PMessages(rt);
+static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUnsentOutboundP2PMessages(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getUnsentOutboundP2PMessages(rt);
}
static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_markOutboundP2PMessageAsSent(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->markOutboundP2PMessageAsSent(rt, args[0].asString(rt), args[1].asString(rt));
@@ -313,7 +313,7 @@
methodMap_["removeInboundP2PMessages"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_removeInboundP2PMessages};
methodMap_["getInboundP2PMessagesByID"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getInboundP2PMessagesByID};
methodMap_["getOutboundP2PMessagesByID"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getOutboundP2PMessagesByID};
- methodMap_["getAllOutboundP2PMessages"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getAllOutboundP2PMessages};
+ methodMap_["getUnsentOutboundP2PMessages"] = MethodMetadata {0, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getUnsentOutboundP2PMessages};
methodMap_["markOutboundP2PMessageAsSent"] = MethodMetadata {2, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_markOutboundP2PMessageAsSent};
methodMap_["removeOutboundP2PMessage"] = MethodMetadata {2, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_removeOutboundP2PMessage};
methodMap_["resetOutboundP2PMessagesForDevice"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_resetOutboundP2PMessagesForDevice};
diff --git a/native/cpp/CommonCpp/_generated/commJSI.h b/native/cpp/CommonCpp/_generated/commJSI.h
--- a/native/cpp/CommonCpp/_generated/commJSI.h
+++ b/native/cpp/CommonCpp/_generated/commJSI.h
@@ -86,7 +86,7 @@
virtual jsi::Value removeInboundP2PMessages(jsi::Runtime &rt, jsi::Array ids) = 0;
virtual jsi::Value getInboundP2PMessagesByID(jsi::Runtime &rt, jsi::Array ids) = 0;
virtual jsi::Value getOutboundP2PMessagesByID(jsi::Runtime &rt, jsi::Array ids) = 0;
- virtual jsi::Value getAllOutboundP2PMessages(jsi::Runtime &rt) = 0;
+ virtual jsi::Value getUnsentOutboundP2PMessages(jsi::Runtime &rt) = 0;
virtual jsi::Value markOutboundP2PMessageAsSent(jsi::Runtime &rt, jsi::String messageID, jsi::String deviceID) = 0;
virtual jsi::Value removeOutboundP2PMessage(jsi::Runtime &rt, jsi::String messageID, jsi::String deviceID) = 0;
virtual jsi::Value resetOutboundP2PMessagesForDevice(jsi::Runtime &rt, jsi::String deviceID) = 0;
@@ -644,13 +644,13 @@
return bridging::callFromJs<jsi::Value>(
rt, &T::getOutboundP2PMessagesByID, jsInvoker_, instance_, std::move(ids));
}
- jsi::Value getAllOutboundP2PMessages(jsi::Runtime &rt) override {
+ jsi::Value getUnsentOutboundP2PMessages(jsi::Runtime &rt) override {
static_assert(
- bridging::getParameterCount(&T::getAllOutboundP2PMessages) == 1,
- "Expected getAllOutboundP2PMessages(...) to have 1 parameters");
+ bridging::getParameterCount(&T::getUnsentOutboundP2PMessages) == 1,
+ "Expected getUnsentOutboundP2PMessages(...) to have 1 parameters");
return bridging::callFromJs<jsi::Value>(
- rt, &T::getAllOutboundP2PMessages, jsInvoker_, instance_);
+ rt, &T::getUnsentOutboundP2PMessages, jsInvoker_, instance_);
}
jsi::Value markOutboundP2PMessageAsSent(jsi::Runtime &rt, jsi::String messageID, jsi::String deviceID) override {
static_assert(
diff --git a/native/database/sqlite-api.js b/native/database/sqlite-api.js
--- a/native/database/sqlite-api.js
+++ b/native/database/sqlite-api.js
@@ -13,7 +13,7 @@
// read operations
getAllInboundP2PMessages: commCoreModule.getAllInboundP2PMessages,
getInboundP2PMessagesByID: commCoreModule.getInboundP2PMessagesByID,
- getAllOutboundP2PMessages: commCoreModule.getAllOutboundP2PMessages,
+ getUnsentOutboundP2PMessages: commCoreModule.getUnsentOutboundP2PMessages,
getRelatedMessages: commCoreModule.getRelatedMessages,
getOutboundP2PMessagesByID: commCoreModule.getOutboundP2PMessagesByID,
searchMessages: commCoreModule.searchMessages,
diff --git a/native/schema/CommCoreModuleSchema.js b/native/schema/CommCoreModuleSchema.js
--- a/native/schema/CommCoreModuleSchema.js
+++ b/native/schema/CommCoreModuleSchema.js
@@ -187,7 +187,7 @@
+getOutboundP2PMessagesByID: (
ids: $ReadOnlyArray<string>,
) => Promise<Array<OutboundP2PMessage>>;
- +getAllOutboundP2PMessages: () => Promise<Array<OutboundP2PMessage>>;
+ +getUnsentOutboundP2PMessages: () => Promise<Array<OutboundP2PMessage>>;
+markOutboundP2PMessageAsSent: (
messageID: string,
deviceID: string,
diff --git a/web/cpp/SQLiteQueryExecutorBindings.cpp b/web/cpp/SQLiteQueryExecutorBindings.cpp
--- a/web/cpp/SQLiteQueryExecutorBindings.cpp
+++ b/web/cpp/SQLiteQueryExecutorBindings.cpp
@@ -302,8 +302,8 @@
"getOutboundP2PMessagesByID",
&SQLiteQueryExecutor::getOutboundP2PMessagesByID)
.function(
- "getAllOutboundP2PMessages",
- &SQLiteQueryExecutor::getAllOutboundP2PMessages)
+ "getUnsentOutboundP2PMessages",
+ &SQLiteQueryExecutor::getUnsentOutboundP2PMessages)
.function(
"setCiphertextForOutboundP2PMessage",
&SQLiteQueryExecutor::setCiphertextForOutboundP2PMessage)
diff --git a/web/database/sqlite-api.js b/web/database/sqlite-api.js
--- a/web/database/sqlite-api.js
+++ b/web/database/sqlite-api.js
@@ -40,7 +40,7 @@
return messages ? [...messages] : [];
},
- async getAllOutboundP2PMessages(): Promise<OutboundP2PMessage[]> {
+ async getUnsentOutboundP2PMessages(): Promise<OutboundP2PMessage[]> {
const sharedWorker = await getCommSharedWorker();
const data = await sharedWorker.schedule({
diff --git a/web/shared-worker/_generated/comm_query_executor.wasm b/web/shared-worker/_generated/comm_query_executor.wasm
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/web/shared-worker/queries/outbound-p2p-message-queries.test.js b/web/shared-worker/queries/outbound-p2p-message-queries.test.js
--- a/web/shared-worker/queries/outbound-p2p-message-queries.test.js
+++ b/web/shared-worker/queries/outbound-p2p-message-queries.test.js
@@ -97,11 +97,11 @@
});
it('should return all messages', () => {
- expect(queryExecutor?.getAllOutboundP2PMessages().length).toBe(4);
+ expect(queryExecutor?.getUnsentOutboundP2PMessages().length).toBe(4);
});
it('should return messages in correct order', () => {
- const messages = queryExecutor?.getAllOutboundP2PMessages();
+ const messages = queryExecutor?.getUnsentOutboundP2PMessages();
expect(messages).toStrictEqual(messagesOrdered);
});
@@ -111,8 +111,8 @@
TEST_MSG_4.deviceID,
);
- expect(queryExecutor?.getAllOutboundP2PMessages().length).toBe(3);
- expect(queryExecutor?.getAllOutboundP2PMessages()).toStrictEqual([
+ expect(queryExecutor?.getUnsentOutboundP2PMessages().length).toBe(3);
+ expect(queryExecutor?.getUnsentOutboundP2PMessages()).toStrictEqual([
TEST_MSG_3,
TEST_MSG_1,
TEST_MSG_2,
@@ -122,7 +122,7 @@
it('should remove all messages for given device', () => {
queryExecutor?.removeAllOutboundP2PMessages(device1);
queryExecutor?.removeAllOutboundP2PMessages(device2);
- expect(queryExecutor?.getAllOutboundP2PMessages().length).toBe(0);
+ expect(queryExecutor?.getUnsentOutboundP2PMessages().length).toBe(0);
});
it('should set ciphertext for given message', () => {
@@ -134,7 +134,7 @@
ciphertext,
);
- const messages = queryExecutor?.getAllOutboundP2PMessages() ?? [];
+ const messages = queryExecutor?.getUnsentOutboundP2PMessages() ?? [];
expect(messages.length).toBe(4);
expect(
messages.find(msg => msg.messageID === TEST_MSG_4.messageID)?.ciphertext,
@@ -147,7 +147,7 @@
TEST_MSG_4.deviceID,
);
- const messages = queryExecutor?.getAllOutboundP2PMessages() ?? [];
+ const messages = queryExecutor?.getUnsentOutboundP2PMessages() ?? [];
expect(messages.length).toBe(3);
expect(
messages.find(msg => msg.messageID === TEST_MSG_4.messageID),
diff --git a/web/shared-worker/types/sqlite-query-executor.js b/web/shared-worker/types/sqlite-query-executor.js
--- a/web/shared-worker/types/sqlite-query-executor.js
+++ b/web/shared-worker/types/sqlite-query-executor.js
@@ -185,7 +185,7 @@
getOutboundP2PMessagesByID(
ids: $ReadOnlyArray<string>,
): $ReadOnlyArray<OutboundP2PMessage>;
- getAllOutboundP2PMessages(): $ReadOnlyArray<OutboundP2PMessage>;
+ getUnsentOutboundP2PMessages(): $ReadOnlyArray<OutboundP2PMessage>;
setCiphertextForOutboundP2PMessage(
messageID: string,
deviceID: string,
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
@@ -251,7 +251,7 @@
) {
return {
type: workerResponseMessageTypes.GET_OUTBOUND_P2P_MESSAGES,
- outboundP2PMessages: sqliteQueryExecutor.getAllOutboundP2PMessages(),
+ outboundP2PMessages: sqliteQueryExecutor.getUnsentOutboundP2PMessages(),
};
} else if (message.type === workerRequestMessageTypes.GET_RELATED_MESSAGES) {
const webMessageEntities = sqliteQueryExecutor.getRelatedMessagesWeb(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 21, 11:21 PM (18 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2540605
Default Alt Text
D13909.id45794.diff (15 KB)
Attached To
Mode
D13909: [sqlite] Rename getAllOutboundP2PMessages() to getUnsentOutboundP2PMessages()
Attached
Detach File
Event Timeline
Log In to Comment