Skip to content

Commit

Permalink
remove sending <mention-report> from room/workspace descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
war-in committed Apr 30, 2024
1 parent 09ef176 commit 9114d95
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
14 changes: 8 additions & 6 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ type OutstandingChildRequest = {
type ParsingDetails = {
shouldEscapeText?: boolean;
reportID?: string;
policyID?: string;
};

let currentUserEmail: string | undefined;
Expand Down Expand Up @@ -3307,10 +3306,6 @@ function getParsedComment(text: string, parsingDetails?: ParsingDetails): string
const currentReport = getReport(parsingDetails?.reportID);
isGroupPolicyReport = isReportInGroupPolicy(currentReport);
}
if (parsingDetails?.policyID) {
const policyType = getPolicy(parsingDetails?.policyID).type;
isGroupPolicyReport = isGroupPolicy(policyType);
}

const parser = new ExpensiMark();
const textWithMention = text.replace(CONST.REGEX.SHORT_MENTION, (match) => {
Expand Down Expand Up @@ -3380,7 +3375,14 @@ function buildOptimisticInviteReportAction(invitedUserDisplayName: string, invit
};
}

function buildOptimisticAddCommentReportAction(text?: string, file?: FileObject, actorAccountID?: number, createdOffset = 0, shouldEscapeText?: boolean, reportID?: string): OptimisticReportAction {
function buildOptimisticAddCommentReportAction(
text?: string,
file?: FileObject,
actorAccountID?: number,
createdOffset = 0,
shouldEscapeText?: boolean,
reportID?: string,
): OptimisticReportAction {
const parser = new ExpensiMark();
const commentText = getParsedComment(text ?? '', {shouldEscapeText, reportID});
const isAttachmentOnly = file && !text;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,7 @@ function updateWorkspaceDescription(policyID: string, description: string, curre
if (description === currentDescription) {
return;
}
const parsedDescription = ReportUtils.getParsedComment(description, {policyID});
const parsedDescription = ReportUtils.getParsedComment(description);

const optimisticData: OnyxUpdate[] = [
{
Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/HoldReasonPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function HoldReasonPage({route}: HoldReasonPageProps) {

// We first check if the report is part of a policy - if not, then it's a personal request (1:1 request)
// For personal requests, we need to allow both users to put the request on hold
const isWorkspaceRequest = ReportUtils.isGroupPolicy(report);
const isWorkspaceRequest = ReportUtils.isReportInGroupPolicy(report);
const parentReportAction = ReportActionsUtils.getReportAction(report?.parentReportID ?? '', report?.parentReportActionID ?? '');

const navigateBack = () => {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/workspace/WorkspaceNewRoomPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function WorkspaceNewRoomPage({policies, reports, formState, session, activePoli
*/
const submit = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.NEW_ROOM_FORM>) => {
const participants = [session?.accountID ?? 0];
const parsedDescription = ReportUtils.getParsedComment(values.reportDescription ?? '', {policyID});
const parsedDescription = ReportUtils.getParsedComment(values.reportDescription ?? '');
const policyReport = ReportUtils.buildOptimisticChatReport(
participants,
values.roomName,
Expand Down Expand Up @@ -183,7 +183,7 @@ function WorkspaceNewRoomPage({policies, reports, formState, session, activePoli
ErrorUtils.addErrorMessage(errors, 'roomName', ['common.error.characterLimitExceedCounter', {length: values.roomName.length, limit: CONST.TITLE_CHARACTER_LIMIT}]);
}

const descriptionLength = ReportUtils.getCommentLength(values.reportDescription, {policyID});
const descriptionLength = ReportUtils.getCommentLength(values.reportDescription);
if (descriptionLength > CONST.REPORT_DESCRIPTION.MAX_LENGTH) {
ErrorUtils.addErrorMessage(errors, 'reportDescription', [
'common.error.characterLimitExceedCounter',
Expand All @@ -197,7 +197,7 @@ function WorkspaceNewRoomPage({policies, reports, formState, session, activePoli

return errors;
},
[reports, policyID],
[reports],
);

const writeCapabilityOptions = useMemo(
Expand Down

0 comments on commit 9114d95

Please sign in to comment.