Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3354333
D9641.id32574.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
D9641.id32574.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D9641: [lib] introduce selected keyservers selector
Attached
Detach File
Event Timeline
Log In to Comment