diff --git a/web/chat/chat-message-list.react.js b/web/chat/chat-message-list.react.js --- a/web/chat/chat-message-list.react.js +++ b/web/chat/chat-message-list.react.js @@ -24,7 +24,10 @@ useMessageListData, } from 'lib/selectors/chat-selectors.js'; import { messageKey } from 'lib/shared/message-utils.js'; -import { threadIsPending } from 'lib/shared/thread-utils.js'; +import { + threadIsPending, + threadOtherMembers, +} from 'lib/shared/thread-utils.js'; import type { FetchMessageInfosPayload } from 'lib/types/message-types.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { threadTypes } from 'lib/types/thread-types-enum.js'; @@ -76,6 +79,7 @@ +isEditState: boolean, +addScrollToMessageListener: ScrollToMessageCallback => mixed, +removeScrollToMessageListener: ScrollToMessageCallback => mixed, + +viewerID: ?string, }; type Snapshot = { +scrollTop: number, @@ -315,7 +319,26 @@ let relationshipPrompt = null; if (threadInfo.type === threadTypes.PERSONAL) { - relationshipPrompt = ; + const otherMembers = threadOtherMembers( + threadInfo.members, + this.props.viewerID, + ); + + let pendingPersonalThreadUserInfo; + if (otherMembers.length === 1) { + const otherMember = otherMembers[0]; + pendingPersonalThreadUserInfo = { + id: otherMember.id, + username: otherMember.username, + }; + } + + relationshipPrompt = ( + + ); } const messageContainerStyle = classNames({ @@ -462,6 +485,8 @@ } = useEditModalContext(); const isEditState = editState !== null; + const viewerID = useSelector(state => state.currentUserInfo?.id); + return ( ); diff --git a/web/chat/relationship-prompt/relationship-prompt.js b/web/chat/relationship-prompt/relationship-prompt.js --- a/web/chat/relationship-prompt/relationship-prompt.js +++ b/web/chat/relationship-prompt/relationship-prompt.js @@ -11,19 +11,26 @@ import { useRelationshipPrompt } from 'lib/hooks/relationship-prompt.js'; import type { ThreadInfo } from 'lib/types/minimally-encoded-thread-permissions-types.js'; import { userRelationshipStatus } from 'lib/types/relationship-types.js'; +import type { UserInfo } from 'lib/types/user-types.js'; import RelationshipPromptButtonContainer from './relationship-prompt-button-container.js'; import RelationshipPromptButton from './relationship-prompt-button.js'; import { buttonThemes } from '../../components/button.react.js'; -type Props = { +threadInfo: ThreadInfo }; - +type Props = { + +pendingPersonalThreadUserInfo: ?UserInfo, + +threadInfo: ThreadInfo, +}; function RelationshipPrompt(props: Props) { const { threadInfo } = props; const { otherUserInfo, callbacks: { blockUser, unblockUser, friendUser, unfriendUser }, - } = useRelationshipPrompt(threadInfo); + } = useRelationshipPrompt( + threadInfo, + undefined, + props.pendingPersonalThreadUserInfo, + ); if (!otherUserInfo?.username) { return null; }