Page MenuHomePhabricator

D9225.diff
No OneTemporary

D9225.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<
@@ -462,4 +466,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
Sat, Nov 9, 6:37 AM (22 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2449729
Default Alt Text
D9225.diff (1 KB)

Event Timeline