Skip to content

Commit

Permalink
Merge pull request #47801 from rezkiy37/fix/46235-mark-as-read-notifs
Browse files Browse the repository at this point in the history
Fix chat get marked as read when opened from a notification
  • Loading branch information
Beamanator authored Aug 28, 2024
2 parents c12adce + 971b53d commit 36b33a4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ function ReportActionsList({
}

if (ReportUtils.isUnread(report)) {
// On desktop, when the notification center is displayed, Visibility.isVisible() will return false.
// On desktop, when the notification center is displayed, isVisible will return false.
// Currently, there's no programmatic way to dismiss the notification center panel.
// To handle this, we use the 'referrer' parameter to check if the current navigation is triggered from a notification.
const isFromNotification = route?.params?.referrer === CONST.REFERRER.NOTIFICATION;
if ((Visibility.isVisible() || isFromNotification) && scrollingVerticalOffset.current < MSG_VISIBLE_THRESHOLD) {
if ((isVisible || isFromNotification) && scrollingVerticalOffset.current < MSG_VISIBLE_THRESHOLD) {
Report.readNewestAction(report.reportID);
if (isFromNotification) {
Navigation.setParams({referrer: undefined});
Expand All @@ -347,7 +347,7 @@ function ReportActionsList({
}
}
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [report.lastVisibleActionCreated, report.reportID]);
}, [report.lastVisibleActionCreated, report.reportID, isVisible]);

useEffect(() => {
if (linkedReportActionID) {
Expand Down

0 comments on commit 36b33a4

Please sign in to comment.