@@ -55,7 +55,7 @@ import {formatPhoneNumber} from '@libs/LocalePhoneNumber';
5555import Navigation from '@libs/Navigation/Navigation' ;
5656import Permissions from '@libs/Permissions' ;
5757import { getDisplayNameOrDefault } from '@libs/PersonalDetailsUtils' ;
58- import { getCleanedTagName } from '@libs/PolicyUtils' ;
58+ import { getCleanedTagName , isPolicyAdmin , isPolicyOwner } from '@libs/PolicyUtils' ;
5959import {
6060 extractLinksFromMessageHtml ,
6161 getAddedApprovalRuleMessage ,
@@ -358,6 +358,9 @@ type PureReportActionItemProps = {
358358
359359 /** Whether to show border for MoneyRequestReportPreviewContent */
360360 shouldShowBorder ?: boolean ;
361+
362+ /** Current user's account id */
363+ currentUserAccountID ?: number ;
361364} ;
362365
363366// This is equivalent to returning a negative boolean in normal functions, but we can keep the element return type
@@ -421,6 +424,7 @@ function PureReportActionItem({
421424 userBillingFundID,
422425 policies,
423426 shouldShowBorder,
427+ currentUserAccountID,
424428} : PureReportActionItemProps ) {
425429 const actionSheetAwareScrollViewContext = useContext ( ActionSheetAwareScrollView . ActionSheetAwareScrollViewContext ) ;
426430 const { translate, datetimeToCalendarTime} = useLocalize ( ) ;
@@ -811,13 +815,18 @@ function PureReportActionItem({
811815 ] ;
812816 }
813817
814- return [
815- {
818+ const actionableMentionWhisperOptions = [ ] ;
819+
820+ if ( isPolicyAdmin ( policy ) || isPolicyOwner ( policy , currentUserAccountID ) ) {
821+ actionableMentionWhisperOptions . push ( {
816822 text : 'actionableMentionWhisperOptions.inviteToSubmitExpense' ,
817823 key : `${ action . reportActionID } -actionableMentionWhisper-${ CONST . REPORT . ACTIONABLE_MENTION_WHISPER_RESOLUTION . INVITE_TO_SUBMIT_EXPENSE } ` ,
818824 onPress : ( ) => resolveActionableMentionWhisper ( reportID , action , CONST . REPORT . ACTIONABLE_MENTION_WHISPER_RESOLUTION . INVITE_TO_SUBMIT_EXPENSE , policy ) ,
819825 isMediumSized : true ,
820- } ,
826+ } ) ;
827+ }
828+
829+ actionableMentionWhisperOptions . push (
821830 {
822831 text : 'actionableMentionWhisperOptions.inviteToChat' ,
823832 key : `${ action . reportActionID } -actionableMentionWhisper-${ CONST . REPORT . ACTIONABLE_MENTION_WHISPER_RESOLUTION . INVITE } ` ,
@@ -830,19 +839,21 @@ function PureReportActionItem({
830839 onPress : ( ) => resolveActionableMentionWhisper ( reportID , action , CONST . REPORT . ACTIONABLE_MENTION_WHISPER_RESOLUTION . NOTHING , policy ) ,
831840 isMediumSized : true ,
832841 } ,
833- ] ;
842+ ) ;
843+ return actionableMentionWhisperOptions ;
834844 } , [
835845 action ,
836846 userBillingFundID ,
837847 isActionableWhisper ,
848+ policy ,
849+ currentUserAccountID ,
838850 reportID ,
839851 originalReportID ,
840852 isBetaEnabled ,
841853 createDraftTransactionAndNavigateToParticipantSelector ,
842854 dismissTrackExpenseActionableWhisper ,
843855 resolveActionableReportMentionWhisper ,
844856 resolveActionableMentionWhisper ,
845- policy ,
846857 ] ) ;
847858
848859 /**
0 commit comments