Skip to content

Commit

Permalink
Merge pull request #40563 from neonbhai/group-chat-fixes
Browse files Browse the repository at this point in the history
[Group Chats] Fixes for Thread Avatars and Leave Group Chat Navigation
  • Loading branch information
marcaaron authored Apr 19, 2024
2 parents 09ad468 + 7071f2e commit 48f64d0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2421,7 +2421,7 @@ function navigateToMostRecentReport(currentReport: OnyxEntry<Report>) {
if (!isChatThread) {
Navigation.goBack();
}
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID ?? ''));
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID ?? ''), CONST.NAVIGATION.TYPE.FORCED_UP);
} else {
const participantAccountIDs = PersonalDetailsUtils.getAccountIDsByLogins([CONST.EMAIL.CONCIERGE]);
const chat = ReportUtils.getChatByParticipants(participantAccountIDs);
Expand All @@ -2430,7 +2430,7 @@ function navigateToMostRecentReport(currentReport: OnyxEntry<Report>) {
if (!isChatThread) {
Navigation.goBack();
}
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(chat?.reportID));
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(chat?.reportID), CONST.NAVIGATION.TYPE.FORCED_UP);
}
}
}
Expand Down
44 changes: 23 additions & 21 deletions src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
const chatRoomSubtitle = useMemo(() => ReportUtils.getChatRoomSubtitle(report), [report, policy]);
const parentNavigationSubtitleData = ReportUtils.getParentNavigationSubtitle(report);
const isGroupChat = useMemo(() => ReportUtils.isGroupChat(report), [report]);
const isThread = useMemo(() => ReportUtils.isThread(report), [report]);
const participants = useMemo(() => {
if (isGroupChat) {
return ReportUtils.getParticipantAccountIDs(report.reportID ?? '');
Expand Down Expand Up @@ -227,27 +228,28 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
/>
) : null;

const renderAvatar = isGroupChat ? (
<AvatarWithImagePicker
source={icons[0].source}
isUsingDefaultAvatar={!report.avatarUrl}
size={CONST.AVATAR_SIZE.XLARGE}
avatarStyle={styles.avatarXLarge}
shouldDisableViewPhoto
onImageRemoved={() => {
// Calling this without a file will remove the avatar
Report.updateGroupChatAvatar(report.reportID ?? '');
}}
onImageSelected={(file) => Report.updateGroupChatAvatar(report.reportID ?? '', file)}
editIcon={Expensicons.Camera}
editIconStyle={styles.smallEditIconAccount}
/>
) : (
<RoomHeaderAvatars
icons={icons}
reportID={report?.reportID}
/>
);
const renderAvatar =
isGroupChat && !isThread ? (
<AvatarWithImagePicker
source={icons[0].source}
isUsingDefaultAvatar={!report.avatarUrl}
size={CONST.AVATAR_SIZE.XLARGE}
avatarStyle={styles.avatarXLarge}
shouldDisableViewPhoto
onImageRemoved={() => {
// Calling this without a file will remove the avatar
Report.updateGroupChatAvatar(report.reportID ?? '');
}}
onImageSelected={(file) => Report.updateGroupChatAvatar(report.reportID ?? '', file)}
editIcon={Expensicons.Camera}
editIconStyle={styles.smallEditIconAccount}
/>
) : (
<RoomHeaderAvatars
icons={icons}
reportID={report?.reportID}
/>
);

const reportName =
ReportUtils.isDeprecatedGroupDM(report) || ReportUtils.isGroupChat(report)
Expand Down

0 comments on commit 48f64d0

Please sign in to comment.