Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3264668
D12315.id40974.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
D12315.id40974.diff
View Options
diff --git a/lib/types/minimally-encoded-thread-permissions-types.js b/lib/types/minimally-encoded-thread-permissions-types.js
--- a/lib/types/minimally-encoded-thread-permissions-types.js
+++ b/lib/types/minimally-encoded-thread-permissions-types.js
@@ -105,6 +105,20 @@
+permissions: string,
}>;
+export type MemberInfoSansPermissions = {
+ +id: string,
+ +role: ?string,
+ +isSender: boolean,
+ +minimallyEncoded: true,
+};
+
+function stripPermissionsFromMemberInfo(
+ memberInfo: MemberInfoWithPermissions,
+): MemberInfoSansPermissions {
+ const { permissions, ...rest } = memberInfo;
+ return rest;
+}
+
const minimallyEncodeMemberInfo = (
memberInfo: LegacyMemberInfo,
): MemberInfoWithPermissions => {
@@ -219,6 +233,7 @@
decodeMinimallyEncodedRoleInfo,
minimallyEncodeThreadCurrentUserInfo,
decodeMinimallyEncodedThreadCurrentUserInfo,
+ stripPermissionsFromMemberInfo,
minimallyEncodeMemberInfo,
decodeMinimallyEncodedMemberInfo,
minimallyEncodeRawThreadInfo,
diff --git a/lib/types/minimally-encoded-thread-permissions-types.test.js b/lib/types/minimally-encoded-thread-permissions-types.test.js
new file mode 100644
--- /dev/null
+++ b/lib/types/minimally-encoded-thread-permissions-types.test.js
@@ -0,0 +1,29 @@
+// @flow
+
+import type {
+ MemberInfoSansPermissions,
+ MemberInfoWithPermissions,
+} from './minimally-encoded-thread-permissions-types.js';
+import { stripPermissionsFromMemberInfo } from './minimally-encoded-thread-permissions-types.js';
+
+describe('stripPermissionsFromMemberInfo', () => {
+ test('should produce valid MemberInfoSansPermissions', () => {
+ const memberInfoWithPermissions: MemberInfoWithPermissions = {
+ id: '1',
+ role: '2',
+ isSender: true,
+ minimallyEncoded: true,
+ permissions: '3',
+ };
+
+ const memberInfoSansPermissions: MemberInfoSansPermissions =
+ stripPermissionsFromMemberInfo(memberInfoWithPermissions);
+
+ expect(memberInfoSansPermissions).toEqual({
+ id: '1',
+ role: '2',
+ isSender: true,
+ minimallyEncoded: true,
+ });
+ });
+});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 12:43 AM (22 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2509146
Default Alt Text
D12315.id40974.diff (2 KB)
Attached To
Mode
D12315: [lib] Introduce `MemberInfoSansPermissions`
Attached
Detach File
Event Timeline
Log In to Comment