Skip to content

Commit

Permalink
Merge pull request #8446 from Expensify/stites-manuallyMarkUnread
Browse files Browse the repository at this point in the history
Pass param noting that the user manually marked the message as unread
  • Loading branch information
stitesExpensify authored Apr 8, 2022
2 parents ceda27c + efe4f0c commit 43910fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1254,10 +1254,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
* 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) {
// If report data is loading, we can't update the last read sequence number because it is obsolete
if (isReportDataLoading) {
return;
Expand All @@ -1283,6 +1284,7 @@ function updateLastReadActionID(reportID, sequenceNumber) {
API.Report_UpdateLastRead({
reportID,
sequenceNumber: lastReadSequenceNumber,
markAsUnread: manuallyMarked,
});
}

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 @@ -97,7 +97,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

0 comments on commit 43910fe

Please sign in to comment.