Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3181743
D11333.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11333.diff
View Options
diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js
--- a/keyserver/src/push/send.js
+++ b/keyserver/src/push/send.js
@@ -23,7 +23,7 @@
import { notifTextsForMessageInfo } from 'lib/shared/notif-utils.js';
import {
rawThreadInfoFromServerThreadInfo,
- threadInfoFromRawThreadInfo,
+ serverThreadInfoFromRawThreadInfo,
} from 'lib/shared/thread-utils.js';
import { hasMinCodeVersion } from 'lib/shared/version-utils.js';
import type { Platform, PlatformDetails } from 'lib/types/device-types.js';
@@ -144,7 +144,11 @@
'rawThreadInfo from rawThreadInfoFromServerThreadInfo must be ' +
'minimallyEncoded when minimallyEncodePermissions option is set',
);
- return threadInfoFromRawThreadInfo(rawThreadInfo, userID, userInfos);
+ return serverThreadInfoFromRawThreadInfo(
+ rawThreadInfo,
+ userID,
+ userInfos,
+ );
}),
_pickBy(threadInfo => threadInfo),
)(serverThreadInfos);
diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js
--- a/lib/selectors/thread-selectors.js
+++ b/lib/selectors/thread-selectors.js
@@ -30,7 +30,7 @@
threadInHomeChatList,
threadInBackgroundChatList,
threadInFilterList,
- threadInfoFromRawThreadInfo,
+ serverThreadInfoFromRawThreadInfo,
threadHasPermission,
threadInChatList,
threadHasAdminRole,
@@ -70,7 +70,7 @@
(state: BaseAppState<>) => state.threadStore.threadInfos,
(state: BaseAppState<>) => state.currentUserInfo && state.currentUserInfo.id,
(state: BaseAppState<>) => state.userStore.userInfos,
- threadInfoFromRawThreadInfo,
+ serverThreadInfoFromRawThreadInfo,
);
const communityThreadSelector: (
diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -421,7 +421,7 @@
userInfos[id] = { id, username };
}
- return threadInfoFromRawThreadInfo(rawThreadInfo, viewerID, userInfos);
+ return serverThreadInfoFromRawThreadInfo(rawThreadInfo, viewerID, userInfos);
}
type PendingPersonalThread = {
@@ -942,7 +942,7 @@
};
}
-function threadInfoFromRawThreadInfo(
+function serverThreadInfoFromRawThreadInfo(
rawThreadInfo: RawThreadInfo,
viewerID: ?string,
userInfos: UserInfos,
@@ -961,6 +961,26 @@
);
}
+function clientThreadInfoFromRawThreadInfo(
+ rawThreadInfo: RawThreadInfo,
+ communityThread: ?RawThreadInfo,
+ viewerID: ?string,
+ userInfos: UserInfos,
+): ThreadInfo {
+ const currentUser = getMinimallyEncodedCurrentUser(
+ rawThreadInfo,
+ communityThread,
+ viewerID,
+ userInfos,
+ );
+ return baseThreadInfoFromRawThreadInfo(
+ rawThreadInfo,
+ viewerID,
+ userInfos,
+ currentUser,
+ );
+}
+
function baseThreadInfoFromRawThreadInfo(
rawThreadInfo: RawThreadInfo,
viewerID: ?string,
@@ -1928,7 +1948,8 @@
threadFrozenDueToViewerBlock,
rawThreadInfoFromServerThreadInfo,
threadUIName,
- threadInfoFromRawThreadInfo,
+ serverThreadInfoFromRawThreadInfo,
+ clientThreadInfoFromRawThreadInfo,
threadTypeDescriptions,
memberHasAdminPowers,
roleIsDefaultRole,
diff --git a/lib/shared/thread-utils.test.js b/lib/shared/thread-utils.test.js
--- a/lib/shared/thread-utils.test.js
+++ b/lib/shared/thread-utils.test.js
@@ -2,7 +2,7 @@
import {
parsePendingThreadID,
- threadInfoFromRawThreadInfo,
+ serverThreadInfoFromRawThreadInfo,
} from './thread-utils.js';
import { threadInfoValidator } from '../permissions/minimally-encoded-thread-permissions-validators.js';
import { specialRoles } from '../permissions/special-roles.js';
@@ -191,7 +191,7 @@
describe('threadInfoFromRawThreadInfo', () => {
it('should return correctly formed ThreadInfo from RawThreadInfo', () => {
- const threadInfo = threadInfoFromRawThreadInfo(
+ const threadInfo = serverThreadInfoFromRawThreadInfo(
rawThreadInfo,
null,
userInfos,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 6:46 AM (17 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2449850
Default Alt Text
D11333.diff (3 KB)
Attached To
Mode
D11333: [lib] Split implementations of `[client/server]ThreadInfoFromRawThreadInfo`
Attached
Detach File
Event Timeline
Log In to Comment