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

[feature]: Using the product as a copilot #48594

Merged
merged 52 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
a2e0bbf
add delegate prop to OriginalMessage
allgandalf Sep 4, 2024
27d7bca
add delegate prop to OriginalMessage
allgandalf Sep 4, 2024
deca975
add delegate in original message
allgandalf Sep 4, 2024
daa0c9c
fix OriginalMessageSubmitted typo
allgandalf Sep 4, 2024
c18f61f
update optimistic actions to include delegate email
allgandalf Sep 4, 2024
f45020a
remove delegate component
allgandalf Sep 4, 2024
dd7947d
fix unit test
allgandalf Sep 4, 2024
e7162f3
fix lint
allgandalf Sep 5, 2024
2adb7f7
Merge branch 'main' into issue46926P2
allgandalf Sep 5, 2024
beb642d
remove usage of hook
allgandalf Sep 5, 2024
b6272e3
part 1: update reportactionitemsingle to display delegate details
allgandalf Sep 5, 2024
79192b2
Update Permissions.ts
allgandalf Sep 5, 2024
93957c6
Merge branch 'main' into issue46926P2
allgandalf Sep 6, 2024
3d136e4
part 2: add delegator name
allgandalf Sep 6, 2024
9a2f8b7
fix spanish translation
allgandalf Sep 6, 2024
4b13c3c
add delegator display name
allgandalf Sep 6, 2024
1c497da
fix system message
allgandalf Sep 6, 2024
96eb90f
fix grouping of messages
allgandalf Sep 6, 2024
fc3cae1
revert to previous check
allgandalf Sep 6, 2024
47a098e
get delegate account details
allgandalf Sep 6, 2024
e48b2b1
add delegateaccountID
allgandalf Sep 6, 2024
1b268e8
remove unused util
allgandalf Sep 6, 2024
4b784e7
cleanup
allgandalf Sep 6, 2024
53e5e61
fix lint
allgandalf Sep 6, 2024
d8cccb6
add delegate AccountID for IOU
allgandalf Sep 6, 2024
c500a0b
Update AvatarWithDelegateAvatar.tsx
allgandalf Sep 6, 2024
bda8982
Merge branch 'main' into issue46926P2
allgandalf Sep 15, 2024
a8a097f
Merge branch 'Expensify:main' into issue46926P2
allgandalf Sep 20, 2024
699edec
fix modified expense report actions
allgandalf Sep 20, 2024
d5eb8af
remove delegate from original Message (Deprecated)
allgandalf Sep 20, 2024
9229536
fix prettier
allgandalf Sep 20, 2024
d632c5f
add delegate for task
allgandalf Sep 20, 2024
80e28ae
fix lint
allgandalf Sep 20, 2024
90f28c6
Do not display delegate message on report preview
allgandalf Sep 20, 2024
35b5431
fix lint
allgandalf Sep 20, 2024
3171156
fix pay someone limited delegate action
allgandalf Sep 24, 2024
0a745a3
migrate from withOnyx
allgandalf Sep 24, 2024
fc19a5c
remove commented section
allgandalf Sep 24, 2024
e2b43f6
add delegate dependency
allgandalf Sep 24, 2024
24eff7d
fix offline case for pay expense
allgandalf Sep 24, 2024
f64cfbd
fix offline submission of expense
allgandalf Sep 24, 2024
6a51601
Merge branch 'main' into issue46926P2
allgandalf Sep 24, 2024
3b0742c
fix jest hopefully
allgandalf Sep 24, 2024
d36fd07
fix
allgandalf Sep 24, 2024
d851429
make delegateEmail accessible in reportUtils itself
allgandalf Sep 24, 2024
60f097a
remove whitespaces
allgandalf Sep 24, 2024
e5778d7
Check for delegate report action directly from actions
allgandalf Sep 24, 2024
33e8945
Merge branch 'main' into issue46926P2
allgandalf Sep 24, 2024
c081907
remove white space
allgandalf Sep 24, 2024
e92e7d5
Merge branch 'Expensify:main' into issue46926P2
allgandalf Sep 24, 2024
d5e3428
Update src/libs/ReportUtils.ts
allgandalf Sep 25, 2024
d47e156
Merge branch 'main' into issue46926P2
allgandalf Sep 26, 2024
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
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4600,5 +4600,6 @@ export default {
}
},
genericError: 'Oops, something went wrong. Please try again.',
onBehalfOfMessage: (delegator: string) => `on behalf of ${delegator}`,
allgandalf marked this conversation as resolved.
Show resolved Hide resolved
},
} satisfies TranslationBase;
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5117,5 +5117,6 @@ export default {
}
},
genericError: '¡Ups! Ha ocurrido un error. Por favor, inténtalo de nuevo.',
onBehalfOfMessage: (delegator: string) => `en nombre de ${delegator}`,
allgandalf marked this conversation as resolved.
Show resolved Hide resolved
},
} satisfies EnglishTranslation;
5 changes: 5 additions & 0 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ function getOriginalMessage<T extends ReportActionName>(reportAction: OnyxInputO
return reportAction.originalMessage;
}

function getOriginalMessageForDelegate(reportAction: OnyxInputOrEntry<ReportAction>) {
return reportAction?.originalMessage ?? {};
}

function isExportIntegrationAction(reportAction: OnyxInputOrEntry<ReportAction>): boolean {
return reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION;
}
Expand Down Expand Up @@ -1737,6 +1741,7 @@ export {
isTransactionThread,
isTripPreview,
isWhisperAction,
getOriginalMessageForDelegate,
isSubmittedAction,
isApprovedAction,
isForwardedAction,
Expand Down
25 changes: 21 additions & 4 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4090,6 +4090,7 @@ function getPolicyDescriptionText(policy: OnyxEntry<Policy>): string {
}

function buildOptimisticAddCommentReportAction(
delegate: string,
text?: string,
file?: FileObject,
actorAccountID?: number,
Expand Down Expand Up @@ -4135,6 +4136,7 @@ function buildOptimisticAddCommentReportAction(
originalMessage: {
html: htmlForNewComment,
whisperedTo: [],
delegate,
},
isFirstItem: false,
isAttachmentOnly,
Expand Down Expand Up @@ -4196,6 +4198,7 @@ function updateOptimisticParentReportAction(parentReportAction: OnyxEntry<Report
* @param text - Text of the comment
* @param parentReportID - Report ID of the parent report
* @param createdOffset - The offset for task's created time that created via a loop
* @param delegate - Email of the delegate
*/
function buildOptimisticTaskCommentReportAction(
taskReportID: string,
Expand All @@ -4205,8 +4208,9 @@ function buildOptimisticTaskCommentReportAction(
parentReportID: string,
actorAccountID?: number,
createdOffset = 0,
delegate = '',
): OptimisticReportAction {
const reportAction = buildOptimisticAddCommentReportAction(text, undefined, undefined, createdOffset, undefined, taskReportID);
const reportAction = buildOptimisticAddCommentReportAction(delegate, text, undefined, undefined, createdOffset, undefined, taskReportID);
if (Array.isArray(reportAction.reportAction.message) && reportAction.reportAction.message?.[0]) {
reportAction.reportAction.message[0].taskReportID = taskReportID;
} else if (!Array.isArray(reportAction.reportAction.message) && reportAction.reportAction.message) {
Expand All @@ -4219,6 +4223,7 @@ function buildOptimisticTaskCommentReportAction(
html: ReportActionsUtils.getReportActionHtml(reportAction.reportAction),
taskReportID: ReportActionsUtils.getReportActionMessage(reportAction.reportAction)?.taskReportID,
whisperedTo: [],
delegate,
};
reportAction.reportAction.childReportID = taskReportID;
reportAction.reportAction.parentReportID = parentReportID;
Expand Down Expand Up @@ -4531,6 +4536,7 @@ function getIOUReportActionMessage(iouReportID: string, type: string, total: num
* @param [isSendMoneyFlow] - Whether this is pay someone flow
* @param [receipt]
* @param [isOwnPolicyExpenseChat] - Whether this is an expense report create from the current user's policy expense chat
* @param delegate - Email of the delegate of the account
*/
function buildOptimisticIOUReportAction(
type: ValueOf<typeof CONST.IOU.REPORT_ACTION_TYPE>,
Expand All @@ -4546,6 +4552,7 @@ function buildOptimisticIOUReportAction(
isOwnPolicyExpenseChat = false,
created = DateUtils.getDBTime(),
linkedExpenseReportAction?: OnyxEntry<ReportAction>,
delegate = '',
): OptimisticIOUReportAction {
const IOUReportID = iouReportID || generateReportID();

Expand All @@ -4556,6 +4563,7 @@ function buildOptimisticIOUReportAction(
IOUTransactionID: transactionID,
IOUReportID,
type,
delegate,
};

if (type === CONST.IOU.REPORT_ACTION_TYPE.PAY) {
Expand Down Expand Up @@ -4615,11 +4623,12 @@ function buildOptimisticIOUReportAction(
/**
* Builds an optimistic APPROVED report action with a randomly generated reportActionID.
*/
function buildOptimisticApprovedReportAction(amount: number, currency: string, expenseReportID: string): OptimisticApprovedReportAction {
function buildOptimisticApprovedReportAction(amount: number, currency: string, expenseReportID: string, delegate: string): OptimisticApprovedReportAction {
allgandalf marked this conversation as resolved.
Show resolved Hide resolved
const originalMessage = {
amount,
currency,
expenseReportID,
delegate,
};

return {
Expand Down Expand Up @@ -4647,7 +4656,7 @@ function buildOptimisticApprovedReportAction(amount: number, currency: string, e
/**
* Builds an optimistic APPROVED report action with a randomly generated reportActionID.
*/
function buildOptimisticUnapprovedReportAction(amount: number, currency: string, expenseReportID: string): OptimisticUnapprovedReportAction {
function buildOptimisticUnapprovedReportAction(amount: number, currency: string, expenseReportID: string, delegate: string): OptimisticUnapprovedReportAction {
allgandalf marked this conversation as resolved.
Show resolved Hide resolved
return {
actionName: CONST.REPORT.ACTIONS.TYPE.UNAPPROVED,
actorAccountID: currentUserAccountID,
Expand All @@ -4658,6 +4667,7 @@ function buildOptimisticUnapprovedReportAction(amount: number, currency: string,
amount,
currency,
expenseReportID,
delegate,
},
message: getIOUReportActionMessage(expenseReportID, CONST.REPORT.ACTIONS.TYPE.UNAPPROVED, Math.abs(amount), '', currency),
person: [
Expand Down Expand Up @@ -4720,11 +4730,18 @@ function buildOptimisticMovedReportAction(fromPolicyID: string, toPolicyID: stri
* Builds an optimistic SUBMITTED report action with a randomly generated reportActionID.
*
*/
function buildOptimisticSubmittedReportAction(amount: number, currency: string, expenseReportID: string, adminAccountID: number | undefined): OptimisticSubmittedReportAction {
function buildOptimisticSubmittedReportAction(
allgandalf marked this conversation as resolved.
Show resolved Hide resolved
amount: number,
currency: string,
expenseReportID: string,
adminAccountID: number | undefined,
delegate: string,
): OptimisticSubmittedReportAction {
const originalMessage = {
amount,
currency,
expenseReportID,
delegate,
};

return {
Expand Down
22 changes: 19 additions & 3 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ Onyx.connect({
},
});

let delegateEmail = '';
Onyx.connect({
key: ONYXKEYS.ACCOUNT,
callback: (value) => {
delegateEmail = value?.delegatedAccess?.delegate ?? '';
},
});

let quickAction: OnyxEntry<OnyxTypes.QuickAction> = {};
Onyx.connect({
key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
Expand Down Expand Up @@ -6914,7 +6922,8 @@ function approveMoneyRequest(expenseReport: OnyxEntry<OnyxTypes.Report>, full?:
if (hasHeldExpenses && !full && !!expenseReport?.unheldTotal) {
total = expenseReport?.unheldTotal;
}
const optimisticApprovedReportAction = ReportUtils.buildOptimisticApprovedReportAction(total, expenseReport?.currency ?? '', expenseReport?.reportID ?? '-1');

allgandalf marked this conversation as resolved.
Show resolved Hide resolved
const optimisticApprovedReportAction = ReportUtils.buildOptimisticApprovedReportAction(total, expenseReport?.currency ?? '', expenseReport?.reportID ?? '-1', delegateEmail);

const approvalChain = ReportUtils.getApprovalChain(PolicyUtils.getPolicy(expenseReport?.policyID), expenseReport?.ownerAccountID ?? -1, expenseReport?.total ?? 0);

Expand Down Expand Up @@ -7070,7 +7079,7 @@ function unapproveExpenseReport(expenseReport: OnyxEntry<OnyxTypes.Report>) {

const currentNextStep = allNextSteps[`${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`] ?? null;

const optimisticUnapprovedReportAction = ReportUtils.buildOptimisticUnapprovedReportAction(expenseReport.total ?? 0, expenseReport.currency ?? '', expenseReport.reportID);
const optimisticUnapprovedReportAction = ReportUtils.buildOptimisticUnapprovedReportAction(expenseReport.total ?? 0, expenseReport.currency ?? '', expenseReport.reportID, delegateEmail);
const optimisticNextStep = NextStepUtils.buildNextStep(expenseReport, CONST.REPORT.STATUS_NUM.SUBMITTED);

const optimisticReportActionData: OnyxUpdate = {
Expand Down Expand Up @@ -7164,7 +7173,14 @@ function submitReport(expenseReport: OnyxTypes.Report) {
const isCurrentUserManager = currentUserPersonalDetails?.accountID === expenseReport.managerID;
const isSubmitAndClosePolicy = PolicyUtils.isSubmitAndClose(policy);
const adminAccountID = policy?.role === CONST.POLICY.ROLE.ADMIN ? currentUserPersonalDetails?.accountID : undefined;
const optimisticSubmittedReportAction = ReportUtils.buildOptimisticSubmittedReportAction(expenseReport?.total ?? 0, expenseReport.currency ?? '', expenseReport.reportID, adminAccountID);

allgandalf marked this conversation as resolved.
Show resolved Hide resolved
const optimisticSubmittedReportAction = ReportUtils.buildOptimisticSubmittedReportAction(
expenseReport?.total ?? 0,
expenseReport.currency ?? '',
expenseReport.reportID,
adminAccountID,
delegateEmail,
);
const optimisticNextStep = NextStepUtils.buildNextStep(expenseReport, isSubmitAndClosePolicy ? CONST.REPORT.STATUS_NUM.CLOSED : CONST.REPORT.STATUS_NUM.SUBMITTED);

const optimisticData: OnyxUpdate[] = !isSubmitAndClosePolicy
Expand Down
17 changes: 12 additions & 5 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ Onyx.connect({
waitForCollectionCallback: true,
callback: (value) => (allReportDraftComments = value),
});
let delegateEmail = '';
Onyx.connect({
key: ONYXKEYS.ACCOUNT,
callback: (value) => {
delegateEmail = value?.delegatedAccess?.delegate ?? '';
},
});

let environmentURL: string;
Environment.getEnvironmentURL().then((url: string) => (environmentURL = url));
Expand Down Expand Up @@ -452,7 +459,7 @@ function addActions(reportID: string, text = '', file?: FileObject) {
let commandName: typeof WRITE_COMMANDS.ADD_COMMENT | typeof WRITE_COMMANDS.ADD_ATTACHMENT | typeof WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT = WRITE_COMMANDS.ADD_COMMENT;

if (text && !file) {
const reportComment = ReportUtils.buildOptimisticAddCommentReportAction(text, undefined, undefined, undefined, undefined, reportID);
const reportComment = ReportUtils.buildOptimisticAddCommentReportAction(delegateEmail, text, undefined, undefined, undefined, undefined, reportID);
reportCommentAction = reportComment.reportAction;
reportCommentText = reportComment.commentText;
}
Expand All @@ -461,7 +468,7 @@ function addActions(reportID: string, text = '', file?: FileObject) {
// When we are adding an attachment we will call AddAttachment.
// It supports sending an attachment with an optional comment and AddComment supports adding a single text comment only.
commandName = WRITE_COMMANDS.ADD_ATTACHMENT;
const attachment = ReportUtils.buildOptimisticAddCommentReportAction(text, file, undefined, undefined, undefined, reportID);
const attachment = ReportUtils.buildOptimisticAddCommentReportAction(delegateEmail, text, file, undefined, undefined, undefined, reportID);
attachmentAction = attachment.reportAction;
}

Expand Down Expand Up @@ -3322,7 +3329,7 @@ function completeOnboarding(
const {reportID: targetChatReportID = '', policyID: targetChatPolicyID = ''} = targetChatReport ?? {};

// Introductory message
const introductionComment = ReportUtils.buildOptimisticAddCommentReportAction(CONST.ONBOARDING_INTRODUCTION, undefined, actorAccountID);
const introductionComment = ReportUtils.buildOptimisticAddCommentReportAction(delegateEmail, CONST.ONBOARDING_INTRODUCTION, undefined, actorAccountID);
const introductionCommentAction: OptimisticAddCommentReportAction = introductionComment.reportAction;
const introductionMessage: AddCommentOrAttachementParams = {
reportID: targetChatReportID,
Expand All @@ -3331,7 +3338,7 @@ function completeOnboarding(
};

// Text message
const textComment = ReportUtils.buildOptimisticAddCommentReportAction(data.message, undefined, actorAccountID, 1);
const textComment = ReportUtils.buildOptimisticAddCommentReportAction(delegateEmail, data.message, undefined, actorAccountID, 1);
const textCommentAction: OptimisticAddCommentReportAction = textComment.reportAction;
const textMessage: AddCommentOrAttachementParams = {
reportID: targetChatReportID,
Expand All @@ -3342,7 +3349,7 @@ function completeOnboarding(
let videoCommentAction: OptimisticAddCommentReportAction | null = null;
let videoMessage: AddCommentOrAttachementParams | null = null;
if (data.video) {
const videoComment = ReportUtils.buildOptimisticAddCommentReportAction(CONST.ATTACHMENT_MESSAGE_TEXT, undefined, actorAccountID, 2);
const videoComment = ReportUtils.buildOptimisticAddCommentReportAction(delegateEmail, CONST.ATTACHMENT_MESSAGE_TEXT, undefined, actorAccountID, 2);
videoCommentAction = videoComment.reportAction;
videoMessage = {
reportID: targetChatReportID,
Expand Down
28 changes: 22 additions & 6 deletions src/pages/home/report/ReportActionItemSingle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import ControlSelection from '@libs/ControlSelection';
import DateUtils from '@libs/DateUtils';
import Navigation from '@libs/Navigation/Navigation';
import {getReportActionMessage} from '@libs/ReportActionsUtils';
import {getPersonalDetailByEmail} from '@libs/PersonalDetailsUtils';
import {getOriginalMessage, getReportActionMessage} from '@libs/ReportActionsUtils';
import * as ReportUtils from '@libs/ReportUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -81,11 +82,15 @@
const StyleUtils = useStyleUtils();
const {translate} = useLocalize();
const personalDetails = usePersonalDetails() ?? CONST.EMPTY_OBJECT;

allgandalf marked this conversation as resolved.
Show resolved Hide resolved
const actorAccountID = ReportUtils.getReportActionActorAccountID(action, iouReport);
const [invoiceReceiverPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report.invoiceReceiver && 'policyID' in report.invoiceReceiver ? report.invoiceReceiver.policyID : -1}`);
const message = getOriginalMessage(action);
const delegateEmail = message?.delegate;

Check failure on line 89 in src/pages/home/report/ReportActionItemSingle.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Property 'delegate' does not exist on type 'OriginalMessage<"ACTIONABLEADDPAYMENTCARD" | "ACTIONABLEJOINREQUEST" | "ACTIONABLEMENTIONWHISPER" | "ACTIONABLEREPORTMENTIONWHISPER" | "ACTIONABLETRACKEXPENSEWHISPER" | "ADDCOMMENT" | ... 127 more ... | "UPDATEROOMDESCRIPTION">'.

Check failure on line 89 in src/pages/home/report/ReportActionItemSingle.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unsafe assignment of an `any` value

let displayName = ReportUtils.getDisplayNameForParticipant(actorAccountID);
const {avatar, login, pendingFields, status, fallbackIcon} = personalDetails[actorAccountID ?? -1] ?? {};
const accountOwnerDetails = getPersonalDetailByEmail(login ?? '');
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
let actorHint = (login || (displayName ?? '')).replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, '');
const isTripRoom = ReportUtils.isTripRoom(report);
Expand All @@ -102,15 +107,15 @@
actorHint = displayName;
avatarSource = ReportUtils.getWorkspaceAvatar(report);
avatarId = report.policyID;
} else if (action?.delegateAccountID && personalDetails[action?.delegateAccountID]) {
} else if (delegateEmail) {
// We replace the actor's email, name, and avatar with the Copilot manually for now. And only if we have their
allgandalf marked this conversation as resolved.
Show resolved Hide resolved
// details. This will be improved upon when the Copilot feature is implemented.
const delegateDetails = personalDetails[action.delegateAccountID];
const delegateAccount = getPersonalDetailByEmail(delegateEmail);

Check failure on line 113 in src/pages/home/report/ReportActionItemSingle.tsx

View workflow job for this annotation

GitHub Actions / Run ESLint

Unsafe argument of type `any` assigned to a parameter of type `string`
const delegateDetails = delegateAccount;
const delegateDisplayName = delegateDetails?.displayName;
actorHint = `${delegateDisplayName} (${translate('reportAction.asCopilot')} ${displayName})`;
displayName = actorHint;
displayName = delegateDisplayName ?? '';
avatarSource = delegateDetails?.avatar;
avatarId = action.delegateAccountID;
avatarId = delegateAccount?.accountID;
} else if (isReportPreviewAction && isTripRoom) {
displayName = report?.reportName ?? '';
}
Expand Down Expand Up @@ -235,6 +240,14 @@
const formattedDate = DateUtils.getStatusUntilDate(status?.clearAfter ?? '');
const statusText = status?.text ?? '';
const statusTooltipText = formattedDate ? `${statusText ? `${statusText} ` : ''}(${formattedDate})` : statusText;
const actionTypes = [
CONST.REPORT.ACTIONS.TYPE.SUBMITTED,
CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT,
CONST.REPORT.ACTIONS.TYPE.APPROVED,
CONST.REPORT.ACTIONS.TYPE.HOLD_COMMENT,
CONST.REPORT.ACTIONS.TYPE.HOLD,
CONST.REPORT.ACTIONS.TYPE.UNHOLD,
];

return (
<View style={[styles.chatItem, wrapperStyle]}>
Expand Down Expand Up @@ -285,6 +298,9 @@
<ReportActionItemDate created={action?.created ?? ''} />
</View>
) : null}
{delegateEmail && actionTypes.includes(action?.actionName) && (

Check failure on line 301 in src/pages/home/report/ReportActionItemSingle.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Argument of type '"ACTIONABLEADDPAYMENTCARD" | "ACTIONABLEJOINREQUEST" | "ACTIONABLEMENTIONWHISPER" | "ACTIONABLEREPORTMENTIONWHISPER" | "ACTIONABLETRACKEXPENSEWHISPER" | "ADDCOMMENT" | ... 128 more ... | undefined' is not assignable to parameter of type '"ADDCOMMENT" | "APPROVED" | "HOLD" | "HOLDCOMMENT" | "SUBMITTED" | "UNHOLD"'.
<Text style={[styles.chatDelegateMessage]}>{translate('delegate.onBehalfOfMessage', accountOwnerDetails?.displayName ?? '')}</Text>
)}
<View style={hasBeenFlagged ? styles.blockquote : {}}>{children}</View>
</View>
</View>
Expand Down
10 changes: 10 additions & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2070,6 +2070,16 @@ const styles = (theme: ThemeColors) =>
...wordBreak.breakWord,
},

chatDelegateMessage: {
color: theme.textSupporting,
fontSize: 11,
...FontUtils.fontFamily.platform.EXP_NEUE,
lineHeight: variables.lineHeightXLarge,
maxWidth: '100%',
...whiteSpace.preWrap,
...wordBreak.breakWord,
},

renderHTMLTitle: {
color: theme.text,
fontSize: variables.fontSizeNormal,
Expand Down
15 changes: 15 additions & 0 deletions src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ type OriginalMessageIOU = {

/** Collection of accountIDs of users mentioned in message */
whisperedTo?: number[];

/** Email of the delegate */
delegate: string;
};

/** Names of moderation decisions */
Expand Down Expand Up @@ -124,6 +127,9 @@ type OriginalMessageAddComment = {

/** List accountIDs are mentioned in message */
mentionedAccountIDs?: number[];

/** Email of the delegate */
delegate: string;
};

/** Model of `actionable mention whisper` report action */
Expand Down Expand Up @@ -157,6 +163,9 @@ type OriginalMessageSubmitted = {

/** Report ID of the expense */
expenseReportID: string;

/** Email of the delegate */
delegate: string;
};

/** Model of `closed` report action */
Expand Down Expand Up @@ -430,6 +439,9 @@ type OriginalMessageApproved = {

/** Report ID of the expense */
expenseReportID: string;

/** Email of the delegate */
delegate: string;
};

/** Model of `forwarded` report action */
Expand Down Expand Up @@ -489,6 +501,9 @@ type OriginalMessageUnapproved = {

/** Report ID of the expense */
expenseReportID: string;

/** Email of the delegate */
delegate: string;
};

/**
Expand Down
Loading
Loading