-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix owner tooltip for expense reports #51180
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9bfa9c2
fix owner tooltip
grgia 3121917
match pattern
grgia 795b44f
set actor to owner for expense reports
grgia 5689ea9
move to utils
grgia a307b07
Merge branch 'main' into georgia-fixTooltip
grgia 67e7df3
Merge branch 'main' into georgia-fixTooltip
grgia b029e64
type error
grgia 69ad164
clean up
grgia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,7 +85,9 @@ function ReportActionItemSingle({ | |
const personalDetails = usePersonalDetails() ?? CONST.EMPTY_OBJECT; | ||
const policy = usePolicy(report?.policyID); | ||
const delegatePersonalDetails = personalDetails[action?.delegateAccountID ?? '']; | ||
const actorAccountID = ReportUtils.getReportActionActorAccountID(action, iouReport); | ||
const ownerAccountID = iouReport?.ownerAccountID ?? action?.childOwnerAccountID; | ||
const isReportPreviewAction = action?.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW; | ||
const actorAccountID = ReportUtils.getReportActionActorAccountID(action, iouReport, report); | ||
const [invoiceReceiverPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.invoiceReceiver && 'policyID' in report.invoiceReceiver ? report.invoiceReceiver.policyID : -1}`); | ||
|
||
let displayName = ReportUtils.getDisplayNameForParticipant(actorAccountID); | ||
|
@@ -94,20 +96,13 @@ function ReportActionItemSingle({ | |
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
let actorHint = (login || (displayName ?? '')).replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, ''); | ||
const isTripRoom = ReportUtils.isTripRoom(report); | ||
const isReportPreviewAction = action?.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW; | ||
const displayAllActors = isReportPreviewAction && !isTripRoom && !ReportUtils.isPolicyExpenseChat(report); | ||
const isInvoiceReport = ReportUtils.isInvoiceReport(iouReport ?? null); | ||
const isWorkspaceActor = isInvoiceReport || (ReportUtils.isPolicyExpenseChat(report) && (!actorAccountID || displayAllActors)); | ||
const ownerAccountID = iouReport?.ownerAccountID ?? action?.childOwnerAccountID; | ||
|
||
let avatarSource = avatar; | ||
let avatarId: number | string | undefined = actorAccountID; | ||
|
||
if (isReportPreviewAction && ReportUtils.isPolicyExpenseChat(report)) { | ||
avatarId = ownerAccountID; | ||
avatarSource = personalDetails[ownerAccountID ?? -1]?.avatar; | ||
displayName = ReportUtils.getDisplayNameForParticipant(ownerAccountID); | ||
actorHint = displayName; | ||
} | ||
if (isWorkspaceActor) { | ||
displayName = ReportUtils.getPolicyName(report, undefined, policy); | ||
actorHint = displayName; | ||
|
@@ -220,7 +215,7 @@ function ReportActionItemSingle({ | |
} | ||
return ( | ||
<UserDetailsTooltip | ||
accountID={Number(actorAccountID ?? -1)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
accountID={Number(icon.id ?? -1)} | ||
delegateAccountID={Number(action?.delegateAccountID ?? -1)} | ||
icon={icon} | ||
> | ||
|
@@ -271,7 +266,7 @@ function ReportActionItemSingle({ | |
<ReportActionItemFragment | ||
// eslint-disable-next-line react/no-array-index-key | ||
key={`person-${action?.reportActionID}-${index}`} | ||
accountID={actorAccountID ?? -1} | ||
accountID={Number(icon.id) ?? -1} | ||
fragment={{...fragment, type: fragment.type ?? '', text: fragment.text ?? ''}} | ||
delegateAccountID={action?.delegateAccountID} | ||
isSingleLine | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to understand this logic as I need to fix a similar issue over here.
Could you give me an example of when
actorAccountID
(managerID
) should be used for a report action?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In IOU's report preview

Otherwise it would look like this
