@@ -12,14 +12,12 @@ import InviteMemberListItem from '@components/SelectionListWithSections/InviteMe
1212import type { Section } from '@components/SelectionListWithSections/types' ;
1313import withNavigationTransitionEnd from '@components/withNavigationTransitionEnd' ;
1414import type { WithNavigationTransitionEndProps } from '@components/withNavigationTransitionEnd' ;
15- import useAncestors from '@hooks/useAncestors' ;
16- import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' ;
1715import useDebouncedState from '@hooks/useDebouncedState' ;
1816import useLocalize from '@hooks/useLocalize' ;
1917import useOnyx from '@hooks/useOnyx' ;
2018import useReportIsArchived from '@hooks/useReportIsArchived' ;
2119import useThemeStyles from '@hooks/useThemeStyles' ;
22- import { inviteToRoomAction , searchInServer } from '@libs/actions/Report' ;
20+ import { inviteToRoom , searchInServer } from '@libs/actions/Report' ;
2321import { clearUserSearchPhrase , updateUserSearchPhrase } from '@libs/actions/RoomMembersUserSearchPhrase' ;
2422import { READ_COMMANDS } from '@libs/API/types' ;
2523import { canUseTouchScreen } from '@libs/DeviceCapabilities' ;
@@ -57,14 +55,13 @@ function RoomInvitePage({
5755 } ,
5856} : RoomInvitePageProps ) {
5957 const styles = useThemeStyles ( ) ;
60- const { translate} = useLocalize ( ) ;
58+ const { translate, formatPhoneNumber } = useLocalize ( ) ;
6159 const [ userSearchPhrase ] = useOnyx ( ONYXKEYS . ROOM_MEMBERS_USER_SEARCH_PHRASE , { canBeMissing : true } ) ;
6260 const [ countryCode = CONST . DEFAULT_COUNTRY_CODE ] = useOnyx ( ONYXKEYS . COUNTRY_CODE , { canBeMissing : false } ) ;
6361 const [ searchTerm , debouncedSearchTerm , setSearchTerm ] = useDebouncedState ( userSearchPhrase ?? '' ) ;
6462 const [ selectedOptions , setSelectedOptions ] = useState < OptionData [ ] > ( [ ] ) ;
6563 const [ isSearchingForReports ] = useOnyx ( ONYXKEYS . IS_SEARCHING_FOR_REPORTS , { initWithStoredValues : false , canBeMissing : true } ) ;
6664 const isReportArchived = useReportIsArchived ( report . reportID ) ;
67- const currentUserPersonalDetails = useCurrentUserPersonalDetails ( ) ;
6865 const [ nvpDismissedProductTraining ] = useOnyx ( ONYXKEYS . NVP_DISMISSED_PRODUCT_TRAINING , { canBeMissing : true } ) ;
6966
7067 const { options, areOptionsInitialized} = useOptionsList ( ) ;
@@ -195,9 +192,6 @@ function RoomInvitePage({
195192 return reportID && ( ! isPolicyEmployee || isReportArchived ? ROUTES . REPORT_WITH_ID_DETAILS . getRoute ( reportID , backTo ) : ROUTES . ROOM_MEMBERS . getRoute ( reportID , backTo ) ) ;
196193 } , [ isPolicyEmployee , reportID , backTo , isReportArchived ] ) ;
197194 const reportName = useMemo ( ( ) => getReportName ( report ) , [ report ] ) ;
198-
199- const ancestors = useAncestors ( report ) ;
200-
201195 const inviteUsers = useCallback ( ( ) => {
202196 HttpUtils . cancelPendingRequests ( READ_COMMANDS . SEARCH_FOR_REPORTS ) ;
203197
@@ -214,15 +208,11 @@ function RoomInvitePage({
214208 invitedEmailsToAccountIDs [ login ] = Number ( accountID ) ;
215209 }
216210 if ( reportID ) {
217- inviteToRoomAction ( reportID , ancestors , invitedEmailsToAccountIDs , currentUserPersonalDetails . timezone ?? CONST . DEFAULT_TIME_ZONE ) ;
218- clearUserSearchPhrase ( ) ;
219- if ( backTo ) {
220- Navigation . goBack ( backTo ) ;
221- } else {
222- Navigation . goBack ( ROUTES . REPORT_WITH_ID . getRoute ( reportID ) ) ;
223- }
211+ inviteToRoom ( reportID , invitedEmailsToAccountIDs , formatPhoneNumber ) ;
224212 }
225- } , [ validate , selectedOptions , ancestors , reportID , currentUserPersonalDetails . timezone , backTo ] ) ;
213+ clearUserSearchPhrase ( ) ;
214+ Navigation . goBack ( backRoute ) ;
215+ } , [ selectedOptions , backRoute , reportID , validate , formatPhoneNumber ] ) ;
226216
227217 const goBack = useCallback ( ( ) => {
228218 Navigation . goBack ( backRoute ) ;
0 commit comments