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

Fix: App crashes on open notification #31481

Merged
merged 5 commits into from
Dec 8, 2023
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
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
Loading