Skip to content

Commit 80ca441

Browse files
committed
Adjust to review comments
1 parent 56e6d83 commit 80ca441

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/languages/en.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2955,9 +2955,9 @@ const translations = {
29552955
ticketVoided: ({airlineCode, origin, destination, startDate}: FlightParams) =>
29562956
`Your ticket for flight ${airlineCode} (${origin}${destination}) on ${startDate} has been voided.`,
29572957
ticketRefunded: ({airlineCode, origin, destination, startDate}: FlightParams) =>
2958-
`Your ticket for flight ${airlineCode} (${origin}${destination}) on ${startDate} has been refunded or exchange.`,
2958+
`Your ticket for flight ${airlineCode} (${origin}${destination}) on ${startDate} has been refunded or exchanged.`,
29592959
flightCancelled: ({airlineCode, origin, destination, startDate}: FlightParams) =>
2960-
`Your flight ${airlineCode} (${origin}${destination}) on ${startDate}} has been canceled by the airline`,
2960+
`Your flight ${airlineCode} (${origin}${destination}) on ${startDate}} has been canceled by the airline.`,
29612961
flightScheduleChangePending: ({airlineCode}: AirlineParams) => `The airline has proposed a schedule change for flight ${airlineCode}; we are awaiting confirmation.`,
29622962
flightScheduleChangeClosed: ({airlineCode, startDate}: AirlineParams) => `Schedule change confirmed: flight ${airlineCode} now departs at ${startDate}.`,
29632963
flightChanged: ({airlineCode, origin, destination, startDate}: FlightParams) => `Your flight ${airlineCode} (${origin}${destination}) on ${startDate} has been changed.`,
@@ -2975,6 +2975,7 @@ const translations = {
29752975
railTicketExchange: ({origin, destination, startDate}: RailTicketParams) => `Your rail ticket for ${origin}${destination} on ${startDate} has been exchanged.`,
29762976
railTicketUpdate: ({origin, destination, startDate}: RailTicketParams) => `Your rail ticket for ${origin}${destination} on ${startDate} has been updated.`,
29772977
defaultUpdate: ({type}: TravelTypeParams) => `Your ${type} reservation was updated.`,
2978+
notSupported: 'Not supported travel update.',
29782979
},
29792980
},
29802981
workspace: {

src/languages/es.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2999,6 +2999,7 @@ const translations = {
29992999
railTicketExchange: ({origin, destination, startDate}: RailTicketParams) => `Tu billete de tren de ${origin} a ${destination} para el ${startDate} ha sido cambiado.`,
30003000
railTicketUpdate: ({origin, destination, startDate}: RailTicketParams) => `Tu billete de tren de ${origin} a ${destination} para el ${startDate} ha sido actualizado.`,
30013001
defaultUpdate: ({type}: TravelTypeParams) => `Tu reserva de ${type} fue actualizada.`,
3002+
notSupported: 'Actualización de viaje no admitida.',
30023003
},
30033004
},
30043005
workspace: {

src/libs/ReportActionsUtils.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type {TranslationPaths} from '@src/languages/types';
1212
import ONYXKEYS from '@src/ONYXKEYS';
1313
import ROUTES from '@src/ROUTES';
1414
import type {Card, Locale, OnyxInputOrEntry, OriginalMessageIOU, PrivatePersonalDetails} from '@src/types/onyx';
15-
import type {JoinWorkspaceResolution, OriginalMessageChangeLog, OriginalMessageExportIntegration, OriginalMessageTravelUpdate} from '@src/types/onyx/OriginalMessage';
15+
import type {JoinWorkspaceResolution, OriginalMessageChangeLog, OriginalMessageExportIntegration} from '@src/types/onyx/OriginalMessage';
1616
import type {PolicyReportFieldType} from '@src/types/onyx/Policy';
1717
import type Report from '@src/types/onyx/Report';
1818
import type ReportAction from '@src/types/onyx/ReportAction';
@@ -1531,7 +1531,11 @@ function getMessageOfOldDotReportAction(oldDotAction: PartialReportAction | OldD
15311531
}
15321532

15331533
function getTravelUpdateMessage(action: ReportAction, formatDate?: (datetime: string, includeTimezone: boolean, isLowercase?: boolean | undefined) => string) {
1534-
const details = getOriginalMessage(action) as OriginalMessageTravelUpdate;
1534+
const details = isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.TRAVEL_UPDATE) ? getOriginalMessage(action) : undefined;
1535+
if (!details) {
1536+
return translateLocal('travel.updates.notSupported');
1537+
}
1538+
15351539
const formattedStartDate = formatDate?.(details.start.date, false) ?? format(details.start.date, CONST.DATE.FNS_DATE_TIME_FORMAT_STRING);
15361540

15371541
switch (details?.operation) {
@@ -1688,7 +1692,9 @@ function getTravelUpdateMessage(action: ReportAction, formatDate?: (datetime: st
16881692
});
16891693

16901694
default:
1691-
return 'Trip was updated';
1695+
return translateLocal('travel.updates.defaultUpdate', {
1696+
type: details.type,
1697+
});
16921698
}
16931699
}
16941700

src/types/onyx/OriginalMessage.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,5 +869,4 @@ export type {
869869
OriginalMessageChangePolicy,
870870
OriginalMessageUnreportedTransaction,
871871
OriginalMessageMovedTransaction,
872-
OriginalMessageTravelUpdate,
873872
};

0 commit comments

Comments
 (0)