Page MenuHomePhabricator

D9641.id32574.diff
No OneTemporary

D9641.id32574.diff

diff --git a/lib/selectors/keyserver-selectors.js b/lib/selectors/keyserver-selectors.js
--- a/lib/selectors/keyserver-selectors.js
+++ b/lib/selectors/keyserver-selectors.js
@@ -3,9 +3,14 @@
import { createSelector } from 'reselect';
import type { PlatformDetails } from '../types/device-types';
-import type { KeyserverInfo } from '../types/keyserver-types';
+import type {
+ KeyserverInfo,
+ KeyserverInfos,
+ SelectedKeyserverInfo,
+} from '../types/keyserver-types';
import type { AppState } from '../types/redux-types.js';
import type { ConnectionInfo } from '../types/socket-types.js';
+import type { UserInfos } from '../types/user-types.js';
import { ashoatKeyserverID } from '../utils/validation-utils.js';
const cookieSelector: (state: AppState) => ?string = (state: AppState) =>
@@ -49,6 +54,31 @@
state.keyserverStore.keyserverInfos[ashoatKeyserverID]
?.lastCommunicatedPlatformDetails;
+const selectedKeyserversSelector: (
+ state: AppState,
+) => $ReadOnlyArray<SelectedKeyserverInfo> = createSelector(
+ (state: AppState) => state.keyserverStore.keyserverInfos,
+ (state: AppState) => state.userStore.userInfos,
+ (keyserverInfos: KeyserverInfos, userInfos: UserInfos) => {
+ const result = [];
+
+ for (const key in keyserverInfos) {
+ const keyserverInfo = keyserverInfos[key];
+ const keyserverAdminUsername = userInfos[key]?.username;
+
+ if (!keyserverAdminUsername) {
+ continue;
+ }
+
+ result.push({
+ keyserverAdminUsername,
+ keyserverInfo,
+ });
+ }
+ return result;
+ },
+);
+
export {
cookieSelector,
cookiesSelector,
@@ -58,4 +88,5 @@
urlPrefixSelector,
connectionSelector,
lastCommunicatedPlatformDetailsSelector,
+ selectedKeyserversSelector,
};
diff --git a/lib/types/keyserver-types.js b/lib/types/keyserver-types.js
--- a/lib/types/keyserver-types.js
+++ b/lib/types/keyserver-types.js
@@ -22,6 +22,11 @@
+keyserverInfos: KeyserverInfos,
};
+export type SelectedKeyserverInfo = {
+ +keyserverAdminUsername: string,
+ +keyserverInfo: KeyserverInfo,
+};
+
export const keyserverInfoValidator: TInterface<KeyserverInfo> =
tShape<KeyserverInfo>({
cookie: t.maybe(t.String),

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 12:48 PM (20 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2575090
Default Alt Text
D9641.id32574.diff (2 KB)

Event Timeline