Page MenuHomePhabricator

D10291.diff
No OneTemporary

D10291.diff

diff --git a/lib/selectors/user-selectors.js b/lib/selectors/user-selectors.js
--- a/lib/selectors/user-selectors.js
+++ b/lib/selectors/user-selectors.js
@@ -58,45 +58,13 @@
return relativeUserInfos;
}
-function getMinimallyEncodedRelativeMemberInfos(
- threadInfo: ?MinimallyEncodedRawThreadInfo,
- currentUserID: ?string,
- userInfos: UserInfos,
-): $ReadOnlyArray<MinimallyEncodedRelativeMemberInfo> {
- const relativeMemberInfos = [];
- if (!threadInfo) {
- return relativeMemberInfos;
- }
- const memberInfos = threadInfo.members;
- for (const memberInfo of memberInfos) {
- if (!memberInfo.role) {
- continue;
- }
- const username = userInfos[memberInfo.id]
- ? userInfos[memberInfo.id].username
- : null;
- if (memberInfo.id === currentUserID) {
- relativeMemberInfos.unshift({
- ...memberInfo,
- username,
- isViewer: true,
- });
- } else {
- relativeMemberInfos.push({
- ...memberInfo,
- username,
- isViewer: false,
- });
- }
- }
- return relativeMemberInfos;
-}
-
-function getLegacyRelativeMemberInfos(
- threadInfo: ?LegacyRawThreadInfo,
+function getRelativeMemberInfos(
+ threadInfo: ?MinimallyEncodedRawThreadInfo | LegacyRawThreadInfo,
currentUserID: ?string,
userInfos: UserInfos,
-): $ReadOnlyArray<LegacyRelativeMemberInfo> {
+): $ReadOnlyArray<
+ MinimallyEncodedRelativeMemberInfo | LegacyRelativeMemberInfo,
+> {
const relativeMemberInfos = [];
if (!threadInfo) {
return relativeMemberInfos;
@@ -126,24 +94,6 @@
return relativeMemberInfos;
}
-function getRelativeMemberInfos(
- threadInfo: ?MinimallyEncodedRawThreadInfo | LegacyRawThreadInfo,
- currentUserID: ?string,
- userInfos: UserInfos,
-): $ReadOnlyArray<
- MinimallyEncodedRelativeMemberInfo | LegacyRelativeMemberInfo,
-> {
- if (threadInfo?.minimallyEncoded) {
- return getMinimallyEncodedRelativeMemberInfos(
- threadInfo,
- currentUserID,
- userInfos,
- );
- } else {
- return getLegacyRelativeMemberInfos(threadInfo, currentUserID, userInfos);
- }
-}
-
const emptyArray: $ReadOnlyArray<RelativeMemberInfo> = [];
// Includes current user at the start
@@ -298,8 +248,6 @@
export {
userIDsToRelativeUserInfos,
getRelativeMemberInfos,
- getMinimallyEncodedRelativeMemberInfos,
- getLegacyRelativeMemberInfos,
relativeMemberInfoSelectorForMembersOfThread,
userInfoSelectorForPotentialMembers,
userSearchIndexForPotentialMembers,
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
@@ -48,8 +48,7 @@
threadInfosSelectorForThreadType,
} from '../selectors/thread-selectors.js';
import {
- getLegacyRelativeMemberInfos,
- getMinimallyEncodedRelativeMemberInfos,
+ getRelativeMemberInfos,
usersWithPersonalThreadSelector,
} from '../selectors/user-selectors.js';
import type { CalendarQuery } from '../types/entry-types.js';
@@ -915,11 +914,7 @@
parentThreadID: rawThreadInfo.parentThreadID,
containingThreadID: rawThreadInfo.containingThreadID,
community: rawThreadInfo.community,
- members: getMinimallyEncodedRelativeMemberInfos(
- rawThreadInfo,
- viewerID,
- userInfos,
- ),
+ members: getRelativeMemberInfos(rawThreadInfo, viewerID, userInfos),
roles: rawThreadInfo.roles,
currentUser: getMinimallyEncodedCurrentUser(
rawThreadInfo,
@@ -940,7 +935,7 @@
parentThreadID: rawThreadInfo.parentThreadID,
containingThreadID: rawThreadInfo.containingThreadID,
community: rawThreadInfo.community,
- members: getLegacyRelativeMemberInfos(rawThreadInfo, viewerID, userInfos),
+ members: getRelativeMemberInfos(rawThreadInfo, viewerID, userInfos),
roles: rawThreadInfo.roles,
currentUser: getCurrentUser(rawThreadInfo, viewerID, userInfos),
repliesCount: rawThreadInfo.repliesCount,

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 6:42 AM (18 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2573046
Default Alt Text
D10291.diff (3 KB)

Event Timeline