Skip to content

Commit

Permalink
pass parent report id and parent report action id
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Jan 3, 2024
1 parent 8dbff7c commit 42d39bc
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/pages/home/HeaderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,25 @@ function HeaderView(props) {
}
}

const join = Session.checkIfActionIsAllowed(() =>
Report.updateNotificationPreference(
props.report.reportID,
props.report.notificationPreference,
CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS,
false,
props.report.parentReportID,
props.report.parentReportActionID,
),
);

const canJoinOrLeave = (isChatThread && !isEmptyChat) || isUserCreatedPolicyRoom || canLeaveRoom;
const canJoin = canJoinOrLeave && !isWhisperAction && props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN;
const canLeave = canJoinOrLeave && ((isChatThread && props.report.notificationPreference.length) || isUserCreatedPolicyRoom || canLeaveRoom);
if (canJoin) {
threeDotMenuItems.push({
icon: Expensicons.ChatBubbles,
text: translate('common.join'),
onSelected: Session.checkIfActionIsAllowed(() =>
Report.updateNotificationPreference(props.report.reportID, props.report.notificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false),
),
onSelected: join,
});
} else if (canLeave) {
const isWorkspaceMemberLeavingWorkspaceRoom = lodashGet(props.report, 'visibility', '') === CONST.REPORT.VISIBILITY.RESTRICTED && isPolicyMember;
Expand All @@ -167,9 +176,7 @@ function HeaderView(props) {
success
medium
text={translate('common.join')}
onPress={Session.checkIfActionIsAllowed(() =>
Report.updateNotificationPreference(props.report.reportID, props.report.notificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false),
)}
onPress={join}
/>
);

Expand Down

0 comments on commit 42d39bc

Please sign in to comment.