-
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
Show/hide delete expense button based on Liability type for card transaction #56877
Merged
mountiny
merged 21 commits into
Expensify:main
from
callstack-internal:hide-delete-expense-button-if-card-expense
Mar 5, 2025
Merged
Changes from 5 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e1586d2
Show/hide delete expense button based on feed settings for Company cards
narefyev91 b5600cd
Merge branch 'refs/heads/main' into hide-delete-expense-button-if-car…
narefyev91 ea2eb87
show/hide button based on transaction liability
narefyev91 db6e038
prettier
narefyev91 658078e
fix ts
narefyev91 f04c256
update condition
narefyev91 fb471bb
remove ability to show delete button in context menu
narefyev91 089e966
fix empty transaction
narefyev91 ba8fa7e
Merge branch 'refs/heads/main' into hide-delete-expense-button-if-car…
narefyev91 3cb14b6
fix jest
narefyev91 78a5666
fix jest
narefyev91 20f09c3
add unit test
narefyev91 5c5ffa0
show delete button for card transaction report
narefyev91 c60107a
update condition for report details page
narefyev91 1b4744c
update condition for context menu
narefyev91 5b32275
Merge branch 'refs/heads/main' into hide-delete-expense-button-if-car…
narefyev91 53e8d25
update after c+ review
narefyev91 0ef4703
prettier
narefyev91 e15f660
ts
narefyev91 dbca006
fix jest
narefyev91 2807ce8
add missing money request
narefyev91 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
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
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.
looks like the condition here is actually
isCardTransaction ? transaction?.comment?.liabilityType === CONST.TRANSACTION.LIABILITY_TYPE.ALLOW : shouldShowTaskDeleteButton || canDeleteRequest
?BTW, should we also update the
Delete expense
option in the context menu? or address that in a separate issue?might need to add some similar logic here as well.
App/src/libs/ReportUtils.ts
Lines 2168 to 2181 in 5c4dc1c
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.
Yes i think we should update the logic there and the logic on Search page too - you can also delete expense from there
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.
Yeah from search page we using the same component "Details page" - which already has that logic:

Let me know if that's not only place to take a look... did not find anything else in search area
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.
@mountiny updated all places
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.
This

Delete
option?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.
@ntdiary @narefyev91 yes
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 think in this particular case Delete button reference on API data - for transaction it's coming prop -

canDelete: boolean
.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 see that
liabilityType
is being returned. maybe either fix it on the backend to ensurecanDelete
has the correct value, or consider adding a liabilityType sub-condition on the frontend? I don’t have a strong preference. :DThere 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.
if BE already knows that transaction type will be corporate - i think the flag
canDelete
should also follows the same pattern. @mountiny do you think it will be possible to add check on BE side?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.
Ok, I personally agree that it’s better for the backend to return the correct value and keep it as the source of truth. :)