Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/34424 #35115

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@
/**
* Whether the provided report is an archived room
*/
function isArchivedRoom(report: OnyxEntry<Report> | EmptyObject): boolean {

Check failure on line 1044 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / typecheck

Duplicate function implementation.
return report?.statusNum === CONST.REPORT.STATUS_NUM.CLOSED && report?.stateNum === CONST.REPORT.STATE_NUM.APPROVED;
}

Expand Down Expand Up @@ -1821,6 +1821,14 @@
return ReportActionsUtils.getLastVisibleMessage(reportID ?? '', actionsToMerge);
}

/**
* Whether the provided report is an archived room
*/
function isArchivedRoom(report: OnyxEntry<Report> | EmptyObject): boolean {

Check failure on line 1827 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / typecheck

Duplicate function implementation.

Check failure on line 1827 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / lint

All isArchivedRoom signatures should be adjacent

Check failure on line 1827 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / lint

'isArchivedRoom' is already defined
if (typeof report === 'object' && Object.keys(report).length === 0) {return false};

Check failure on line 1828 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / typecheck

No overload matches this call.
return !isWorkspaceThread(report) && report?.statusNum === CONST.REPORT.STATUS.CLOSED && report?.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED;

Check failure on line 1829 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / typecheck

Argument of type 'EmptyObject | OnyxEntry<Report>' is not assignable to parameter of type 'OnyxEntry<Report>'.

Check failure on line 1829 in src/libs/ReportUtils.ts

View workflow job for this annotation

GitHub Actions / typecheck

Property 'STATUS' does not exist on type '{ readonly MAX_COUNT_BEFORE_FOCUS_UPDATE: 30; readonly MAXIMUM_PARTICIPANTS: 8; readonly SPLIT_REPORTID: "-2"; readonly ACTIONS: { readonly LIMIT: 50; readonly TYPE: { readonly ADDCOMMENT: "ADDCOMMENT"; ... 19 more ...; readonly ROOMCHANGELOG: { ...; }; }; readonly THREAD_DISABLED: readonly [...]; }; ... 17 more ......'.
}

/**
* Checks if a report is an open task report assigned to current user.
*
Expand Down Expand Up @@ -4809,6 +4817,7 @@
getIOUReportActionDisplayMessage,
isWaitingForAssigneeToCompleteTask,
isGroupChat,
isWorkspaceThread,
isDraftExpenseReport,
shouldUseFullTitleToDisplay,
parseReportRouteParams,
Expand Down
12 changes: 10 additions & 2 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ function openReport(
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`,
value: {
isLoadingInitialReportActions: true,
isLoadingInitialReportActions: false,
isLoadingOlderReportActions: false,
isLoadingNewerReportActions: false,
lastVisitTime: DateUtils.getDBTime(),
Expand Down Expand Up @@ -2110,7 +2110,7 @@ function leaveRoom(reportID: string, isWorkspaceMemberLeavingWorkspaceRoom = fal
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: isWorkspaceMemberLeavingWorkspaceRoom
value: isWorkspaceMemberLeavingWorkspaceRoom || ReportUtils.isChatThread(report)
? {
notificationPreference: CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN,
}
Expand Down Expand Up @@ -2172,6 +2172,14 @@ function leaveRoom(reportID: string, isWorkspaceMemberLeavingWorkspaceRoom = fal

API.write('LeaveRoom', parameters, {optimisticData, successData, failureData});

if (ReportUtils.isWorkspaceThread(report)) {
if (report.parentReportID) {
// We should call Navigation.goBack to pop the current route first before navigating to the parent report.

Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(report.parentReportID));
}else {Navigation.goBack();}

}
if (isWorkspaceMemberLeavingWorkspaceRoom) {
const participantAccountIDs = PersonalDetailsUtils.getAccountIDsByLogins([CONST.EMAIL.CONCIERGE]);
const chat = ReportUtils.getChatByParticipants(participantAccountIDs);
Expand Down
Loading