Skip to content

Commit

Permalink
Merge pull request Expensify#25771 from gedu/edu/23171_unread_mark_de…
Browse files Browse the repository at this point in the history
…letion

Delay in removing 'New' marker After deleting newly sent message
  • Loading branch information
MonilBhavsar authored Mar 13, 2024
2 parents 91d7eb2 + ada2d42 commit ce3da4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, {forwardRef, useCallback, useEffect, useImperativeHandle, useRef,

/* eslint-disable no-restricted-imports */
import type {EmitterSubscription, GestureResponderEvent, NativeTouchEvent, View} from 'react-native';
import {Dimensions} from 'react-native';
import {DeviceEventEmitter, Dimensions} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import ConfirmModal from '@components/ConfirmModal';
import PopoverWithMeasuredContent from '@components/PopoverWithMeasuredContent';
Expand Down Expand Up @@ -261,6 +261,8 @@ function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef<Repor
} else if (reportAction) {
Report.deleteReportComment(reportIDRef.current, reportAction);
}

DeviceEventEmitter.emit(`deletedReportAction_${reportIDRef.current}`, reportAction?.reportActionID);
setIsDeleteCommentConfirmModalVisible(false);
}, []);

Expand Down
9 changes: 9 additions & 0 deletions src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,18 @@ function ReportActionsList({
setMessageManuallyMarkedUnread(0);
});

const deletedReportActionSubscription = DeviceEventEmitter.addListener(`deletedReportAction_${report.reportID}`, (reportActionID) => {
if (cacheUnreadMarkers.get(report.reportID) !== reportActionID) {
return;
}

setMessageManuallyMarkedUnread(new Date().getTime());
});

return () => {
unreadActionSubscription.remove();
readNewestActionSubscription.remove();
deletedReportActionSubscription.remove();
};
}, [report.reportID]);

Expand Down

0 comments on commit ce3da4e

Please sign in to comment.