Skip to content
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
18 changes: 8 additions & 10 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import type {ValueOf} from 'type-fest';
import type {LocaleContextProps, LocalizedTranslate} from '@components/LocaleContextProvider';
import usePrevious from '@hooks/usePrevious';
import {isHarvestCreatedExpenseReport, isPolicyExpenseChat} from '@libs/ReportUtils';

Check warning on line 10 in src/libs/ReportActionsUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unexpected subpath import via alias '@libs/ReportUtils'. Use './ReportUtils' instead
import CONST from '@src/CONST';
import IntlStore from '@src/languages/IntlStore';
import type {TranslationPaths} from '@src/languages/types';
Expand Down Expand Up @@ -60,7 +60,7 @@
type MemberChangeMessageElement = MessageTextElement | MemberChangeMessageUserMentionElement | MemberChangeMessageRoomReferenceElement;

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 63 in src/libs/ReportActionsUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand All @@ -72,7 +72,7 @@
});

let allReports: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 75 in src/libs/ReportActionsUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -81,14 +81,13 @@
});

let isNetworkOffline = false;
Onyx.connect({

Check warning on line 84 in src/libs/ReportActionsUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NETWORK,
callback: (val) => (isNetworkOffline = val?.isOffline ?? false),
});

let currentUserAccountID: number | undefined;
let currentEmail = '';
let deprecatedCurrentUserAccountID: number | undefined;
Onyx.connect({

Check warning on line 90 in src/libs/ReportActionsUtils.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, value is undefined
Expand All @@ -96,8 +95,7 @@
return;
}

currentUserAccountID = value.accountID;
currentEmail = value?.email ?? '';
deprecatedCurrentUserAccountID = value.accountID;
},
});

Expand Down Expand Up @@ -443,7 +441,7 @@
if (!isWhisperAction(reportAction)) {
return false;
}
return !getWhisperedTo(reportAction).includes(currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID);
return !getWhisperedTo(reportAction).includes(deprecatedCurrentUserAccountID ?? CONST.DEFAULT_NUMBER_ID);
}

function isReimbursementQueuedAction(reportAction: OnyxInputOrEntry<ReportAction>): reportAction is ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.REIMBURSEMENT_QUEUED> {
Expand Down Expand Up @@ -2216,18 +2214,18 @@
return matches.map((match) => Str.removeSMSDomain(match[1].substring(1)));
}

function didMessageMentionCurrentUser(reportAction: OnyxInputOrEntry<ReportAction>) {
function didMessageMentionCurrentUser(reportAction: OnyxInputOrEntry<ReportAction>, currentUserEmail: string) {
const accountIDsFromMessage = getMentionedAccountIDsFromAction(reportAction);
const message = getReportActionMessage(reportAction)?.html ?? '';
const emailsFromMessage = getMentionedEmailsFromMessage(message);
return accountIDsFromMessage.includes(currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID) || emailsFromMessage.includes(currentEmail) || message.includes('<mention-here>');
return accountIDsFromMessage.includes(deprecatedCurrentUserAccountID ?? CONST.DEFAULT_NUMBER_ID) || emailsFromMessage.includes(currentUserEmail) || message.includes('<mention-here>');
}

/**
* Check if the current user is the requestor of the action
*/
function wasActionTakenByCurrentUser(reportAction: OnyxInputOrEntry<ReportAction>): boolean {
return currentUserAccountID === reportAction?.actorAccountID;
return deprecatedCurrentUserAccountID === reportAction?.actorAccountID;
}

/**
Expand Down Expand Up @@ -3227,7 +3225,7 @@
const originalMessage = getOriginalMessage(reportAction);
const submittersNames = getPersonalDetailsByIDs({
accountIDs: originalMessage?.submittersAccountIDs ?? [],
currentUserAccountID: currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID,
currentUserAccountID: deprecatedCurrentUserAccountID ?? CONST.DEFAULT_NUMBER_ID,
}).map(({displayName, login}) => displayName ?? login ?? 'Unknown Submitter');
return translate('workspaceActions.removedFromApprovalWorkflow', {submittersNames, count: submittersNames.length});
}
Expand Down Expand Up @@ -3393,7 +3391,7 @@
const isExpensifyCardActive = isCardActive(expensifyCard);
const expensifyCardLink = (expensifyCardLinkText: string) =>
shouldRenderHTML && isExpensifyCardActive ? `<a href='${environmentURL}/${navigateRoute}'>${expensifyCardLinkText}</a>` : expensifyCardLinkText;
const isAssigneeCurrentUser = currentUserAccountID === assigneeAccountID;
const isAssigneeCurrentUser = deprecatedCurrentUserAccountID === assigneeAccountID;
const companyCardLink =
shouldRenderHTML && isAssigneeCurrentUser && companyCard
? `<a href='${environmentURL}/${ROUTES.SETTINGS_WALLET}'>${translate('workspace.companyCards.companyCard')}</a>`
Expand Down
8 changes: 5 additions & 3 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
let currentUserAccountID = -1;
let currentUserEmail: string | undefined;

Onyx.connect({

Check warning on line 279 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -289,7 +289,7 @@
},
});

Onyx.connect({

Check warning on line 292 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => (conciergeReportID = value),
});
Expand All @@ -297,7 +297,7 @@
// map of reportID to all reportActions for that report
const allReportActions: OnyxCollection<ReportActions> = {};

Onyx.connect({

Check warning on line 300 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
callback: (actions, key) => {
if (!key || !actions) {
Expand All @@ -309,7 +309,7 @@
});

let allReports: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 312 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -318,7 +318,7 @@
});

let allPersonalDetails: OnyxEntry<PersonalDetailsList> = {};
Onyx.connect({

Check warning on line 321 in src/libs/actions/Report.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
allPersonalDetails = value ?? {};
Expand Down Expand Up @@ -1992,6 +1992,7 @@
ancestors: Ancestor[],
isReportArchived: boolean | undefined,
isOriginalReportArchived: boolean | undefined,
currentEmail: string,
) {
const originalReportID = getOriginalReportID(reportID, reportAction);
const reportActionID = reportAction.reportActionID;
Expand Down Expand Up @@ -2031,13 +2032,13 @@
...optimisticLastReportData,
};

const didCommentMentionCurrentUser = ReportActionsUtils.didMessageMentionCurrentUser(reportAction);
const didCommentMentionCurrentUser = ReportActionsUtils.didMessageMentionCurrentUser(reportAction, currentEmail);
if (didCommentMentionCurrentUser && reportAction.created === report?.lastMentionedTime) {
const reportActionsForReport = allReportActions?.[reportID];
const latestMentionedReportAction = Object.values(reportActionsForReport ?? {}).find(
(action) =>
action.reportActionID !== reportAction.reportActionID &&
ReportActionsUtils.didMessageMentionCurrentUser(action) &&
ReportActionsUtils.didMessageMentionCurrentUser(action, currentEmail) &&
ReportActionsUtils.shouldReportActionBeVisible(action, action.reportActionID),
);
optimisticReport.lastMentionedTime = latestMentionedReportAction?.created ?? null;
Expand Down Expand Up @@ -2168,6 +2169,7 @@
textForNewComment: string,
isOriginalReportArchived: boolean | undefined,
isOriginalParentReportArchived: boolean | undefined,
currentEmail: string,
videoAttributeCache?: Record<string, string>,
) {
const originalReportID = originalReport?.reportID;
Expand Down Expand Up @@ -2201,7 +2203,7 @@

// Delete the comment if it's empty
if (!htmlForNewComment) {
deleteReportComment(originalReportID, originalReportAction, ancestors, isOriginalReportArchived, isOriginalParentReportArchived);
deleteReportComment(originalReportID, originalReportAction, ancestors, isOriginalReportArchived, isOriginalParentReportArchived, currentEmail);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ function PopoverReportActionContextMenu({ref}: PopoverReportActionContextMenuPro
} else if (reportAction) {
// eslint-disable-next-line @typescript-eslint/no-deprecated
InteractionManager.runAfterInteractions(() => {
deleteReportComment(reportIDRef.current, reportAction, ancestorsRef.current, isReportArchived, isOriginalReportArchived);
deleteReportComment(reportIDRef.current, reportAction, ancestorsRef.current, isReportArchived, isOriginalReportArchived, email ?? '');
});
}

Expand Down
27 changes: 25 additions & 2 deletions src/pages/home/report/ReportActionItemMessageEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import * as Expensicons from '@components/Icon/Expensicons';
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback';
import Tooltip from '@components/Tooltip';
import useAncestors from '@hooks/useAncestors';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useHandleExceedMaxCommentLength from '@hooks/useHandleExceedMaxCommentLength';
import useIsScrollLikelyLayoutTriggered from '@hooks/useIsScrollLikelyLayoutTriggered';
import useKeyboardState from '@hooks/useKeyboardState';
Expand Down Expand Up @@ -110,6 +111,7 @@ function ReportActionItemMessageEdit({
ref,
}: ReportActionItemMessageEditProps) {
const [preferredSkinTone = CONST.EMOJI_DEFAULT_SKIN_TONE] = useOnyx(ONYXKEYS.PREFERRED_EMOJI_SKIN_TONE, {canBeMissing: true});
const {email} = useCurrentUserPersonalDetails();
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand Down Expand Up @@ -314,9 +316,30 @@ function ReportActionItemMessageEdit({
ReportActionContextMenu.showDeleteModal(originalReportID ?? reportID, action, true, deleteDraft, () => focusEditAfterCancelDelete(textInputRef.current));
return;
}
editReportComment(originalReport, action, ancestors, trimmedNewDraft, isOriginalReportArchived, isOriginalParentReportArchived, Object.fromEntries(draftMessageVideoAttributeCache));
editReportComment(
originalReport,
action,
ancestors,
trimmedNewDraft,
isOriginalReportArchived,
isOriginalParentReportArchived,
email ?? '',
Object.fromEntries(draftMessageVideoAttributeCache),
);
deleteDraft();
}, [reportID, action, ancestors, deleteDraft, draft, originalReportID, isOriginalReportArchived, originalReport, isOriginalParentReportArchived, debouncedValidateCommentMaxLength]);
}, [
reportID,
action,
ancestors,
deleteDraft,
draft,
originalReportID,
isOriginalReportArchived,
originalReport,
isOriginalParentReportArchived,
debouncedValidateCommentMaxLength,
email,
]);

/**
* @param emoji
Expand Down
98 changes: 80 additions & 18 deletions tests/actions/ReportTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ describe('actions/Report', () => {
.then(() => {
rerender(report);
// If the user deletes a comment that is before the last read
Report.deleteReportComment(REPORT_ID, {...reportActions[200]}, ancestors.current, undefined, undefined);
Report.deleteReportComment(REPORT_ID, {...reportActions[200]}, ancestors.current, undefined, undefined, USER_1_LOGIN);
return waitForBatchedUpdates();
})
.then(() => {
Expand All @@ -530,7 +530,7 @@ describe('actions/Report', () => {

rerender(report);
// If the user deletes the last comment after the lastReadTime the lastMessageText will reflect the new last comment
Report.deleteReportComment(REPORT_ID, {...reportActions[400]}, ancestors.current, undefined, undefined);
Report.deleteReportComment(REPORT_ID, {...reportActions[400]}, ancestors.current, undefined, undefined, USER_1_LOGIN);
return waitForBatchedUpdates();
})
.then(() => {
Expand Down Expand Up @@ -1003,7 +1003,7 @@ describe('actions/Report', () => {
};

const {result: ancestors, rerender} = renderHook(() => useAncestors(originalReport));
Report.editReportComment(originalReport, newReportAction, ancestors.current, 'Testing an edited comment', undefined, undefined);
Report.editReportComment(originalReport, newReportAction, ancestors.current, 'Testing an edited comment', undefined, undefined, '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adding a test case to make sure that the new param is working well. Thanks

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.


await waitForBatchedUpdates();

Expand Down Expand Up @@ -1037,7 +1037,7 @@ describe('actions/Report', () => {
});

rerender(originalReport);
Report.deleteReportComment(REPORT_ID, newReportAction, ancestors.current, undefined, undefined);
Report.deleteReportComment(REPORT_ID, newReportAction, ancestors.current, undefined, undefined, '');

await waitForBatchedUpdates();
expect(PersistedRequests.getAll().length).toBe(0);
Expand All @@ -1061,6 +1061,41 @@ describe('actions/Report', () => {
TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.DELETE_COMMENT, 0);
});

it('should remove AddComment and UpdateComment without sending any request when DeleteComment is set with currentUserEmail', async () => {
global.fetch = TestHelper.getGlobalFetchMock();
const TEST_USER_ACCOUNT_ID = 1;
const REPORT_ID = '1';
const REPORT: OnyxTypes.Report = createRandomReport(1, undefined);
const created = format(addSeconds(subMinutes(new Date(), 10), 10), CONST.DATE.FNS_DB_FORMAT_STRING);

Onyx.set(ONYXKEYS.NETWORK, {isOffline: true});
Report.addComment(REPORT, REPORT_ID, [], 'Testing a comment', CONST.DEFAULT_TIME_ZONE);

const reportActionID = PersistedRequests.getAll().at(0)?.data?.reportActionID as string | undefined;
const newReportAction = TestHelper.buildTestReportComment(created, TEST_USER_ACCOUNT_ID, reportActionID);
const originalReport = {reportID: REPORT_ID};
const {result: ancestors, rerender} = renderHook(() => useAncestors(originalReport));

const currentUserEmail = 'test@test.com';
Report.editReportComment(originalReport, newReportAction, ancestors.current, 'Testing an edited comment', undefined, undefined, currentUserEmail);
await waitForBatchedUpdates();

const persistedRequests = await getOnyxValue(ONYXKEYS.PERSISTED_REQUESTS);
expect(persistedRequests?.at(0)?.command).toBe(WRITE_COMMANDS.ADD_COMMENT);

rerender(originalReport);
Report.deleteReportComment(REPORT_ID, newReportAction, ancestors.current, undefined, undefined, currentUserEmail);
await waitForBatchedUpdates();

expect(PersistedRequests.getAll().length).toBe(0);
Onyx.set(ONYXKEYS.NETWORK, {isOffline: false});
await waitForBatchedUpdates();

TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.ADD_COMMENT, 0);
TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.UPDATE_COMMENT, 0);
TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.DELETE_COMMENT, 0);
});

it('should send DeleteComment request and remove UpdateComment accordingly', async () => {
global.fetch = TestHelper.getGlobalFetchMock();

Expand All @@ -1086,7 +1121,7 @@ describe('actions/Report', () => {
};
const {result: ancestors, rerender} = renderHook(() => useAncestors(originalReport));

Report.editReportComment(originalReport, reportAction, ancestors.current, 'Testing an edited comment', undefined, undefined);
Report.editReportComment(originalReport, reportAction, ancestors.current, 'Testing an edited comment', undefined, undefined, '');

await waitForBatchedUpdates();

Expand All @@ -1102,7 +1137,7 @@ describe('actions/Report', () => {
});

rerender(originalReport);
Report.deleteReportComment(REPORT_ID, reportAction, ancestors.current, undefined, undefined);
Report.deleteReportComment(REPORT_ID, reportAction, ancestors.current, undefined, undefined, '');

await waitForBatchedUpdates();
expect(PersistedRequests.getAll().length).toBe(1);
Expand Down Expand Up @@ -1152,7 +1187,7 @@ describe('actions/Report', () => {
}),
);

Report.deleteReportComment(REPORT_ID, reportAction, [], undefined, undefined);
Report.deleteReportComment(REPORT_ID, reportAction, [], undefined, undefined, '');

jest.runOnlyPendingTimers();
await waitForBatchedUpdates();
Expand Down Expand Up @@ -1215,7 +1250,7 @@ describe('actions/Report', () => {
});
});

Report.deleteReportComment(REPORT_ID, newReportAction, [], undefined, undefined);
Report.deleteReportComment(REPORT_ID, newReportAction, [], undefined, undefined, '');

await waitForBatchedUpdates();
expect(PersistedRequests.getAll().length).toBe(0);
Expand Down Expand Up @@ -1285,7 +1320,7 @@ describe('actions/Report', () => {
});
});

Report.deleteReportComment(REPORT_ID, newReportAction, [], undefined, undefined);
Report.deleteReportComment(REPORT_ID, newReportAction, [], undefined, undefined, '');

await waitForBatchedUpdates();
expect(PersistedRequests.getAll().length).toBe(0);
Expand Down Expand Up @@ -1485,7 +1520,7 @@ describe('actions/Report', () => {
});
});

Report.deleteReportComment(REPORT_ID, newReportAction, [], undefined, undefined);
Report.deleteReportComment(REPORT_ID, newReportAction, [], undefined, undefined, '');

await waitForBatchedUpdates();
expect(PersistedRequests.getAll().length).toBe(0);
Expand Down Expand Up @@ -1570,7 +1605,7 @@ describe('actions/Report', () => {
});
});

Report.deleteReportComment(REPORT_ID, reportAction, [], undefined, undefined);
Report.deleteReportComment(REPORT_ID, reportAction, [], undefined, undefined, '');

await waitForBatchedUpdates();
expect(PersistedRequests.getAll().length).toBe(1);
Expand Down Expand Up @@ -1619,7 +1654,7 @@ describe('actions/Report', () => {

const {result: ancestors} = renderHook(() => useAncestors({reportID: REPORT_ID}));

Report.deleteReportComment(REPORT_ID, reportAction, ancestors.current, undefined, undefined);
Report.deleteReportComment(REPORT_ID, reportAction, ancestors.current, undefined, undefined, '');

expect(PersistedRequests.getAll().length).toBe(3);

Expand Down Expand Up @@ -1658,7 +1693,7 @@ describe('actions/Report', () => {
const originalReport = {
reportID: REPORT_ID,
};
Report.editReportComment(originalReport, reportAction, [], 'Testing an edited comment', undefined, undefined);
Report.editReportComment(originalReport, reportAction, [], 'Testing an edited comment', undefined, undefined, '');

await waitForBatchedUpdates();

Expand Down Expand Up @@ -1696,9 +1731,9 @@ describe('actions/Report', () => {

const {result: ancestors} = renderHook(() => useAncestors(originalReport));

Report.editReportComment(originalReport, action, ancestors.current, 'value1', undefined, undefined);
Report.editReportComment(originalReport, action, ancestors.current, 'value2', undefined, undefined);
Report.editReportComment(originalReport, action, ancestors.current, 'value3', undefined, undefined);
Report.editReportComment(originalReport, action, ancestors.current, 'value1', undefined, undefined, '');
Report.editReportComment(originalReport, action, ancestors.current, 'value2', undefined, undefined, '');
Report.editReportComment(originalReport, action, ancestors.current, 'value3', undefined, undefined, '');

const requests = PersistedRequests?.getAll();

Expand All @@ -1711,6 +1746,33 @@ describe('actions/Report', () => {
TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.UPDATE_COMMENT, 1);
});

it('it should only send the last sequential UpdateComment request to BE with currentUserEmail', async () => {
global.fetch = TestHelper.getGlobalFetchMock();
await Onyx.set(ONYXKEYS.NETWORK, {isOffline: true});

const action: OnyxEntry<OnyxTypes.ReportAction> = {
reportID: '123',
reportActionID: '722',
actionName: 'ADDCOMMENT',
created: '2024-10-21 10:37:59.881',
};
const originalReport = {reportID: '123'};
const {result: ancestors} = renderHook(() => useAncestors(originalReport));
const currentUserEmail = 'user@test.com';

Report.editReportComment(originalReport, action, ancestors.current, 'value1', undefined, undefined, currentUserEmail);
Report.editReportComment(originalReport, action, ancestors.current, 'value2', undefined, undefined, currentUserEmail);
Report.editReportComment(originalReport, action, ancestors.current, 'value3', undefined, undefined, currentUserEmail);

const requests = PersistedRequests?.getAll();
expect(requests.length).toBe(1);
expect(requests?.at(0)?.command).toBe(WRITE_COMMANDS.UPDATE_COMMENT);
expect(requests?.at(0)?.data?.reportComment).toBe('value3');

await Onyx.set(ONYXKEYS.NETWORK, {isOffline: false});
TestHelper.expectAPICommandToHaveBeenCalled(WRITE_COMMANDS.UPDATE_COMMENT, 1);
});

it('should clears lastMentionedTime when all mentions to the current user are deleted', async () => {
const reportID = '1';
const mentionActionID = '1';
Expand Down Expand Up @@ -1749,8 +1811,8 @@ describe('actions/Report', () => {

const {result: ancestors} = renderHook(() => useAncestors(report));

Report.deleteReportComment(reportID, mentionAction, ancestors.current, undefined, undefined);
Report.deleteReportComment(reportID, mentionAction2, ancestors.current, undefined, undefined);
Report.deleteReportComment(reportID, mentionAction, ancestors.current, undefined, undefined, '');
Report.deleteReportComment(reportID, mentionAction2, ancestors.current, undefined, undefined, '');

await waitForBatchedUpdates();

Expand Down
Loading
Loading