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: System message is shown in English #54987

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4607,6 +4607,8 @@ const translations = {
other: `removed you from ${joinedNames}'s approval workflows and workspace chats. Previously submitted reports will remain available for approval in your Inbox.`,
};
},
upgradedWorkspace: 'upgraded this workspace to the Control plan',
downgradedWorkspace: 'downgraded this workspace to the Collect plan',
},
roomMembersPage: {
memberNotFound: 'Member not found.',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4655,6 +4655,8 @@ const translations = {
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.`,
};
},
upgradedWorkspace: 'mejoró este espacio de trabajo al plan Controlar',
downgradedWorkspace: 'bajó de categoría este espacio de trabajo al plan Recopilar',
},
roomMembersPage: {
memberNotFound: 'Miembro no encontrado.',
Expand Down
4 changes: 4 additions & 0 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,10 @@ function getLastMessageTextForReport(report: OnyxEntry<Report>, lastActorDetails
}
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
lastMessageTextFromReport = ReportUtils.getRejectedReportMessage();
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.CORPORATE_UPGRADE) {
lastMessageTextFromReport = ReportUtils.getUpgradeWorkspaceMessage();
} else if (lastReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.TEAM_DOWNGRADE) {
lastMessageTextFromReport = ReportUtils.getDowngradeWorkspaceMessage();
} else if (ReportActionUtils.isActionableAddPaymentCard(lastReportAction)) {
lastMessageTextFromReport = ReportActionUtils.getReportActionMessageText(lastReportAction);
} else if (lastReportAction?.actionName === 'EXPORTINTEGRATION') {
Expand Down
16 changes: 16 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4063,6 +4063,12 @@ function getReportName(
if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
return getRejectedReportMessage();
}
if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.CORPORATE_UPGRADE) {
return getUpgradeWorkspaceMessage();
}
if (parentReportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.TEAM_DOWNGRADE) {
return getDowngradeWorkspaceMessage();
}
if (ReportActionsUtils.isActionOfType(parentReportAction, CONST.REPORT.ACTIONS.TYPE.APPROVED)) {
const {automaticAction} = ReportActionsUtils.getOriginalMessage(parentReportAction) ?? {};
if (automaticAction) {
Expand Down Expand Up @@ -4954,6 +4960,14 @@ function getRejectedReportMessage() {
return Localize.translateLocal('iou.rejectedThisReport');
}

function getUpgradeWorkspaceMessage() {
return Localize.translateLocal('workspaceActions.upgradedWorkspace');
}

function getDowngradeWorkspaceMessage() {
return Localize.translateLocal('workspaceActions.downgradedWorkspace');
}

function getWorkspaceNameUpdatedMessage(action: ReportAction) {
const {oldName, newName} = ReportActionsUtils.getOriginalMessage(action as ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME>) ?? {};
const message = oldName && newName ? Localize.translateLocal('workspaceActions.renamedWorkspaceNameAction', {oldName, newName}) : ReportActionsUtils.getReportActionText(action);
Expand Down Expand Up @@ -8788,6 +8802,8 @@ export {
getIOUForwardedMessage,
getRejectedReportMessage,
getWorkspaceNameUpdatedMessage,
getUpgradeWorkspaceMessage,
getDowngradeWorkspaceMessage,
getReportAutomaticallySubmittedMessage,
getIOUSubmittedMessage,
getIcons,
Expand Down
4 changes: 2 additions & 2 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1363,8 +1363,8 @@ function readNewestAction(reportID: string | undefined, shouldResetUnreadMarker
/**
* Sets the last read time on a report
*/
function markCommentAsUnread(reportID: string, reportActionCreated: string) {
if (reportID === '-1') {
function markCommentAsUnread(reportID: string | undefined, reportActionCreated: string) {
if (!reportID) {
Log.warn('7339cd6c-3263-4f89-98e5-730f0be15784 Invalid report passed to MarkCommentAsUnread. Not calling the API because it wil fail.');
return;
}
Expand Down
18 changes: 12 additions & 6 deletions src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ const ContextMenuActions: ContextMenuAction[] = [
// is false, so we need to pass true here to override this condition.
ReportActionComposeFocusManager.focus(true);
});
Report.navigateToAndOpenChildReport(reportAction?.childReportID ?? '-1', reportAction, originalReportID);
Report.navigateToAndOpenChildReport(reportAction?.childReportID, reportAction, originalReportID);
});
return;
}
Report.navigateToAndOpenChildReport(reportAction?.childReportID ?? '-1', reportAction, originalReportID);
Report.navigateToAndOpenChildReport(reportAction?.childReportID, reportAction, originalReportID);
},
getDescription: () => {},
},
Expand All @@ -208,7 +208,7 @@ const ContextMenuActions: ContextMenuAction[] = [
successIcon: Expensicons.Checkmark,
shouldShow: ({type, isUnreadChat}) => type === CONST.CONTEXT_MENU_TYPES.REPORT_ACTION || (type === CONST.CONTEXT_MENU_TYPES.REPORT && !isUnreadChat),
onPress: (closePopover, {reportAction, reportID}) => {
const originalReportID = ReportUtils.getOriginalReportID(reportID, reportAction) ?? '-1';
const originalReportID = ReportUtils.getOriginalReportID(reportID, reportAction);
Report.markCommentAsUnread(originalReportID, reportAction?.created);
if (closePopover) {
hideContextMenu(true, ReportActionComposeFocusManager.focus);
Expand Down Expand Up @@ -239,7 +239,7 @@ const ContextMenuActions: ContextMenuAction[] = [
onPress: (closePopover, {reportID, reportAction, draftMessage}) => {
if (ReportActionsUtils.isMoneyRequestAction(reportAction)) {
hideContextMenu(false);
const childReportID = reportAction?.childReportID ?? '-1';
const childReportID = `${reportAction?.childReportID ?? CONST.DEFAULT_NUMBER_ID}`;
nkdengineer marked this conversation as resolved.
Show resolved Hide resolved
Report.openReport(childReportID);
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(childReportID));
return;
Expand Down Expand Up @@ -324,13 +324,13 @@ const ContextMenuActions: ContextMenuAction[] = [
if (closePopover) {
hideContextMenu(false, () => {
ReportActionComposeFocusManager.focus();
Report.toggleSubscribeToChildReport(reportAction?.childReportID ?? '-1', reportAction, originalReportID, childReportNotificationPreference);
Report.toggleSubscribeToChildReport(reportAction?.childReportID, reportAction, originalReportID, childReportNotificationPreference);
});
return;
}

ReportActionComposeFocusManager.focus();
Report.toggleSubscribeToChildReport(reportAction?.childReportID ?? '-1', reportAction, originalReportID, childReportNotificationPreference);
Report.toggleSubscribeToChildReport(reportAction?.childReportID, reportAction, originalReportID, childReportNotificationPreference);
},
getDescription: () => {},
},
Expand Down Expand Up @@ -451,6 +451,12 @@ const ContextMenuActions: ContextMenuAction[] = [
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
const displayMessage = ReportUtils.getRejectedReportMessage();
Clipboard.setString(displayMessage);
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.CORPORATE_UPGRADE) {
const displayMessage = ReportUtils.getUpgradeWorkspaceMessage();
Clipboard.setString(displayMessage);
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.TEAM_DOWNGRADE) {
const displayMessage = ReportUtils.getDowngradeWorkspaceMessage();
Clipboard.setString(displayMessage);
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) {
Clipboard.setString(Localize.translateLocal('iou.heldExpense'));
} else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.UNHOLD) {
Expand Down
4 changes: 4 additions & 0 deletions src/pages/home/report/PureReportActionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,10 @@ function PureReportActionItem({
}
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.REJECTED) {
children = <ReportActionItemBasicMessage message={translate('iou.rejectedThisReport')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.CORPORATE_UPGRADE) {
children = <ReportActionItemBasicMessage message={translate('workspaceActions.upgradedWorkspace')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.TEAM_DOWNGRADE) {
children = <ReportActionItemBasicMessage message={translate('workspaceActions.downgradedWorkspace')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD) {
children = <ReportActionItemBasicMessage message={translate('iou.heldExpense')} />;
} else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.HOLD_COMMENT) {
Expand Down
Loading