-
Notifications
You must be signed in to change notification settings - Fork 3k
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 - Domain Card - User can edit the date in expenses related to the assigned domain card #39244
Fix - Domain Card - User can edit the date in expenses related to the assigned domain card #39244
Conversation
@allroundexperts Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@FitseTLT I don't have access to the email address you mentioned in test steps. Can you please write proper test steps instead of copying them over from the issue? |
For dev purpose we follow https://expensify.slack.com/archives/C01GTK53T8Q/p1705450786474319?thread_ts=1705450150.383239&cid=C01GTK53T8Q |
You should mention https://expensify.slack.com/archives/C01GTK53T8Q/p1705450786474319?thread_ts=1705450150.383239&cid=C01GTK53T8Q in test steps. The steps currently there should be in the |
Yep make sense |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-04-02.at.5.08.55.PM.movAndroid: mWeb ChromeScreen.Recording.2024-04-02.at.5.08.15.PM.moviOS: NativeScreen.Recording.2024-04-02.at.5.07.50.PM.moviOS: mWeb SafariScreen.Recording.2024-04-02.at.5.06.35.PM.movMacOS: Chrome / SafariScreen.Recording.2024-04-02.at.5.01.31.PM.movMacOS: DesktopScreen.Recording.2024-04-02.at.5.05.26.PM.mov |
@FitseTLT Conflicts now. |
U can proceed @allroundexperts |
const parentReportAction = reportActions?.[(isEditingSplitBill ? reportActionID : report?.parentReportActionID) ?? 0]; | ||
const canEditingSplitBill = | ||
isEditingSplitBill && session && parentReportAction && session.accountID === parentReportAction.actorAccountID && TransactionUtils.areRequiredFieldsEmpty(transaction); | ||
const canEditMoneyRequest = isEditing && ReportUtils.canEditFieldOfMoneyRequest(parentReportAction ?? null, CONST.EDIT_REQUEST_FIELD.DATE); | ||
// eslint-disable-next-line rulesdir/no-negated-variables | ||
const shouldShowNotFound = !IOUUtils.isValidMoneyRequestType(iouType) || (isEditing && !canEditMoneyRequest && !canEditingSplitBill); |
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.
Why is this change required @FitseTLT? I think this is getting way too complicated.
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 I know. But we need to do it if we want to fix deep link access u mentioned. This is what we did to tag and category pages. It is basically displaying not found page when users are not allowed to edit the date and the logic for permission to edit the field, I took it the logic we use to enable the clicking of the date field in the money request view.
App/src/components/ReportActionItem/MoneyRequestView.tsx
Lines 143 to 144 in 20be55b
const canEditDate = ReportUtils.canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.DATE); | |
const canEditReceipt = ReportUtils.canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.RECEIPT); |
But an additional case we need to consider is for SplitBillDetailsPage (When we create split request with receipt), and for that the logic is taken from
App/src/pages/iou/SplitBillDetailsPage.tsx
Lines 79 to 80 in 20be55b
const isEditingSplitBill = session?.accountID === reportAction?.actorAccountID && TransactionUtils.areRequiredFieldsEmpty(transaction); | |
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.
@FitseTLT Isn't ReportUtils.canEditFieldOfMoneyRequest
function enough to do the job? Can you share the relevant checks on tags and categories page?
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.
App/src/pages/iou/request/step/IOURequestStepTag.tsx
Lines 70 to 84 in 63223bc
const isEditing = action === CONST.IOU.ACTION.EDIT; | |
const isSplitBill = iouType === CONST.IOU.TYPE.SPLIT; | |
const isEditingSplitBill = isEditing && isSplitBill; | |
const currentTransaction = isEditingSplitBill && !isEmptyObject(splitDraftTransaction) ? splitDraftTransaction : transaction; | |
const transactionTag = TransactionUtils.getTag(currentTransaction); | |
const tag = TransactionUtils.getTag(currentTransaction, tagListIndex); | |
const reportAction = reportActions?.[report?.parentReportActionID ?? reportActionID]; | |
const canEditSplitBill = isSplitBill && reportAction && session?.accountID === reportAction.actorAccountID && TransactionUtils.areRequiredFieldsEmpty(transaction); | |
const policyTagLists = useMemo(() => PolicyUtils.getTagLists(policyTags), [policyTags]); | |
const shouldShowTag = ReportUtils.isGroupPolicy(report) && (transactionTag || OptionsListUtils.hasEnabledTags(policyTagLists)); | |
// eslint-disable-next-line rulesdir/no-negated-variables | |
const shouldShowNotFoundPage = !shouldShowTag || (isEditing && (isSplitBill ? !canEditSplitBill : reportAction && !canEditMoneyRequest(reportAction))); | |
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.
Isn't ReportUtils.canEditFieldOfMoneyRequest function enough to do the job
Can you please answer above?
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.
Nope it is not enough because we have to include the case of split detail page that is what I have included and I have given you a perfect similar example done for tag.
Conflicts again @FitseTLT. Lets try to wrap this up. |
@allroundexperts You can proceed. |
@allroundexperts Is there anything I can help with? Can we move this forward? |
Hi @FitseTLT! Can you please resolve conflicts? |
@allroundexperts can u please review it this time? |
const policy = getPolicy(moneyRequestReport?.reportID ?? ''); | ||
const isAdmin = isExpenseReport(moneyRequestReport) && policy.role === CONST.POLICY.ROLE.ADMIN; | ||
const isManager = isExpenseReport(moneyRequestReport) && currentUserAccountID === moneyRequestReport?.managerID; | ||
if ((fieldToEdit === CONST.EDIT_REQUEST_FIELD.AMOUNT || fieldToEdit === CONST.EDIT_REQUEST_FIELD.CURRENCY) && TransactionUtils.isDistanceRequest(transaction)) { |
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.
Why do we need to change this condition @FitseTLT?
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 was taken from here
Lines 2623 to 2624 in 004b3af
if (TransactionUtils.isDistanceRequest(transaction)) { | |
const policy = getPolicy(moneyRequestReport?.reportID ?? ''); |
As we took this
Lines 2619 to 2621 in 004b3af
if (TransactionUtils.isCardTransaction(transaction)) { | |
return false; | |
} |
out of its code block
I had to centralize the condition in one if
Verified it to be still working well. Screen.Recording.2024-05-06.at.3.03.22.AM.mov |
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 good!
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.
Thanks!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by https://github.com/marcaaron in version: 1.4.71-6 🚀
|
Details
Fixed Issues
$#36616
PROPOSAL: #36616 (comment)
Tests
transactionID
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
and.2.mp4
Android: mWeb Chrome
and.web2.mp4
iOS: Native
ios.2.mp4
iOS: mWeb Safari
ios.web.2.mp4
MacOS: Chrome / Safari
web.2.mp4
MacOS: Desktop
desk.2.mp4