Skip to content

Commit 4bcdc7e

Browse files
authored
Merge pull request #54987 from nkdengineer/fix/54397
fix: System message is shown in English
2 parents 6a8125d + caf7cfe commit 4bcdc7e

File tree

7 files changed

+42
-8
lines changed

7 files changed

+42
-8
lines changed

src/languages/en.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4607,6 +4607,8 @@ const translations = {
46074607
other: `removed you from ${joinedNames}'s approval workflows and workspace chats. Previously submitted reports will remain available for approval in your Inbox.`,
46084608
};
46094609
},
4610+
upgradedWorkspace: 'upgraded this workspace to the Control plan',
4611+
downgradedWorkspace: 'downgraded this workspace to the Collect plan',
46104612
},
46114613
roomMembersPage: {
46124614
memberNotFound: 'Member not found.',

src/languages/es.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4655,6 +4655,8 @@ const translations = {
46554655
other: `te eliminó de los flujos de trabajo de aprobaciones y de los chats del espacio de trabajo de ${joinedNames}. Los informes enviados anteriormente seguirán estando disponibles para su aprobación en tu bandeja de entrada.`,
46564656
};
46574657
},
4658+
upgradedWorkspace: 'mejoró este espacio de trabajo al plan Controlar',
4659+
downgradedWorkspace: 'bajó de categoría este espacio de trabajo al plan Recopilar',
46584660
},
46594661
roomMembersPage: {
46604662
memberNotFound: 'Miembro no encontrado.',

src/libs/OptionsListUtils.ts

+4
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,10 @@ function getLastMessageTextForReport(report: OnyxEntry<Report>, lastActorDetails
599599
}
600600
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
601601
lastMessageTextFromReport = ReportUtils.getRejectedReportMessage();
602+
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.CORPORATE_UPGRADE) {
603+
lastMessageTextFromReport = ReportUtils.getUpgradeWorkspaceMessage();
604+
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.TEAM_DOWNGRADE) {
605+
lastMessageTextFromReport = ReportUtils.getDowngradeWorkspaceMessage();
602606
} else if (ReportActionUtils.isActionableAddPaymentCard(lastReportAction)) {
603607
lastMessageTextFromReport = ReportActionUtils.getReportActionMessageText(lastReportAction);
604608
} else if (lastReportAction?.actionName === 'EXPORTINTEGRATION') {

src/libs/ReportUtils.ts

+16
Original file line numberDiff line numberDiff line change
@@ -4063,6 +4063,12 @@ function getReportName(
40634063
if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
40644064
return getRejectedReportMessage();
40654065
}
4066+
if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.CORPORATE_UPGRADE) {
4067+
return getUpgradeWorkspaceMessage();
4068+
}
4069+
if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.TEAM_DOWNGRADE) {
4070+
return getDowngradeWorkspaceMessage();
4071+
}
40664072
if (ReportActionsUtils.isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.APPROVED)) {
40674073
const {automaticAction} = ReportActionsUtils.getOriginalMessage(parentReportAction) ?? {};
40684074
if (automaticAction) {
@@ -4954,6 +4960,14 @@ function getRejectedReportMessage() {
49544960
return Localize.translateLocal('iou.rejectedThisReport');
49554961
}
49564962

4963+
function getUpgradeWorkspaceMessage() {
4964+
return Localize.translateLocal('workspaceActions.upgradedWorkspace');
4965+
}
4966+
4967+
function getDowngradeWorkspaceMessage() {
4968+
return Localize.translateLocal('workspaceActions.downgradedWorkspace');
4969+
}
4970+
49574971
function getWorkspaceNameUpdatedMessage(action: ReportAction) {
49584972
const {oldName, newName} = ReportActionsUtils.getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME>) ?? {};
49594973
const message = oldName && newName ? Localize.translateLocal('workspaceActions.renamedWorkspaceNameAction', {oldName, newName}) : ReportActionsUtils.getReportActionText(action);
@@ -8788,6 +8802,8 @@ export {
87888802
getIOUForwardedMessage,
87898803
getRejectedReportMessage,
87908804
getWorkspaceNameUpdatedMessage,
8805+
getUpgradeWorkspaceMessage,
8806+
getDowngradeWorkspaceMessage,
87918807
getReportAutomaticallySubmittedMessage,
87928808
getIOUSubmittedMessage,
87938809
getIcons,

src/libs/actions/Report.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1363,8 +1363,8 @@ function readNewestAction(reportID: string | undefined, shouldResetUnreadMarker
13631363
/**
13641364
* Sets the last read time on a report
13651365
*/
1366-
function markCommentAsUnread(reportID: string, reportActionCreated: string) {
1367-
if (reportID === '-1') {
1366+
function markCommentAsUnread(reportID: string | undefined, reportActionCreated: string) {
1367+
if (!reportID) {
13681368
Log.warn('7339cd6c-3263-4f89-98e5-730f0be15784 Invalid report passed to MarkCommentAsUnread. Not calling the API because it wil fail.');
13691369
return;
13701370
}

src/pages/home/report/ContextMenu/ContextMenuActions.tsx

+12-6
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ const ContextMenuActions: ContextMenuAction[] = [
193193
// is false, so we need to pass true here to override this condition.
194194
ReportActionComposeFocusManager.focus(true);
195195
});
196-
Report.navigateToAndOpenChildReport(reportAction?.childReportID ?? '-1', reportAction, originalReportID);
196+
Report.navigateToAndOpenChildReport(reportAction?.childReportID, reportAction, originalReportID);
197197
});
198198
return;
199199
}
200-
Report.navigateToAndOpenChildReport(reportAction?.childReportID ?? '-1', reportAction, originalReportID);
200+
Report.navigateToAndOpenChildReport(reportAction?.childReportID, reportAction, originalReportID);
201201
},
202202
getDescription: () => {},
203203
},
@@ -208,7 +208,7 @@ const ContextMenuActions: ContextMenuAction[] = [
208208
successIcon: Expensicons.Checkmark,
209209
shouldShow: ({type, isUnreadChat}) => type === CONST.CONTEXT_MENU_TYPES.REPORT_ACTION || (type === CONST.CONTEXT_MENU_TYPES.REPORT && !isUnreadChat),
210210
onPress: (closePopover, {reportAction, reportID}) => {
211-
const originalReportID = ReportUtils.getOriginalReportID(reportID, reportAction) ?? '-1';
211+
const originalReportID = ReportUtils.getOriginalReportID(reportID, reportAction);
212212
Report.markCommentAsUnread(originalReportID, reportAction?.created);
213213
if (closePopover) {
214214
hideContextMenu(true, ReportActionComposeFocusManager.focus);
@@ -239,7 +239,7 @@ const ContextMenuActions: ContextMenuAction[] = [
239239
onPress: (closePopover, {reportID, reportAction, draftMessage}) => {
240240
if (ReportActionsUtils.isMoneyRequestAction(reportAction)) {
241241
hideContextMenu(false);
242-
const childReportID = reportAction?.childReportID ?? '-1';
242+
const childReportID = `${reportAction?.childReportID ?? CONST.DEFAULT_NUMBER_ID}`;
243243
Report.openReport(childReportID);
244244
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(childReportID));
245245
return;
@@ -324,13 +324,13 @@ const ContextMenuActions: ContextMenuAction[] = [
324324
if (closePopover) {
325325
hideContextMenu(false, () => {
326326
ReportActionComposeFocusManager.focus();
327-
Report.toggleSubscribeToChildReport(reportAction?.childReportID ?? '-1', reportAction, originalReportID, childReportNotificationPreference);
327+
Report.toggleSubscribeToChildReport(reportAction?.childReportID, reportAction, originalReportID, childReportNotificationPreference);
328328
});
329329
return;
330330
}
331331

332332
ReportActionComposeFocusManager.focus();
333-
Report.toggleSubscribeToChildReport(reportAction?.childReportID ?? '-1', reportAction, originalReportID, childReportNotificationPreference);
333+
Report.toggleSubscribeToChildReport(reportAction?.childReportID, reportAction, originalReportID, childReportNotificationPreference);
334334
},
335335
getDescription: () => {},
336336
},
@@ -451,6 +451,12 @@ const ContextMenuActions: ContextMenuAction[] = [
451451
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
452452
const displayMessage = ReportUtils.getRejectedReportMessage();
453453
Clipboard.setString(displayMessage);
454+
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.CORPORATE_UPGRADE) {
455+
const displayMessage = ReportUtils.getUpgradeWorkspaceMessage();
456+
Clipboard.setString(displayMessage);
457+
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.TEAM_DOWNGRADE) {
458+
const displayMessage = ReportUtils.getDowngradeWorkspaceMessage();
459+
Clipboard.setString(displayMessage);
454460
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) {
455461
Clipboard.setString(Localize.translateLocal('iou.heldExpense'));
456462
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) {

src/pages/home/report/PureReportActionItem.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,10 @@ function PureReportActionItem({
806806
}
807807
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
808808
children = <ReportActionItemBasicMessage message={translate('iou.rejectedThisReport')} />;
809+
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.CORPORATE_UPGRADE) {
810+
children = <ReportActionItemBasicMessage message={translate('workspaceActions.upgradedWorkspace')} />;
811+
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.TEAM_DOWNGRADE) {
812+
children = <ReportActionItemBasicMessage message={translate('workspaceActions.downgradedWorkspace')} />;
809813
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) {
810814
children = <ReportActionItemBasicMessage message={translate('iou.heldExpense')} />;
811815
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD_COMMENT) {

0 commit comments

Comments
 (0)