diff --git a/src/libs/Parser.ts b/src/libs/Parser.ts index cbfeb6e409225..15a4981225f37 100644 --- a/src/libs/Parser.ts +++ b/src/libs/Parser.ts @@ -15,7 +15,7 @@ Onyx.connect({ return; } - accountIDToNameMap[personalDetails.accountID] = personalDetails.login ?? String(personalDetails.accountID); + accountIDToNameMap[personalDetails.accountID] = personalDetails.login ?? personalDetails.displayName ?? String(personalDetails.accountID); }); }, }); diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 8155fb7793bad..f4bad2d2f2cf4 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1311,7 +1311,7 @@ function getReportActionMessageFragments(action: ReportAction): Message[] { } if (isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.UPDATE_ROOM_DESCRIPTION)) { - const message = `${Localize.translateLocal('roomChangeLog.updateRoomDescription')} ${getOriginalMessage(action)?.description}`; + const message = getUpdateRoomDescriptionMessage(action); return [{text: message, html: `${message}`, type: 'COMMENT'}]; } diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 005e97fec8873..4c1ab1818425f 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -481,6 +481,7 @@ type OutstandingChildRequest = { type ParsingDetails = { shouldEscapeText?: boolean; reportID?: string; + policyID?: string; }; let currentUserEmail: string | undefined; @@ -3763,6 +3764,13 @@ function getParsedComment(text: string, parsingDetails?: ParsingDetails): string isGroupPolicyReport = isReportInGroupPolicy(currentReport); } + if (parsingDetails?.policyID) { + const policyType = getPolicy(parsingDetails?.policyID)?.type; + if (policyType) { + isGroupPolicyReport = isGroupPolicy(policyType); + } + } + const textWithMention = completeShortMention(text); return text.length <= CONST.MAX_MARKUP_LENGTH diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index aa6e51d4b7baf..1d73a4b12f2f7 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -648,14 +648,6 @@ function ReportActionItem({ children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.MERGED_WITH_CASH_TRANSACTION) { children = ; - } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.ROOM_CHANGE_LOG.UPDATE_ROOM_DESCRIPTION) { - children = ( - - ); } else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.DISMISSED_VIOLATION)) { children = ; } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.ADD_TAG) { diff --git a/src/pages/workspace/WorkspaceNewRoomPage.tsx b/src/pages/workspace/WorkspaceNewRoomPage.tsx index c848e538bd1ce..55d18520b8196 100644 --- a/src/pages/workspace/WorkspaceNewRoomPage.tsx +++ b/src/pages/workspace/WorkspaceNewRoomPage.tsx @@ -105,7 +105,7 @@ function WorkspaceNewRoomPage({policies, reports, formState, session, activePoli */ const submit = (values: FormOnyxValues) => { const participants = [session?.accountID ?? -1]; - const parsedDescription = ReportUtils.getParsedComment(values.reportDescription ?? ''); + const parsedDescription = ReportUtils.getParsedComment(values.reportDescription ?? '', {policyID}); const policyReport = ReportUtils.buildOptimisticChatReport( participants, values.roomName, @@ -183,7 +183,7 @@ function WorkspaceNewRoomPage({policies, reports, formState, session, activePoli ErrorUtils.addErrorMessage(errors, 'roomName', translate('common.error.characterLimitExceedCounter', {length: values.roomName.length, limit: CONST.TITLE_CHARACTER_LIMIT})); } - const descriptionLength = ReportUtils.getCommentLength(values.reportDescription); + const descriptionLength = ReportUtils.getCommentLength(values.reportDescription, {policyID}); if (descriptionLength > CONST.REPORT_DESCRIPTION.MAX_LENGTH) { ErrorUtils.addErrorMessage( errors, @@ -198,7 +198,7 @@ function WorkspaceNewRoomPage({policies, reports, formState, session, activePoli return errors; }, - [reports, translate], + [reports, policyID, translate], ); const writeCapabilityOptions = useMemo(