Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show correct message when disconnecting quickbooks desktop #49834

Merged
merged 14 commits into from
Oct 1, 2024
Prev Previous commit
Next Next commit
fix: update connectionName
  • Loading branch information
daledah committed Sep 30, 2024
commit 2d5efb259da5207c4165f18a9ee4394435ab56c5
3 changes: 1 addition & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
AddEmployeeParams,
AddressLineParams,
AdminCanceledRequestParams,
AllConnectionNameParams,
AlreadySignedInParams,
ApprovalWorkflowErrorParams,
ApprovedAmountParams,
Expand Down Expand Up @@ -4271,7 +4270,7 @@ const translations = {
addEmployee: ({email, role}: AddEmployeeParams) => `added ${email} as ${role === 'user' ? 'member' : 'admin'}`,
updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `updated the role of ${email} from ${currentRole} to ${newRole}`,
removeMember: ({email, role}: AddEmployeeParams) => `removed ${role} ${email}`,
removedConnection: ({connectionName}: AllConnectionNameParams) => `Removed connection to ${connectionName}.`,
removedConnection: ({connectionName}: ConnectionNameParams) => `Removed connection to ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}.`,
},
},
},
Expand Down
3 changes: 1 addition & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type {
AddEmployeeParams,
AddressLineParams,
AdminCanceledRequestParams,
AllConnectionNameParams,
AlreadySignedInParams,
ApprovalWorkflowErrorParams,
ApprovedAmountParams,
Expand Down Expand Up @@ -4317,7 +4316,7 @@ const translations = {
updateRole: ({email, currentRole, newRole}: UpdateRoleParams) =>
`actualicé el rol ${email} de ${currentRole === 'user' ? 'miembro' : 'administrador'} a ${newRole === 'user' ? 'miembro' : 'administrador'}`,
removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role === 'user' ? 'miembro' : 'administrador'} ${email}`,
removedConnection: ({connectionName}: AllConnectionNameParams) => `Conexión eliminada a ${connectionName}.`,
removedConnection: ({connectionName}: ConnectionNameParams) => `Conexión eliminada a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}.`,
},
},
},
Expand Down
9 changes: 2 additions & 7 deletions src/languages/params.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {OnyxInputOrEntry, ReportAction} from '@src/types/onyx';
import type {DelegateRole} from '@src/types/onyx/Account';
import type {ConnectionName, PolicyConnectionSyncStage, SageIntacctMappingName, Unit} from '@src/types/onyx/Policy';
import type {AllConnectionName, ConnectionName, PolicyConnectionSyncStage, SageIntacctMappingName, Unit} from '@src/types/onyx/Policy';
import type {ViolationDataType} from '@src/types/onyx/TransactionViolation';

type AddressLineParams = {
Expand Down Expand Up @@ -338,11 +338,7 @@ type ApprovalWorkflowErrorParams = {
};

type ConnectionNameParams = {
connectionName: ConnectionName;
};

type AllConnectionNameParams = {
connectionName: string;
connectionName: AllConnectionName;
};

type LastSyncDateParams = {
Expand Down Expand Up @@ -734,5 +730,4 @@ export type {
CharacterLengthLimitParams,
OptionalParam,
AssignCardParams,
AllConnectionNameParams,
};
4 changes: 2 additions & 2 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1727,8 +1727,8 @@ function getRemovedConnectionMessage(reportAction: OnyxEntry<ReportAction>): str
return '';
}
const originalMessage = getOriginalMessage(reportAction);
const connectionName = originalMessage?.connectionName ?? '';
return Localize.translateLocal('report.actions.type.removedConnection', {connectionName});
const connectionName = originalMessage?.connectionName;
return connectionName ? Localize.translateLocal('report.actions.type.removedConnection', {connectionName}) : '';
}

function getRenamedAction(reportAction: OnyxEntry<ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.RENAMED>>) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ const ContextMenuActions: ContextMenuAction[] = [
setClipboardMessage(Localize.translateLocal('report.actions.type.integrationSyncFailed', {label, errorMessage}));
} else if (ReportActionsUtils.isCardIssuedAction(reportAction)) {
setClipboardMessage(ReportActionsUtils.getCardIssuedMessage(reportAction, true));
} else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) {
} else if (ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) {
setClipboardMessage(ReportActionsUtils.getRemovedConnectionMessage(reportAction));
} else if (content) {
setClipboardMessage(
Expand Down
3 changes: 2 additions & 1 deletion src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import type CONST from '@src/CONST';
import type DeepValueOf from '@src/types/utils/DeepValueOf';
import type {OldDotOriginalMessageMap} from './OldDotAction';
import {AllConnectionName} from './Policy';

Check failure on line 5 in src/types/onyx/OriginalMessage.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

All imports in the declaration are only used as types. Use `import type`
import type ReportActionName from './ReportActionName';

/** Types of join workspace resolutions */
Expand Down Expand Up @@ -273,7 +274,7 @@
oldValue?: string;

/** Name of connection */
connectionName?: string;
connectionName?: AllConnectionName;
};

/** Model of `join policy changelog` report action */
Expand Down
9 changes: 9 additions & 0 deletions src/types/onyx/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1232,9 +1232,17 @@
[CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT]: Connection<SageIntacctConnectionData, SageIntacctConnectionsConfig>;
};

type AllConnections = Connections & {

Check failure on line 1235 in src/types/onyx/Policy.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Missing JSDoc comment
/** Quickbooks Desktop integration connection*/

Check failure on line 1236 in src/types/onyx/Policy.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Expected space or tab before '*/' in comment
quickbooksDesktop: any;

Check failure on line 1237 in src/types/onyx/Policy.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unexpected any. Specify a different type
};

/** Names of integration connections */
type ConnectionName = keyof Connections;

/** Names of all integration connections */
type AllConnectionName = keyof AllConnections;

/** Merchant Category Code. This is a way to identify the type of merchant (and type of spend) when a credit card is swiped. */
type MccGroup = {
/** Default category for provided MCC Group */
Expand Down Expand Up @@ -1728,6 +1736,7 @@
Connections,
SageIntacctOfflineStateKeys,
ConnectionName,
AllConnectionName,
Tenant,
Account,
QBONonReimbursableExportAccountType,
Expand Down
Loading