Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3354846
D9225.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9225.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 1:25 PM (18 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2575973
Default Alt Text
D9225.diff (1 KB)
Attached To
Mode
D9225: [lib] Create function for extracing keyserver id from object id
Attached
Detach File
Event Timeline
Log In to Comment