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 @@ -39,7 +39,10 @@ import type { ClientEmojiAvatar } from '../types/avatar-types'; import type { EntryInfo } from '../types/entry-types.js'; import type { MessageStore, RawMessageInfo } from '../types/message-types.js'; -import type { MinimallyEncodedThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedRelativeMemberInfo, + MinimallyEncodedThreadInfo, +} from '../types/minimally-encoded-thread-permissions-types.js'; import type { BaseAppState } from '../types/redux-types.js'; import { threadPermissions } from '../types/thread-permission-types.js'; import { @@ -320,7 +323,9 @@ relativeMemberInfoSelectorForMembersOfThread(threadID), ( threadInfo: ?RawThreadInfo, - members: $ReadOnlyArray, + members: $ReadOnlyArray< + RelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, + >, ): boolean => { if (!threadInfo) { return false; 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 @@ -11,6 +11,7 @@ import SentencePrefixSearchIndex from '../shared/sentence-prefix-search-index.js'; import { getSingleOtherUser } from '../shared/thread-utils.js'; import type { ClientEmojiAvatar } from '../types/avatar-types'; +import type { MinimallyEncodedRelativeMemberInfo } from '../types/minimally-encoded-thread-permissions-types.js'; import type { BaseAppState } from '../types/redux-types.js'; import { userRelationshipStatus } from '../types/relationship-types.js'; import { threadTypes } from '../types/thread-types-enum.js'; @@ -112,9 +113,10 @@ const relativeMemberInfoSelectorForMembersOfThread: ( threadID: ?string, -) => (state: BaseAppState<>) => $ReadOnlyArray = _memoize( - baseRelativeMemberInfoSelectorForMembersOfThread, -); +) => ( + state: BaseAppState<>, +) => $ReadOnlyArray = + _memoize(baseRelativeMemberInfoSelectorForMembersOfThread); const userInfoSelectorForPotentialMembers: (state: BaseAppState<>) => { [id: string]: AccountUserInfo, 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 @@ -1666,7 +1666,7 @@ function switchMemberAdminRoleInThread( threadInfo: ThreadInfo | MinimallyEncodedThreadInfo, - memberInfo: RelativeMemberInfo, + memberInfo: RelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, isCurrentlyAdmin: boolean, dispatchActionPromise: DispatchActionPromise, changeUserRoleServerCall: ( diff --git a/web/modals/threads/members/change-member-role-modal.react.js b/web/modals/threads/members/change-member-role-modal.react.js --- a/web/modals/threads/members/change-member-role-modal.react.js +++ b/web/modals/threads/members/change-member-role-modal.react.js @@ -11,7 +11,10 @@ import SWMansionIcon from 'lib/components/SWMansionIcon.react.js'; import { otherUsersButNoOtherAdmins } from 'lib/selectors/thread-selectors.js'; import { roleIsAdminRole } from 'lib/shared/thread-utils.js'; -import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedRelativeMemberInfo, + MinimallyEncodedThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; import type { RelativeMemberInfo, ThreadInfo } from 'lib/types/thread-types'; import { useDispatchActionPromise } from 'lib/utils/action-utils.js'; import { values } from 'lib/utils/objects.js'; @@ -25,7 +28,7 @@ import UnsavedChangesModal from '../../unsaved-changes-modal.react.js'; type ChangeMemberRoleModalProps = { - +memberInfo: RelativeMemberInfo, + +memberInfo: RelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, +threadInfo: ThreadInfo | MinimallyEncodedThreadInfo, }; diff --git a/web/modals/threads/members/member.react.js b/web/modals/threads/members/member.react.js --- a/web/modals/threads/members/member.react.js +++ b/web/modals/threads/members/member.react.js @@ -11,7 +11,10 @@ } from 'lib/shared/thread-utils.js'; import { stringForUser } from 'lib/shared/user-utils.js'; import type { SetState } from 'lib/types/hook-types.js'; -import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedRelativeMemberInfo, + MinimallyEncodedThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { type RelativeMemberInfo, type ThreadInfo, @@ -31,7 +34,7 @@ const commIconComponent = ; type Props = { - +memberInfo: RelativeMemberInfo, + +memberInfo: RelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, +threadInfo: ThreadInfo | MinimallyEncodedThreadInfo, +setOpenMenu: SetState, }; diff --git a/web/modals/threads/members/members-list.react.js b/web/modals/threads/members/members-list.react.js --- a/web/modals/threads/members/members-list.react.js +++ b/web/modals/threads/members/members-list.react.js @@ -7,7 +7,10 @@ import { useENSNames } from 'lib/hooks/ens-cache.js'; import { stringForUser } from 'lib/shared/user-utils.js'; -import type { MinimallyEncodedThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; +import type { + MinimallyEncodedRelativeMemberInfo, + MinimallyEncodedThreadInfo, +} from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { type ThreadInfo, type RelativeMemberInfo, @@ -18,7 +21,9 @@ type Props = { +threadInfo: ThreadInfo | MinimallyEncodedThreadInfo, - +threadMembers: $ReadOnlyArray, + +threadMembers: $ReadOnlyArray< + RelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, + >, }; function ThreadMembersList(props: Props): React.Node { @@ -43,14 +48,18 @@ .map(([letter, users]) => { const userList = users .sort((a, b) => stringForUser(a).localeCompare(stringForUser(b))) - .map((user: RelativeMemberInfo) => ( - - )); + .map( + ( + user: RelativeMemberInfo | MinimallyEncodedRelativeMemberInfo, + ) => ( + + ), + ); const letterHeader = (
{letter.toUpperCase()} diff --git a/web/modals/threads/members/members-modal.react.js b/web/modals/threads/members/members-modal.react.js --- a/web/modals/threads/members/members-modal.react.js +++ b/web/modals/threads/members/members-modal.react.js @@ -9,6 +9,7 @@ roleIsAdminRole, threadHasPermission, } from 'lib/shared/thread-utils.js'; +import type { MinimallyEncodedRelativeMemberInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadPermissions } from 'lib/types/thread-permission-types.js'; import { type RelativeMemberInfo } from 'lib/types/thread-types.js'; import { useRolesFromCommunityThreadInfo } from 'lib/utils/role-utils.js'; @@ -42,7 +43,7 @@ const allMembers = React.useMemo( () => threadMembersNotFiltered.filter( - (member: RelativeMemberInfo) => + (member: RelativeMemberInfo | MinimallyEncodedRelativeMemberInfo) => searchText.length === 0 || userIDs.includes(member.id), ), [searchText.length, threadMembersNotFiltered, userIDs], @@ -51,8 +52,9 @@ const roles = useRolesFromCommunityThreadInfo(threadInfo, allMembers); const adminMembers = React.useMemo( () => - allMembers.filter((member: RelativeMemberInfo) => - roleIsAdminRole(roles.get(member.id)), + allMembers.filter( + (member: RelativeMemberInfo | MinimallyEncodedRelativeMemberInfo) => + roleIsAdminRole(roles.get(member.id)), ), [allMembers, roles], );