Skip to content

Commit e665d5c

Browse files
authored
Merge pull request #41096 from rezkiy37/feature/40998-improve-task-replies
2 parents a7f8e68 + 8eab7df commit e665d5c

File tree

6 files changed

+118
-181
lines changed

6 files changed

+118
-181
lines changed

src/CONST.ts

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3716,8 +3716,9 @@ const CONST = {
37163716
type: 'submitExpense',
37173717
autoCompleted: false,
37183718
title: 'Submit an expense',
3719-
subtitle: '<strong>Submit an expense</strong> by entering an amount or scanning a receipt.',
3720-
message:
3719+
description:
3720+
'<strong>Submit an expense</strong> by entering an amount or scanning a receipt.\n' +
3721+
'\n' +
37213722
'Here’s how to submit an expense:\n' +
37223723
'\n' +
37233724
'1. Click the green <strong>+</strong> button.\n' +
@@ -3731,8 +3732,9 @@ const CONST = {
37313732
type: 'enableWallet',
37323733
autoCompleted: false,
37333734
title: 'Enable your wallet',
3734-
subtitle: 'You’ll need to <strong>enable your Expensify Wallet</strong> to get paid back. Don’t worry, it’s easy!',
3735-
message:
3735+
description:
3736+
'You’ll need to <strong>enable your Expensify Wallet</strong> to get paid back. Don’t worry, it’s easy!\n' +
3737+
'\n' +
37363738
'Here’s how to set up your wallet:\n' +
37373739
'\n' +
37383740
'1. Click your profile picture.\n' +
@@ -3757,8 +3759,9 @@ const CONST = {
37573759
type: 'createWorkspace',
37583760
autoCompleted: true,
37593761
title: 'Create a workspace',
3760-
subtitle: '<strong>Create a workspace</strong> to track expenses, scan receipts, chat, and more.',
3761-
message:
3762+
description:
3763+
'<strong>Create a workspace</strong> to track expenses, scan receipts, chat, and more.\n' +
3764+
'\n' +
37623765
'Here’s how to create a workspace:\n' +
37633766
'\n' +
37643767
'1. Click your profile picture.\n' +
@@ -3770,8 +3773,7 @@ const CONST = {
37703773
type: 'meetGuide',
37713774
autoCompleted: false,
37723775
title: 'Meet your setup specialist',
3773-
subtitle: '',
3774-
message: ({adminsRoomLink, guideCalendarLink}: {adminsRoomLink: string; guideCalendarLink: string}) =>
3776+
description: ({adminsRoomLink, guideCalendarLink}: {adminsRoomLink: string; guideCalendarLink: string}) =>
37753777
`Meet your setup specialist, who can answer any questions as you get started with Expensify. Yes, a real human!\n` +
37763778
'\n' +
37773779
`Chat with the specialist in your [#admins room](${adminsRoomLink}) or [schedule a call](${guideCalendarLink}) today.`,
@@ -3780,8 +3782,9 @@ const CONST = {
37803782
type: 'setupCategories',
37813783
autoCompleted: false,
37823784
title: 'Set up categories',
3783-
subtitle: '<strong>Set up categories</strong> so your team can code expenses for easy reporting.',
3784-
message:
3785+
description:
3786+
'<strong>Set up categories</strong> so your team can code expenses for easy reporting.\n' +
3787+
'\n' +
37853788
'Here’s how to set up categories:\n' +
37863789
'\n' +
37873790
'1. Click your profile picture.\n' +
@@ -3796,8 +3799,9 @@ const CONST = {
37963799
type: 'addExpenseApprovals',
37973800
autoCompleted: false,
37983801
title: 'Add expense approvals',
3799-
subtitle: '<strong>Add expense approvals</strong> to review your team’s spend and keep it under control.',
3800-
message:
3802+
description:
3803+
'<strong>Add expense approvals</strong> to review your team’s spend and keep it under control.\n' +
3804+
'\n' +
38013805
'Here’s how to add expense approvals:\n' +
38023806
'\n' +
38033807
'1. Click your profile picture.\n' +
@@ -3812,8 +3816,9 @@ const CONST = {
38123816
type: 'inviteTeam',
38133817
autoCompleted: false,
38143818
title: 'Invite your team',
3815-
subtitle: '<strong>Invite your team</strong> to Expensify so they can start tracking expenses today.',
3816-
message:
3819+
description:
3820+
'<strong>Invite your team</strong> to Expensify so they can start tracking expenses today.\n' +
3821+
'\n' +
38173822
'Here’s how to invite your team:\n' +
38183823
'\n' +
38193824
'1. Click your profile picture.\n' +
@@ -3840,8 +3845,9 @@ const CONST = {
38403845
type: 'trackExpense',
38413846
autoCompleted: false,
38423847
title: 'Track an expense',
3843-
subtitle: '<strong>Track an expense</strong> in any currency, whether you have a receipt or not.',
3844-
message:
3848+
description:
3849+
'<strong>Track an expense</strong> in any currency, whether you have a receipt or not.\n' +
3850+
'\n' +
38453851
'Here’s how to track an expense:\n' +
38463852
'\n' +
38473853
'1. Click the green <strong>+</strong> button.\n' +
@@ -3867,8 +3873,9 @@ const CONST = {
38673873
type: 'startChat',
38683874
autoCompleted: false,
38693875
title: 'Start a chat',
3870-
subtitle: '<strong>Start a chat</strong> with a friend or group using their email or phone number.',
3871-
message:
3876+
description:
3877+
'<strong>Start a chat</strong> with a friend or group using their email or phone number.\n' +
3878+
'\n' +
38723879
'Here’s how to start a chat:\n' +
38733880
'\n' +
38743881
'1. Click the green <strong>+</strong> button.\n' +
@@ -3883,8 +3890,9 @@ const CONST = {
38833890
type: 'splitExpense',
38843891
autoCompleted: false,
38853892
title: 'Split an expense',
3886-
subtitle: '<strong>Split an expense</strong> right in your chat with one or more friends.',
3887-
message:
3893+
description:
3894+
'<strong>Split an expense</strong> right in your chat with one or more friends.\n' +
3895+
'\n' +
38883896
'Here’s how to request money:\n' +
38893897
'\n' +
38903898
'1. Click the green <strong>+</strong> button.\n' +
@@ -3898,8 +3906,9 @@ const CONST = {
38983906
type: 'enableWallet',
38993907
autoCompleted: false,
39003908
title: 'Enable your wallet',
3901-
subtitle: 'You’ll need to <strong>enable your Expensify Wallet</strong> to get paid back. Don’t worry, it’s easy!',
3902-
message:
3909+
description:
3910+
'You’ll need to <strong>enable your Expensify Wallet</strong> to get paid back. Don’t worry, it’s easy!\n' +
3911+
'\n' +
39033912
'Here’s how to enable your wallet:\n' +
39043913
'\n' +
39053914
'1. Click your profile picture.\n' +

src/components/MenuItem.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ type MenuItemBaseProps = {
215215
/** Should render the content in HTML format */
216216
shouldRenderAsHTML?: boolean;
217217

218+
/** Whether or not the text should be escaped */
219+
shouldEscapeText?: boolean;
220+
218221
/** Should we grey out the menu item when it is disabled? */
219222
shouldGreyOutWhenDisabled?: boolean;
220223

@@ -317,6 +320,7 @@ function MenuItem(
317320
isSmallAvatarSubscriptMenu = false,
318321
brickRoadIndicator,
319322
shouldRenderAsHTML = false,
323+
shouldEscapeText = undefined,
320324
shouldGreyOutWhenDisabled = true,
321325
shouldUseDefaultCursorWhenDisabled = false,
322326
isAnonymousAction = false,
@@ -370,8 +374,8 @@ function MenuItem(
370374
return '';
371375
}
372376
const parser = new ExpensiMark();
373-
return parser.replace(title);
374-
}, [title, shouldParseTitle]);
377+
return parser.replace(title, {shouldEscapeText});
378+
}, [title, shouldParseTitle, shouldEscapeText]);
375379

376380
const processedTitle = useMemo(() => {
377381
let titleToWrap = '';

src/components/ReportActionItem/TaskView.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import getButtonState from '@libs/getButtonState';
2323
import Navigation from '@libs/Navigation/Navigation';
2424
import * as OptionsListUtils from '@libs/OptionsListUtils';
2525
import * as ReportUtils from '@libs/ReportUtils';
26+
import * as Url from '@libs/Url';
2627
import * as Session from '@userActions/Session';
2728
import * as Task from '@userActions/Task';
2829
import CONST from '@src/CONST';
@@ -149,6 +150,8 @@ function TaskView({report, shouldShowHorizontalRule, ...props}: TaskViewProps) {
149150
shouldGreyOutWhenDisabled={false}
150151
numberOfLinesTitle={0}
151152
interactive={!isDisableInteractive}
153+
shouldRenderAsHTML
154+
shouldEscapeText={Url.hasURL(report.description ?? '') ? undefined : false}
152155
/>
153156
</OfflineWithFeedback>
154157
<OfflineWithFeedback pendingAction={report.pendingFields?.managerID}>

src/libs/ReportUtils.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3516,12 +3516,6 @@ function buildOptimisticTaskCommentReportAction(
35163516
parentReportID: string,
35173517
actorAccountID?: number,
35183518
createdOffset = 0,
3519-
repliesConfig?: {
3520-
childVisibleActionCount?: number;
3521-
childCommenterCount?: number;
3522-
childLastVisibleActionCreated?: string;
3523-
childOldestFourAccountIDs?: string;
3524-
},
35253519
): OptimisticReportAction {
35263520
const reportAction = buildOptimisticAddCommentReportAction(text, undefined, undefined, createdOffset, undefined, taskReportID);
35273521
if (reportAction.reportAction.message?.[0]) {
@@ -3546,22 +3540,6 @@ function buildOptimisticTaskCommentReportAction(
35463540
reportAction.reportAction.actorAccountID = actorAccountID;
35473541
}
35483542

3549-
if (repliesConfig?.childVisibleActionCount) {
3550-
reportAction.reportAction.childVisibleActionCount = repliesConfig.childVisibleActionCount;
3551-
}
3552-
3553-
if (repliesConfig?.childCommenterCount) {
3554-
reportAction.reportAction.childCommenterCount = repliesConfig.childCommenterCount;
3555-
}
3556-
3557-
if (repliesConfig?.childLastVisibleActionCreated) {
3558-
reportAction.reportAction.childLastVisibleActionCreated = repliesConfig.childLastVisibleActionCreated;
3559-
}
3560-
3561-
if (repliesConfig?.childOldestFourAccountIDs) {
3562-
reportAction.reportAction.childOldestFourAccountIDs = repliesConfig.childOldestFourAccountIDs;
3563-
}
3564-
35653543
return reportAction;
35663544
}
35673545

src/libs/Url.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,10 @@ function appendParam(url: string, paramName: string, paramValue: string) {
5656
return `${url}${separator}${paramName}=${paramValue}`;
5757
}
5858

59-
export {addTrailingForwardSlash, hasSameExpensifyOrigin, getPathFromURL, appendParam};
59+
function hasURL(text: string) {
60+
const urlPattern = /((https|http)?:\/\/[^\s]+)/g;
61+
62+
return urlPattern.test(text);
63+
}
64+
65+
export {addTrailingForwardSlash, hasSameExpensifyOrigin, getPathFromURL, appendParam, hasURL};

0 commit comments

Comments
 (0)