Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3379481
D11668.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D11668.diff
View Options
diff --git a/web/shared-worker/sqlite-data-handler.js b/web/shared-worker/sqlite-data-handler.js
--- a/web/shared-worker/sqlite-data-handler.js
+++ b/web/shared-worker/sqlite-data-handler.js
@@ -25,7 +25,7 @@
errorGettingUserID = false;
try {
const currentUserData = await sharedWorker.schedule({
- type: workerRequestMessageTypes.GET_CURRENT_USER_ID,
+ type: workerRequestMessageTypes.GET_SQLITE_STAMPED_USER_ID,
});
currentDBUserID = currentUserData?.userID;
} catch (error) {
@@ -57,7 +57,7 @@
if (currentLoggedInUserID && currentLoggedInUserID !== currentDBUserID) {
try {
await sharedWorker.schedule({
- type: workerRequestMessageTypes.SET_CURRENT_USER_ID,
+ type: workerRequestMessageTypes.STAMP_SQLITE_DB_USER_ID,
userID: currentLoggedInUserID,
});
} catch (error) {
diff --git a/web/shared-worker/utils/constants.js b/web/shared-worker/utils/constants.js
--- a/web/shared-worker/utils/constants.js
+++ b/web/shared-worker/utils/constants.js
@@ -5,7 +5,7 @@
export const SQLITE_CONTENT = 'sqliteFileContent';
export const SQLITE_ENCRYPTION_KEY = 'encryptionKey';
-export const CURRENT_USER_ID_KEY = 'current_user_id';
+export const SQLITE_STAMPED_USER_ID_KEY = 'current_user_id';
export const DATABASE_WORKER_PATH = 'worker/database';
export const WORKERS_MODULES_DIR_PATH = '/compiled/webworkers';
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
@@ -41,7 +41,7 @@
import { getDatabaseModule } from '../db-module.js';
import {
COMM_SQLITE_DATABASE_PATH,
- CURRENT_USER_ID_KEY,
+ SQLITE_STAMPED_USER_ID_KEY,
localforageConfig,
SQLITE_CONTENT,
SQLITE_ENCRYPTION_KEY,
@@ -224,10 +224,12 @@
type: workerResponseMessageTypes.CLIENT_STORE,
store: getClientStoreFromQueryExecutor(sqliteQueryExecutor),
};
- } else if (message.type === workerRequestMessageTypes.GET_CURRENT_USER_ID) {
+ } else if (
+ message.type === workerRequestMessageTypes.GET_SQLITE_STAMPED_USER_ID
+ ) {
return {
- type: workerResponseMessageTypes.GET_CURRENT_USER_ID,
- userID: sqliteQueryExecutor.getMetadata(CURRENT_USER_ID_KEY),
+ type: workerResponseMessageTypes.GET_SQLITE_STAMPED_USER_ID,
+ userID: sqliteQueryExecutor.getMetadata(SQLITE_STAMPED_USER_ID_KEY),
};
} else if (
message.type === workerRequestMessageTypes.GET_PERSIST_STORAGE_ITEM
@@ -280,8 +282,10 @@
message.storeOperations,
dbModule,
);
- } else if (message.type === workerRequestMessageTypes.SET_CURRENT_USER_ID) {
- sqliteQueryExecutor.setMetadata(CURRENT_USER_ID_KEY, message.userID);
+ } else if (
+ message.type === workerRequestMessageTypes.STAMP_SQLITE_DB_USER_ID
+ ) {
+ sqliteQueryExecutor.setMetadata(SQLITE_STAMPED_USER_ID_KEY, message.userID);
} else if (
message.type === workerRequestMessageTypes.SET_PERSIST_STORAGE_ITEM
) {
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
@@ -23,8 +23,8 @@
GENERATE_DATABASE_ENCRYPTION_KEY: 2,
PROCESS_STORE_OPERATIONS: 3,
GET_CLIENT_STORE: 4,
- SET_CURRENT_USER_ID: 5,
- GET_CURRENT_USER_ID: 6,
+ STAMP_SQLITE_DB_USER_ID: 5,
+ GET_SQLITE_STAMPED_USER_ID: 6,
GET_PERSIST_STORAGE_ITEM: 7,
SET_PERSIST_STORAGE_ITEM: 8,
REMOVE_PERSIST_STORAGE_ITEM: 9,
@@ -38,7 +38,7 @@
export const workerWriteRequests: $ReadOnlyArray<number> = [
workerRequestMessageTypes.PROCESS_STORE_OPERATIONS,
- workerRequestMessageTypes.SET_CURRENT_USER_ID,
+ workerRequestMessageTypes.STAMP_SQLITE_DB_USER_ID,
workerRequestMessageTypes.SET_PERSIST_STORAGE_ITEM,
workerRequestMessageTypes.REMOVE_PERSIST_STORAGE_ITEM,
workerRequestMessageTypes.BACKUP_RESTORE,
@@ -178,7 +178,7 @@
export const workerResponseMessageTypes = Object.freeze({
PONG: 0,
CLIENT_STORE: 1,
- GET_CURRENT_USER_ID: 2,
+ GET_SQLITE_STAMPED_USER_ID: 2,
GET_PERSIST_STORAGE_ITEM: 3,
CALL_IDENTITY_CLIENT_METHOD: 4,
CALL_OLM_API_METHOD: 5,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 4:28 PM (19 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2594425
Default Alt Text
D11668.diff (4 KB)
Attached To
Mode
D11668: [web] Rename GET_/SET_CURRENT_USER_ID in shared worker
Attached
Detach File
Event Timeline
Log In to Comment