diff --git a/src/languages/en.ts b/src/languages/en.ts index 6038827b4428..d726b2446884 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3623,6 +3623,9 @@ export default { public_announce: 'Public Announce', }, }, + workspaceActions: { + renamedWorkspaceNameAction: ({oldName, newName}) => `updated the name of this workspace from ${oldName} to ${newName}`, + }, roomMembersPage: { memberNotFound: 'Member not found. To invite a new member to the room, please use the invite button above.', notAuthorized: `You don't have access to this page. If you're trying to join this room, just ask a room member to add you. Something else? Reach out to ${CONST.EMAIL.CONCIERGE}`, diff --git a/src/languages/es.ts b/src/languages/es.ts index c6494932b419..a8d4ccba22ef 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3676,6 +3676,9 @@ export default { public_announce: 'Anuncio Público', }, }, + workspaceActions: { + renamedWorkspaceNameAction: ({oldName, newName}) => `actualizó el nombre de este espacio de trabajo de ${oldName} a ${newName}`, + }, roomMembersPage: { memberNotFound: 'Miembro no encontrado. Para invitar a un nuevo miembro a la sala de chat, por favor, utiliza el botón invitar que está más arriba.', notAuthorized: `No tienes acceso a esta página. Si estás intentando unirte a esta sala, pide a un miembro de la sala que te añada. ¿Necesitas algo más? Comunícate con ${CONST.EMAIL.CONCIERGE}`, diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 5c50322a17d8..5d161b8a5e76 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4392,6 +4392,12 @@ function getIOUForwardedMessage(reportID: string) { return Localize.translateLocal('iou.forwardedAmount', {amount: getFormattedAmount(reportID)}); } +function getWorkspaceNameUpdatedMessage(action: ReportAction) { + const {oldName, newName} = ReportActionsUtils.getOriginalMessage(action as ReportAction) ?? {}; + const message = oldName && newName ? Localize.translateLocal('workspaceActions.renamedWorkspaceNameAction', {oldName, newName}) : ReportActionsUtils.getReportActionText(action); + return message; +} + /** * @param iouReportID - the report ID of the IOU report the action belongs to * @param type - IOUReportAction type. Can be oneOf(create, decline, cancel, pay, split) @@ -7789,6 +7795,7 @@ export { getIOUReportActionMessage, getIOUApprovedMessage, getIOUForwardedMessage, + getWorkspaceNameUpdatedMessage, getIOUSubmittedMessage, getIcons, getIconsForParticipants, diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 1722620dd85c..dedd608ce77d 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -419,6 +419,8 @@ function getOptionData({ } } else if (ReportActionsUtils.isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.UPDATE_ROOM_DESCRIPTION)) { result.alternateText = `${lastActorDisplayName} ${ReportActionsUtils.getUpdateRoomDescriptionMessage(lastAction)}`; + } else if (ReportActionsUtils.isActionOfType(lastAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME)) { + result.alternateText = ReportUtils.getWorkspaceNameUpdatedMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.LEAVE_POLICY) { result.alternateText = Localize.translateLocal('workspace.invite.leftWorkspace'); } else if (lastAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW && lastActorDisplayName && lastMessageTextFromReport) { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 234e3fc02cc4..cfba04fee23c 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -428,6 +428,8 @@ const ContextMenuActions: ContextMenuAction[] = [ } else if (ReportActionsUtils.isMemberChangeAction(reportAction)) { const logMessage = ReportActionsUtils.getMemberChangeMessageFragment(reportAction).html ?? ''; setClipboardMessage(logMessage); + } else if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME) { + Clipboard.setString(ReportUtils.getWorkspaceNameUpdatedMessage(reportAction)); } else if (ReportActionsUtils.isReimbursementQueuedAction(reportAction)) { Clipboard.setString(ReportUtils.getReimbursementQueuedActionMessage(reportAction, reportID, false)); } else if (ReportActionsUtils.isActionableMentionWhisper(reportAction)) { diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 3b76b1650901..f043610ed4bc 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -654,6 +654,8 @@ function ReportActionItem({ children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_TAG) { children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_NAME) { + children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_EMPLOYEE) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.UPDATE_EMPLOYEE) { diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index fff7b3b845db..8bcd5932bfc6 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -245,6 +245,12 @@ type OriginalMessageChangeLog = { /** ID of the report */ reportID?: number; + /** Old name of the workspace */ + oldName?: string; + + /** New name of the workspace */ + newName?: string; + /** Email of user */ email?: string;