Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3175570
D9948.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
D9948.diff
View Options
diff --git a/lib/shared/web-database.js b/lib/shared/web-database.js
new file mode 100644
--- /dev/null
+++ b/lib/shared/web-database.js
@@ -0,0 +1,13 @@
+// @flow
+
+import { isStaff } from './staff-utils.js';
+import { isDev } from '../utils/dev-utils.js';
+
+function canUseDatabaseOnWeb(userID: ?string): boolean {
+ if (!userID) {
+ return false;
+ }
+ return isDev || isStaff(userID);
+}
+
+export { canUseDatabaseOnWeb };
diff --git a/web/redux/persist.js b/web/redux/persist.js
--- a/web/redux/persist.js
+++ b/web/redux/persist.js
@@ -275,8 +275,7 @@
(state: KeyserverStore): PersistedKeyserverStore => {
const keyserverInfos = {};
for (const key in state.keyserverInfos) {
- const { connection, updatesCurrentAsOf, sessionID, ...rest } =
- state.keyserverInfos[key];
+ const { connection, sessionID, ...rest } = state.keyserverInfos[key];
keyserverInfos[key] = rest;
}
return {
@@ -290,7 +289,6 @@
keyserverInfos[key] = {
...state.keyserverInfos[key],
connection: { ...defaultConnectionInfo },
- updatesCurrentAsOf: 0,
sessionID: null,
};
}
diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js
--- a/web/redux/redux-setup.js
+++ b/web/redux/redux-setup.js
@@ -12,6 +12,7 @@
import { mostRecentlyReadThreadSelector } from 'lib/selectors/thread-selectors.js';
import { isLoggedIn } from 'lib/selectors/user-selectors.js';
import { invalidSessionDowngrade } from 'lib/shared/session-utils.js';
+import { canUseDatabaseOnWeb } from 'lib/shared/web-database.js';
import type { Shape } from 'lib/types/core.js';
import type { CryptoStore } from 'lib/types/crypto-types.js';
import type { DraftStore } from 'lib/types/draft-types.js';
@@ -115,9 +116,13 @@
const { userInfos, keyserverInfos, ...rest } = action.payload;
const newKeyserverInfos = { ...state.keyserverStore.keyserverInfos };
for (const keyserverID in keyserverInfos) {
+ const newUpdatesCurrentAsOf = canUseDatabaseOnWeb(rest.currentUserInfo.id)
+ ? newKeyserverInfos[keyserverID].updatesCurrentAsOf
+ : keyserverInfos[keyserverID].updatesCurrentAsOf;
newKeyserverInfos[keyserverID] = {
...newKeyserverInfos[keyserverID],
...keyserverInfos[keyserverID],
+ updatesCurrentAsOf: newUpdatesCurrentAsOf,
};
}
return validateState(oldState, {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 8:12 PM (21 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2445491
Default Alt Text
D9948.diff (2 KB)
Attached To
Mode
D9948: [web] start persisting `updatesCurrentAsOf`
Attached
Detach File
Event Timeline
Log In to Comment