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

Pass param noting that the user manually marked the message as unread #8446

Merged
merged 5 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 3 additions & 1 deletion src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1232,10 +1232,11 @@ function deleteReportComment(reportID, reportAction) {
*
* @param {Number} reportID
* @param {Number} [sequenceNumber] This can be used to set the last read actionID to a specific
* @param {Boolean} manuallyMarked If the user manually marked this as unread, we need to tell the API
stitesExpensify marked this conversation as resolved.
Show resolved Hide resolved
* spot (eg. mark-as-unread). Otherwise, when this param is omitted, the highest sequence number becomes the one that
* is last read (meaning that the entire report history has been read)
*/
function updateLastReadActionID(reportID, sequenceNumber) {
function updateLastReadActionID(reportID, sequenceNumber, manuallyMarked = false) {
stitesExpensify marked this conversation as resolved.
Show resolved Hide resolved
// If report data is loading, we can't update the last read sequence number because it is obsolete
if (isReportDataLoading) {
return;
Expand All @@ -1261,6 +1262,7 @@ function updateLastReadActionID(reportID, sequenceNumber) {
API.Report_UpdateLastRead({
reportID,
sequenceNumber: lastReadSequenceNumber,
markAsUnread: manuallyMarked,
stitesExpensify marked this conversation as resolved.
Show resolved Hide resolved
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ContextMenu/ContextMenuActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default [
successIcon: Expensicons.Checkmark,
shouldShow: type => type === CONTEXT_MENU_TYPES.REPORT_ACTION,
onPress: (closePopover, {reportAction, reportID}) => {
Report.updateLastReadActionID(reportID, reportAction.sequenceNumber);
Report.updateLastReadActionID(reportID, reportAction.sequenceNumber, true);
Report.setNewMarkerPosition(reportID, reportAction.sequenceNumber);
if (closePopover) {
hideContextMenu(true, ReportActionComposeFocusManager.focus);
Expand Down