Skip to content
Merged
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
10 changes: 5 additions & 5 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,7 @@ function addPolicyReport(policyReport: ReportUtils.OptimisticChatReport) {

/** Deletes a report, along with its reportActions, any linked reports, and any linked IOU report. */
function deleteReport(reportID: string) {
const report = allReports?.[reportID];
const report = currentReportData?.[reportID];
const onyxData: Record<string, null> = {
[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]: null,
[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`]: null,
Expand Down Expand Up @@ -1836,7 +1836,7 @@ function shouldShowReportActionNotification(reportID: string, action: ReportActi
return false;
}

const report = allReports?.[reportID];
const report = currentReportData?.[reportID];
if (!report || (report && report.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE)) {
Log.info(`${tag} No notification because the report does not exist or is pending deleted`, false);
return false;
Expand Down Expand Up @@ -2087,7 +2087,7 @@ function getCurrentUserAccountID(): number {

/** Leave a report by setting the state to submitted and closed */
function leaveRoom(reportID: string, isWorkspaceMemberLeavingWorkspaceRoom = false) {
const report = allReports?.[reportID];
const report = currentReportData?.[reportID];

if (!report) {
return;
Expand Down Expand Up @@ -2179,7 +2179,7 @@ function leaveRoom(reportID: string, isWorkspaceMemberLeavingWorkspaceRoom = fal

/** Invites people to a room */
function inviteToRoom(reportID: string, inviteeEmailsToAccountIDs: Record<string, number>) {
const report = allReports?.[reportID];
const report = currentReportData?.[reportID];

if (!report) {
return;
Expand Down Expand Up @@ -2238,7 +2238,7 @@ function inviteToRoom(reportID: string, inviteeEmailsToAccountIDs: Record<string

/** Removes people from a room */
function removeFromRoom(reportID: string, targetAccountIDs: number[]) {
const report = allReports?.[reportID];
const report = currentReportData?.[reportID];

const participantAccountIDsAfterRemoval = report?.participantAccountIDs?.filter((id: number) => !targetAccountIDs.includes(id));
const visibleChatMemberAccountIDsAfterRemoval = report?.visibleChatMemberAccountIDs?.filter((id: number) => !targetAccountIDs.includes(id));
Expand Down
9 changes: 6 additions & 3 deletions src/pages/home/HeaderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ const propTypes = {
/** The URL for the policy avatar */
avatar: PropTypes.string,
}),

/** The reportID of the request */
reportID: PropTypes.string.isRequired,
};

const defaultProps = {
Expand Down Expand Up @@ -135,14 +138,14 @@ function HeaderView(props) {
threeDotMenuItems.push({
icon: Expensicons.Trashcan,
text: translate('common.delete'),
onSelected: Session.checkIfActionIsAllowed(() => Task.deleteTask(props.report.reportID, props.report.reportName, props.report.stateNum, props.report.statusNum)),
onSelected: Session.checkIfActionIsAllowed(() => Task.deleteTask(props.reportID, props.report.reportName, props.report.stateNum, props.report.statusNum)),
});
}
}

const join = Session.checkIfActionIsAllowed(() =>
Report.updateNotificationPreference(
props.report.reportID,
props.reportID,
props.report.notificationPreference,
CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS,
false,
Expand All @@ -165,7 +168,7 @@ function HeaderView(props) {
threeDotMenuItems.push({
icon: Expensicons.ChatBubbles,
text: translate('common.leave'),
onSelected: Session.checkIfActionIsAllowed(() => Report.leaveRoom(props.report.reportID, isWorkspaceMemberLeavingWorkspaceRoom)),
onSelected: Session.checkIfActionIsAllowed(() => Report.leaveRoom(props.reportID, isWorkspaceMemberLeavingWorkspaceRoom)),
});
}

Expand Down
4 changes: 1 addition & 3 deletions src/pages/settings/Report/NotificationPreferencePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ function NotificationPreferencePage(props) {
/>
<SelectionList
sections={[{data: notificationPreferenceOptions}]}
onSelectRow={(option) =>
Report.updateNotificationPreference(props.report.reportID, props.report.notificationPreference, option.value, true, undefined, undefined, props.report)
}
onSelectRow={(option) => Report.updateNotificationPreference(props.reportID, props.report.notificationPreference, option.value, true, undefined, undefined, props.report)}
initiallyFocusedOptionKey={_.find(notificationPreferenceOptions, (locale) => locale.isSelected).keyForList}
/>
</FullPageNotFoundView>
Expand Down