Page MenuHomePhabricator

D9225.id31605.diff
No OneTemporary

D9225.id31605.diff

diff --git a/lib/utils/action-utils.js b/lib/utils/action-utils.js
--- a/lib/utils/action-utils.js
+++ b/lib/utils/action-utils.js
@@ -35,6 +35,10 @@
import type { ConnectionStatus } from '../types/socket-types.js';
import type { CurrentUserInfo } from '../types/user-types.js';
+function extractKeyserverIDFromID(id: string): ?string {
+ return id.split('|')[0];
+}
+
let nextPromiseIndex = 0;
export type ActionTypes<
@@ -460,4 +464,5 @@
registerActiveSocket,
useServerCall,
bindCookieAndUtilsIntoCallServerEndpoint,
+ extractKeyserverIDFromID,
};
diff --git a/lib/utils/action-utils.test.js b/lib/utils/action-utils.test.js
new file mode 100644
--- /dev/null
+++ b/lib/utils/action-utils.test.js
@@ -0,0 +1,11 @@
+// @flow
+
+import { extractKeyserverIDFromID } from './action-utils.js';
+
+describe('extractKeyserverIDFromID', () => {
+ it('should return <keyserverID> for <keyserverID>|<number>', () => {
+ const keyserverID = '404';
+ const id = keyserverID + '|1234';
+ expect(extractKeyserverIDFromID(id)).toBe(keyserverID);
+ });
+});

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 8:33 PM (22 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2577243
Default Alt Text
D9225.id31605.diff (1 KB)

Event Timeline