Skip to content

Commit

Permalink
Merge pull request #31481 from tienifr/fix/28932
Browse files Browse the repository at this point in the history
Fix: App crashes on open notification
  • Loading branch information
cristipaval authored Dec 8, 2023
2 parents 6129c67 + 9a7627a commit c96718a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1781,8 +1781,13 @@ function shouldShowReportActionNotification(reportID, action = null, isRemote =
return false;
}

// If this notification was delayed and the user saw the message already, don't show it
const report = allReports[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;
}

// If this notification was delayed and the user saw the message already, don't show it
if (action && report && report.lastReadTime >= action.created) {
Log.info(`${tag} No notification because the comment was already read`, false, {created: action.created, lastReadTime: report.lastReadTime});
return false;
Expand Down
5 changes: 3 additions & 2 deletions src/libs/actions/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,9 @@ function subscribeToUserEvents() {
return;
}

const onyxUpdatePromise = Onyx.update(pushJSON);
triggerNotifications(pushJSON);
const onyxUpdatePromise = Onyx.update(pushJSON).then(() => {
triggerNotifications(pushJSON);
});

// Return a promise when Onyx is done updating so that the OnyxUpdatesManager can properly apply all
// the onyx updates in order
Expand Down

0 comments on commit c96718a

Please sign in to comment.