Skip to content

Commit

Permalink
move welcomeSubject to invite message page
Browse files Browse the repository at this point in the history
  • Loading branch information
dukenv0307 committed Apr 10, 2024
1 parent ee6c5c8 commit 8748826
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
2 changes: 0 additions & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2153,8 +2153,6 @@ export default {
personalMessagePrompt: 'Message',
genericFailureMessage: 'An error occurred inviting the user to the workspace, please try again.',
inviteNoMembersError: 'Please select at least one member to invite',
welcomeNote: ({inviterDisplayName, workspaceName, inviteMessage}: WelcomeNoteParams) =>
`# ${inviterDisplayName} invited you to ${workspaceName || 'a workspace'}\n\n${inviteMessage}`,
},
distanceRates: {
oopsNotSoFast: 'Oops! Not so fast...',
Expand Down
2 changes: 0 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2181,8 +2181,6 @@ export default {
personalMessagePrompt: 'Mensaje',
inviteNoMembersError: 'Por favor, selecciona al menos un miembro a invitar',
genericFailureMessage: 'Se produjo un error al invitar al usuario al espacio de trabajo. Vuelva a intentarlo..',
welcomeNote: ({inviterDisplayName, workspaceName, inviteMessage}: WelcomeNoteParams) =>
`# ${inviterDisplayName} invited you to ${workspaceName || 'a workspace'}\n\n${inviteMessage}`,
},
distanceRates: {
oopsNotSoFast: 'Ups! No tan rápido...',
Expand Down
2 changes: 1 addition & 1 deletion src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ type UserIsAlreadyMemberParams = {login: string; name: string};

type GoToRoomParams = {roomName: string};

type WelcomeNoteParams = {workspaceName: string; inviterDisplayName?: string; inviteMessage?: string};
type WelcomeNoteParams = {workspaceName: string};

type RoomNameReservedErrorParams = {reservedName: string};

Expand Down
14 changes: 4 additions & 10 deletions src/pages/workspace/WorkspaceInviteMessagePage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {StackScreenProps} from '@react-navigation/stack';
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import lodashDebounce from 'lodash/debounce';
import React, {useEffect, useState} from 'react';
import React, {useEffect, useMemo, useState} from 'react';
import {Keyboard, View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
Expand Down Expand Up @@ -73,6 +73,8 @@ function WorkspaceInviteMessagePage({

const {inputCallbackRef} = useAutoFocusInput();

const welcomeNoteSubject = useMemo(() => `# ${currentUserPersonalDetails?.displayName ?? ''} invited you to ${policy?.name ?? 'a workspace'}`, [policy?.name, currentUserPersonalDetails?.displayName]);

const getDefaultWelcomeNote = () =>
// workspaceInviteMessageDraft can be an empty string
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Expand Down Expand Up @@ -102,15 +104,7 @@ function WorkspaceInviteMessagePage({
const sendInvitation = () => {
Keyboard.dismiss();
// Please see https://github.com/Expensify/App/blob/main/README.md#Security for more details
Policy.addMembersToWorkspace(
invitedEmailsToAccountIDsDraft ?? {},
translate('workspace.inviteMessage.welcomeNote', {
workspaceName: policy?.name ?? '',
inviterDisplayName: currentUserPersonalDetails?.displayName ?? '',
inviteMessage: welcomeNote ?? '',
}),
route.params.policyID,
);
Policy.addMembersToWorkspace(invitedEmailsToAccountIDsDraft ?? {}, `${welcomeNoteSubject}\n\n${welcomeNote}`, route.params.policyID);
debouncedSaveDraft(null);
SearchInputManager.searchInput = '';
// Pop the invite message page before navigating to the members page.
Expand Down
5 changes: 0 additions & 5 deletions src/types/onyx/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,6 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback<

/** Indicates if the Policy ownership change is failed */
isChangeOwnerFailed?: boolean;

/** The welcomeNote of user */
welcomeNote?: {
user: string;
};
} & Partial<PendingJoinRequestPolicy>,
'generalSettings' | 'addWorkspaceRoom' | keyof ACHAccount
>;
Expand Down

0 comments on commit 8748826

Please sign in to comment.