From 80a91f6ed938e27e93ad8a7d4043b415b9fc8292 Mon Sep 17 00:00:00 2001 From: Rajat Date: Mon, 14 Jul 2025 17:58:04 +0530 Subject: [PATCH 1/4] Revert "[CP Staging] Revert "Change Invite whisper actions"" --- src/CONST/index.ts | 5 ++ src/languages/de.ts | 3 +- src/languages/en.ts | 3 +- src/languages/es.ts | 3 +- src/languages/fr.ts | 3 +- src/languages/it.ts | 5 +- src/languages/ja.ts | 3 +- src/languages/nl.ts | 5 +- src/languages/pl.ts | 5 +- src/languages/pt-BR.ts | 3 +- src/languages/zh-hans.ts | 5 +- .../ResolveActionableMentionWhisperParams.ts | 2 +- src/libs/ReportActionsUtils.ts | 7 +++ src/libs/actions/Report.ts | 42 ++++++++++++- .../home/report/PureReportActionItem.tsx | 59 +++++++++++++++---- src/pages/home/report/ReportActionItem.tsx | 2 + src/types/onyx/OriginalMessage.ts | 16 +++++ src/types/onyx/ReportAction.ts | 6 +- 18 files changed, 145 insertions(+), 32 deletions(-) diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 12c74e013fd07..2d21d3b1fe592 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -1101,6 +1101,7 @@ const CONST = { ACTIONABLE_ADD_PAYMENT_CARD: 'ACTIONABLEADDPAYMENTCARD', ACTIONABLE_JOIN_REQUEST: 'ACTIONABLEJOINREQUEST', ACTIONABLE_MENTION_WHISPER: 'ACTIONABLEMENTIONWHISPER', + ACTIONABLE_MENTION_INVITE_TO_SUBMIT_EXPENSE_CONFIRM_WHISPER: 'ACTIONABLEMENTIONINVITETOSUBMITEXPENSECONFIRMWHISPER', ACTIONABLE_REPORT_MENTION_WHISPER: 'ACTIONABLEREPORTMENTIONWHISPER', ACTIONABLE_TRACK_EXPENSE_WHISPER: 'ACTIONABLETRACKEXPENSEWHISPER', POLICY_EXPENSE_CHAT_WELCOME_WHISPER: 'POLICYEXPENSECHATWELCOMEWHISPER', @@ -1285,8 +1286,12 @@ const CONST = { }, ACTIONABLE_MENTION_WHISPER_RESOLUTION: { INVITE: 'invited', + INVITE_TO_SUBMIT_EXPENSE: 'inviteToSubmitExpense', NOTHING: 'nothing', }, + ACTIONABLE_MENTION_INVITE_TO_SUBMIT_EXPENSE_CONFIRM_WHISPER: { + DONE: 'done', + }, ACTIONABLE_TRACK_EXPENSE_WHISPER_RESOLUTION: { NOTHING: 'nothing', }, diff --git a/src/languages/de.ts b/src/languages/de.ts index fd6a049a39a57..750e2289c57d0 100644 --- a/src/languages/de.ts +++ b/src/languages/de.ts @@ -6282,7 +6282,8 @@ const translations = { levelThreeResult: 'Nachricht aus dem Kanal entfernt, anonyme Warnung gesendet und Nachricht zur Überprüfung gemeldet.', }, actionableMentionWhisperOptions: { - invite: 'Lade sie ein', + inviteToSubmitExpense: 'Zum Einreichen von Ausgaben einladen', + inviteToChat: 'Nur zum Chatten einladen', nothing: 'Nichts tun', }, actionableMentionJoinWorkspaceOptions: { diff --git a/src/languages/en.ts b/src/languages/en.ts index f9d0d385d6653..9ebce24c726d8 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -6250,7 +6250,8 @@ const translations = { levelThreeResult: 'Message removed from channel plus anonymous warning and message is reported for review.', }, actionableMentionWhisperOptions: { - invite: 'Invite them', + inviteToSubmitExpense: 'Invite to submit expenses', + inviteToChat: 'Invite to chat only', nothing: 'Do nothing', }, actionableMentionJoinWorkspaceOptions: { diff --git a/src/languages/es.ts b/src/languages/es.ts index 6d44de7718828..fa60b5e24353d 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -6716,7 +6716,8 @@ const translations = { copied: '¡Copiado!', }, actionableMentionWhisperOptions: { - invite: 'Invitar', + inviteToSubmitExpense: 'Invitar a enviar gastos', + inviteToChat: 'Invitar solo a chatear', nothing: 'No hacer nada', }, actionableMentionJoinWorkspaceOptions: { diff --git a/src/languages/fr.ts b/src/languages/fr.ts index 7a6309ecd327c..601ddba01f25a 100644 --- a/src/languages/fr.ts +++ b/src/languages/fr.ts @@ -6294,7 +6294,8 @@ const translations = { levelThreeResult: 'Message supprimé du canal avec un avertissement anonyme et le message est signalé pour examen.', }, actionableMentionWhisperOptions: { - invite: 'Invitez-les', + inviteToSubmitExpense: 'Inviter à soumettre des dépenses', + inviteToChat: 'Inviter uniquement à discuter', nothing: 'Ne rien faire', }, actionableMentionJoinWorkspaceOptions: { diff --git a/src/languages/it.ts b/src/languages/it.ts index 4402998e53dfb..1f2552b89e70f 100644 --- a/src/languages/it.ts +++ b/src/languages/it.ts @@ -6296,8 +6296,9 @@ const translations = { levelThreeResult: 'Messaggio rimosso dal canale più avviso anonimo e messaggio segnalato per revisione.', }, actionableMentionWhisperOptions: { - invite: 'Invitali', - nothing: 'Do nothing', + inviteToSubmitExpense: 'Invita a inviare le spese', + inviteToChat: 'Invita solo a chattare', + nothing: 'Non fare nulla', }, actionableMentionJoinWorkspaceOptions: { accept: 'Accetta', diff --git a/src/languages/ja.ts b/src/languages/ja.ts index 96c0dcb91cfa2..4ff0f278f3f96 100644 --- a/src/languages/ja.ts +++ b/src/languages/ja.ts @@ -6257,7 +6257,8 @@ const translations = { levelThreeResult: 'チャンネルからメッセージが削除され、匿名の警告が行われ、メッセージがレビューのために報告されました。', }, actionableMentionWhisperOptions: { - invite: '招待する', + inviteToSubmitExpense: '経費の提出に招待する', + inviteToChat: 'チャットのみ招待', nothing: '何もしない', }, actionableMentionJoinWorkspaceOptions: { diff --git a/src/languages/nl.ts b/src/languages/nl.ts index 98a95390b689e..89f693c03abe6 100644 --- a/src/languages/nl.ts +++ b/src/languages/nl.ts @@ -6288,8 +6288,9 @@ const translations = { levelThreeResult: 'Bericht verwijderd uit kanaal plus anonieme waarschuwing en bericht is gerapporteerd voor beoordeling.', }, actionableMentionWhisperOptions: { - invite: 'Nodig hen uit', - nothing: 'Do nothing', + inviteToSubmitExpense: 'Uitnodigen om onkosten in te dienen', + inviteToChat: 'Alleen uitnodigen om te chatten', + nothing: 'Niets doen', }, actionableMentionJoinWorkspaceOptions: { accept: 'Accepteren', diff --git a/src/languages/pl.ts b/src/languages/pl.ts index d10f0a5f9ad28..a24ad0162f77d 100644 --- a/src/languages/pl.ts +++ b/src/languages/pl.ts @@ -6273,8 +6273,9 @@ const translations = { levelThreeResult: 'Wiadomość usunięta z kanału, dodano anonimowe ostrzeżenie, a wiadomość została zgłoszona do przeglądu.', }, actionableMentionWhisperOptions: { - invite: 'Zaproś ich', - nothing: 'Do nothing', + inviteToSubmitExpense: 'Zaproś do przesyłania wydatków', + inviteToChat: 'Zaproś tylko do czatu', + nothing: 'Nie rób nic', }, actionableMentionJoinWorkspaceOptions: { accept: 'Akceptuj', diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts index 96d88342e4cad..32eabfffd7cb5 100644 --- a/src/languages/pt-BR.ts +++ b/src/languages/pt-BR.ts @@ -6285,7 +6285,8 @@ const translations = { levelThreeResult: 'Mensagem removida do canal, além de um aviso anônimo, e a mensagem foi relatada para revisão.', }, actionableMentionWhisperOptions: { - invite: 'Convide-os', + inviteToSubmitExpense: 'Convidar para enviar despesas', + inviteToChat: 'Convidar apenas para conversar', nothing: 'Não faça nada', }, actionableMentionJoinWorkspaceOptions: { diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts index 24cdd88c6d4b1..fd4cee7a3fa3b 100644 --- a/src/languages/zh-hans.ts +++ b/src/languages/zh-hans.ts @@ -6175,8 +6175,9 @@ const translations = { levelThreeResult: '消息已从频道中移除,并收到匿名警告,消息已提交审核。', }, actionableMentionWhisperOptions: { - invite: '邀请他们', - nothing: 'Do nothing', + inviteToSubmitExpense: '邀请提交费用', + inviteToChat: '仅邀请聊天', + nothing: '什么都不做', }, actionableMentionJoinWorkspaceOptions: { accept: '接受', diff --git a/src/libs/API/parameters/ResolveActionableMentionWhisperParams.ts b/src/libs/API/parameters/ResolveActionableMentionWhisperParams.ts index 87dfc934eb5fc..3b6b05910a5be 100644 --- a/src/libs/API/parameters/ResolveActionableMentionWhisperParams.ts +++ b/src/libs/API/parameters/ResolveActionableMentionWhisperParams.ts @@ -3,7 +3,7 @@ import type CONST from '@src/CONST'; type ResolveActionableMentionWhisperParams = { reportActionID: string; - resolution: ValueOf; + resolution: ValueOf | ValueOf; }; export default ResolveActionableMentionWhisperParams; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index ef9f790fb46ec..a4dada3f171f1 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -733,6 +733,12 @@ function isActionableMentionWhisper(reportAction: OnyxEntry): repo return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_MENTION_WHISPER); } +function isActionableMentionInviteToSubmitExpenseConfirmWhisper( + reportAction: OnyxEntry, +): reportAction is ReportAction { + return isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_MENTION_INVITE_TO_SUBMIT_EXPENSE_CONFIRM_WHISPER); +} + /** * Checks if a given report action corresponds to an actionable report mention whisper. * @param reportAction @@ -2986,6 +2992,7 @@ export { isActionableJoinRequest, isActionableJoinRequestPending, isActionableMentionWhisper, + isActionableMentionInviteToSubmitExpenseConfirmWhisper, isActionableReportMentionWhisper, isActionableTrackExpense, isExpenseChatWelcomeWhisper, diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 43c41bb2e0b0d..28e1ebe536a91 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -200,7 +200,7 @@ import {setDownload} from './Download'; import {close} from './Modal'; import navigateFromNotification from './navigateFromNotification'; import {getAll} from './PersistedRequests'; -import {buildAddMembersToWorkspaceOnyxData, buildRoomMembersOnyxData} from './Policy/Member'; +import {addMembersToWorkspace, buildAddMembersToWorkspaceOnyxData, buildRoomMembersOnyxData} from './Policy/Member'; import {createPolicyExpenseChats} from './Policy/Policy'; import { createUpdateCommentMatcher, @@ -4328,10 +4328,37 @@ function clearNewRoomFormError() { function resolveActionableMentionWhisper( reportID: string | undefined, reportAction: OnyxEntry, - resolution: ValueOf, + resolution: ValueOf | ValueOf, + policy?: OnyxEntry, ) { + if (!reportAction || !reportID) { + return; + } + + if (ReportActionsUtils.isActionableMentionWhisper(reportAction) && resolution === CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.INVITE_TO_SUBMIT_EXPENSE) { + const actionOriginalMessage = ReportActionsUtils.getOriginalMessage(reportAction); + + const policyID = policy?.id; + + if (actionOriginalMessage && policyID) { + const currentUserDetails = allPersonalDetails?.[getCurrentUserAccountID()]; + const welcomeNoteSubject = `# ${currentUserDetails?.displayName ?? ''} invited you to ${policy?.name ?? 'a workspace'}`; + const welcomeNote = Localize.translateLocal('workspace.common.welcomeNote'); + const policyMemberAccountIDs = Object.values(getMemberAccountIDsForWorkspace(policy?.employeeList, false, false)); + addMembersToWorkspace( + { + [`${actionOriginalMessage.inviteeEmails?.at(0)}`]: actionOriginalMessage.inviteeAccountIDs?.at(0) ?? CONST.DEFAULT_NUMBER_ID, + }, + `${welcomeNoteSubject}\n\n${welcomeNote}`, + policyID, + policyMemberAccountIDs, + CONST.POLICY.ROLE.USER, + ); + } + } + const message = ReportActionsUtils.getReportActionMessage(reportAction); - if (!message || !reportAction || !reportID) { + if (!message) { return; } @@ -4405,6 +4432,14 @@ function resolveActionableMentionWhisper( API.write(WRITE_COMMANDS.RESOLVE_ACTIONABLE_MENTION_WHISPER, parameters, {optimisticData, failureData}); } +function resolveActionableMentionConfirmWhisper( + reportID: string | undefined, + reportAction: OnyxEntry, + resolution: ValueOf, +) { + resolveActionableMentionWhisper(reportID, reportAction, resolution); +} + function resolveActionableReportMentionWhisper( reportId: string | undefined, reportAction: OnyxEntry, @@ -5864,6 +5899,7 @@ export { removeFromGroupChat, removeFromRoom, resolveActionableMentionWhisper, + resolveActionableMentionConfirmWhisper, resolveActionableReportMentionWhisper, resolveConciergeCategoryOptions, savePrivateNotesDraft, diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 1212765d77245..3d216848b234b 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -55,7 +55,7 @@ import {formatPhoneNumber} from '@libs/LocalePhoneNumber'; import Navigation from '@libs/Navigation/Navigation'; import Permissions from '@libs/Permissions'; import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils'; -import {getCleanedTagName} from '@libs/PolicyUtils'; +import {getCleanedTagName, isPolicyAdmin, isPolicyOwner} from '@libs/PolicyUtils'; import { extractLinksFromMessageHtml, getAddedApprovalRuleMessage, @@ -100,6 +100,7 @@ import { getWorkspaceUpdateFieldMessage, isActionableAddPaymentCard, isActionableJoinRequest, + isActionableMentionInviteToSubmitExpenseConfirmWhisper, isActionableMentionWhisper, isActionableReportMentionWhisper, isActionableTrackExpense, @@ -158,7 +159,7 @@ import variables from '@styles/variables'; import {openPersonalBankAccountSetupView} from '@userActions/BankAccounts'; import {hideEmojiPicker, isActive} from '@userActions/EmojiPickerAction'; import {acceptJoinRequest, declineJoinRequest} from '@userActions/Policy/Member'; -import {expandURLPreview, resolveConciergeCategoryOptions} from '@userActions/Report'; +import {expandURLPreview, resolveActionableMentionConfirmWhisper, resolveConciergeCategoryOptions} from '@userActions/Report'; import type {IgnoreDirection} from '@userActions/ReportActions'; import {isAnonymousUser, signOutAndRedirectToSignIn} from '@userActions/Session'; import {isBlockedFromConcierge} from '@userActions/User'; @@ -325,6 +326,7 @@ type PureReportActionItemProps = { reportId: string | undefined, reportAction: OnyxEntry, resolution: ValueOf, + policy: OnyxEntry, ) => void; /** Whether the provided report is a closed expense report with no expenses */ @@ -359,6 +361,9 @@ type PureReportActionItemProps = { /** Whether to show border for MoneyRequestReportPreviewContent */ shouldShowBorder?: boolean; + + /** Current user's account id */ + currentUserAccountID?: number; }; // This is equivalent to returning a negative boolean in normal functions, but we can keep the element return type @@ -423,6 +428,7 @@ function PureReportActionItem({ dismissTrackExpenseActionableWhisper = () => {}, userBillingFundID, shouldShowBorder, + currentUserAccountID, }: PureReportActionItemProps) { const actionSheetAwareScrollViewContext = useContext(ActionSheetAwareScrollView.ActionSheetAwareScrollViewContext); const {translate, datetimeToCalendarTime} = useLocalize(); @@ -446,7 +452,8 @@ function PureReportActionItem({ const prevDraftMessage = usePrevious(draftMessage); const isReportActionLinked = linkedReportActionID && action.reportActionID && linkedReportActionID === action.reportActionID; const [isReportActionActive, setIsReportActionActive] = useState(!!isReportActionLinked); - const isActionableWhisper = isActionableMentionWhisper(action) || isActionableTrackExpense(action) || isActionableReportMentionWhisper(action); + const isActionableWhisper = + isActionableMentionWhisper(action) || isActionableMentionInviteToSubmitExpenseConfirmWhisper(action) || isActionableTrackExpense(action) || isActionableReportMentionWhisper(action); const isReportArchived = useReportIsArchived(report?.reportID); const highlightedBackgroundColorIfNeeded = useMemo( @@ -801,30 +808,56 @@ function PureReportActionItem({ ]; } - return [ + if (isActionableMentionInviteToSubmitExpenseConfirmWhisper(action)) { + return [ + { + text: 'common.buttonConfirm', + key: `${action.reportActionID}-actionableReportMentionConfirmWhisper-${CONST.REPORT.ACTIONABLE_MENTION_INVITE_TO_SUBMIT_EXPENSE_CONFIRM_WHISPER.DONE}`, + onPress: () => resolveActionableMentionConfirmWhisper(reportID, action, CONST.REPORT.ACTIONABLE_MENTION_INVITE_TO_SUBMIT_EXPENSE_CONFIRM_WHISPER.DONE), + isPrimary: true, + }, + ]; + } + + const actionableMentionWhisperOptions = []; + + if (isPolicyAdmin(policy) || isPolicyOwner(policy, currentUserAccountID)) { + actionableMentionWhisperOptions.push({ + text: 'actionableMentionWhisperOptions.inviteToSubmitExpense', + key: `${action.reportActionID}-actionableMentionWhisper-${CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.INVITE_TO_SUBMIT_EXPENSE}`, + onPress: () => resolveActionableMentionWhisper(reportID, action, CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.INVITE_TO_SUBMIT_EXPENSE, policy), + isMediumSized: true, + }); + } + + actionableMentionWhisperOptions.push( { - text: 'actionableMentionWhisperOptions.invite', + text: 'actionableMentionWhisperOptions.inviteToChat', key: `${action.reportActionID}-actionableMentionWhisper-${CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.INVITE}`, - onPress: () => resolveActionableMentionWhisper(reportID, action, CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.INVITE), - isPrimary: true, + onPress: () => resolveActionableMentionWhisper(reportID, action, CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.INVITE, policy), + isMediumSized: true, }, { text: 'actionableMentionWhisperOptions.nothing', key: `${action.reportActionID}-actionableMentionWhisper-${CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.NOTHING}`, - onPress: () => resolveActionableMentionWhisper(reportID, action, CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.NOTHING), + onPress: () => resolveActionableMentionWhisper(reportID, action, CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.NOTHING, policy), + isMediumSized: true, }, - ]; + ); + return actionableMentionWhisperOptions; }, [ action, + userBillingFundID, isActionableWhisper, + policy, + currentUserAccountID, reportID, - userBillingFundID, + originalReportID, + isBetaEnabled, createDraftTransactionAndNavigateToParticipantSelector, dismissTrackExpenseActionableWhisper, resolveActionableReportMentionWhisper, resolveActionableMentionWhisper, - originalReportID, - isBetaEnabled, ]); /** @@ -1241,7 +1274,7 @@ function PureReportActionItem({ {actionableItemButtons.length > 0 && ( )} diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 43c725bbe05dd..6adb59579e95a 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -53,6 +53,7 @@ function ReportActionItem({allReports, policies, action, report, transactions, s const originalReportID = useMemo(() => getOriginalReportID(reportID, action), [reportID, action]); const originalReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${originalReportID}`]; const isOriginalReportArchived = useReportIsArchived(originalReportID); + const [currentUserAccountID] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false, selector: (session) => session?.accountID}); const [draftMessage] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${originalReportID}`, { canBeMissing: true, selector: (draftMessagesForReport) => { @@ -95,6 +96,7 @@ function ReportActionItem({allReports, policies, action, report, transactions, s action={action} report={report} policy={policy} + currentUserAccountID={currentUserAccountID} draftMessage={draftMessage} iouReport={iouReport} taskReport={taskReport} diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 9671ca610893b..a3b418fc23c4e 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -122,6 +122,9 @@ type OriginalMessageAddComment = { /** Model of `actionable mention whisper` report action */ type OriginalMessageActionableMentionWhisper = { + /** Emails of users that aren't members of the room */ + inviteeEmails: string[]; + /** Account IDs of users that aren't members of the room */ inviteeAccountIDs: number[]; @@ -132,6 +135,18 @@ type OriginalMessageActionableMentionWhisper = { whisperedTo?: number[]; }; +/** Model of `actionable mention whisper` report action */ +type OriginalMessageActionableMentionInviteToSubmitExpenseConfirmWhisper = { + /** Account IDs of users that aren't members of the room */ + inviteeAccountIDs: number[]; + + /** Decision on whether to invite users that were mentioned but aren't members or do nothing */ + resolution?: ValueOf | null; + + /** Collection of accountIDs of users mentioned in message */ + whisperedTo?: number[]; +}; + /** Model of `actionable report mention whisper` report action */ type OriginalMessageActionableReportMentionWhisper = { /** Decision on whether to create a report that were mentioned but doesn't exist or do nothing */ @@ -863,6 +878,7 @@ type OriginalMessageMap = { [CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_ADD_PAYMENT_CARD]: OriginalMessageAddPaymentCard; [CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_JOIN_REQUEST]: OriginalMessageJoinPolicy; [CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_MENTION_WHISPER]: OriginalMessageActionableMentionWhisper; + [CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_MENTION_INVITE_TO_SUBMIT_EXPENSE_CONFIRM_WHISPER]: OriginalMessageActionableMentionInviteToSubmitExpenseConfirmWhisper; [CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_REPORT_MENTION_WHISPER]: OriginalMessageActionableReportMentionWhisper; [CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_TRACK_EXPENSE_WHISPER]: OriginalMessageActionableTrackedExpenseWhisper; [CONST.REPORT.ACTIONS.TYPE.POLICY_EXPENSE_CHAT_WELCOME_WHISPER]: OriginalMessagePolicyExpenseChatWelcomeWhisper; diff --git a/src/types/onyx/ReportAction.ts b/src/types/onyx/ReportAction.ts index 417de849917ad..731e75f6511dc 100644 --- a/src/types/onyx/ReportAction.ts +++ b/src/types/onyx/ReportAction.ts @@ -76,7 +76,11 @@ type Message = { currency?: string; /** resolution for actionable mention whisper */ - resolution?: ValueOf | ValueOf | null; + resolution?: + | ValueOf + | ValueOf + | ValueOf + | null; /** The time this report action was deleted */ deleted?: string; From fac06e5bc0ba0d6c6749af6ea59c1d14b854aece Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Mon, 14 Jul 2025 18:15:24 +0530 Subject: [PATCH 2/4] Only show submit expenses button on expenseReports --- src/pages/home/report/PureReportActionItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 3d216848b234b..b4f612a6b19f9 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -821,7 +821,7 @@ function PureReportActionItem({ const actionableMentionWhisperOptions = []; - if (isPolicyAdmin(policy) || isPolicyOwner(policy, currentUserAccountID)) { + if (isExpenseReport(report) && (isPolicyAdmin(policy) || isPolicyOwner(policy, currentUserAccountID))) { actionableMentionWhisperOptions.push({ text: 'actionableMentionWhisperOptions.inviteToSubmitExpense', key: `${action.reportActionID}-actionableMentionWhisper-${CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.INVITE_TO_SUBMIT_EXPENSE}`, From 17463b6d4890c8ce7545f4fed819a65819097058 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Mon, 14 Jul 2025 19:09:42 +0530 Subject: [PATCH 3/4] Fix conditions --- src/pages/home/report/PureReportActionItem.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index b4f612a6b19f9..69603581f97d0 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -55,7 +55,7 @@ import {formatPhoneNumber} from '@libs/LocalePhoneNumber'; import Navigation from '@libs/Navigation/Navigation'; import Permissions from '@libs/Permissions'; import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils'; -import {getCleanedTagName, isPolicyAdmin, isPolicyOwner} from '@libs/PolicyUtils'; +import {getCleanedTagName, getPersonalPolicy, isPolicyAdmin, isPolicyOwner} from '@libs/PolicyUtils'; import { extractLinksFromMessageHtml, getAddedApprovalRuleMessage, @@ -148,6 +148,7 @@ import { isChatThread, isCompletedTaskReport, isExpenseReport, + isPolicyRelatedReport, isTaskReport, shouldDisplayThreadReplies as shouldDisplayThreadRepliesUtils, } from '@libs/ReportUtils'; @@ -820,8 +821,9 @@ function PureReportActionItem({ } const actionableMentionWhisperOptions = []; + const isReportInPolicy = !!report?.policyID && report.policyID !== CONST.POLICY.ID_FAKE && getPersonalPolicy()?.id !== report.policyID; - if (isExpenseReport(report) && (isPolicyAdmin(policy) || isPolicyOwner(policy, currentUserAccountID))) { + if (isReportInPolicy && (isPolicyAdmin(policy) || isPolicyOwner(policy, currentUserAccountID))) { actionableMentionWhisperOptions.push({ text: 'actionableMentionWhisperOptions.inviteToSubmitExpense', key: `${action.reportActionID}-actionableMentionWhisper-${CONST.REPORT.ACTIONABLE_MENTION_WHISPER_RESOLUTION.INVITE_TO_SUBMIT_EXPENSE}`, From 6209a7137f6cc345e627cc5a87158f2ac50f0233 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Mon, 14 Jul 2025 19:10:12 +0530 Subject: [PATCH 4/4] Remove unused --- src/pages/home/report/PureReportActionItem.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/home/report/PureReportActionItem.tsx b/src/pages/home/report/PureReportActionItem.tsx index 69603581f97d0..81d9d658040d5 100644 --- a/src/pages/home/report/PureReportActionItem.tsx +++ b/src/pages/home/report/PureReportActionItem.tsx @@ -148,7 +148,6 @@ import { isChatThread, isCompletedTaskReport, isExpenseReport, - isPolicyRelatedReport, isTaskReport, shouldDisplayThreadReplies as shouldDisplayThreadRepliesUtils, } from '@libs/ReportUtils';