Closed kbecciv closed 8 months ago
Job added to Upwork: https://www.upwork.com/jobs/~01c0cdfb5367dcebe3
Triggered auto assignment to @garrettmknight (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are β
)Triggered auto assignment to Contributor-plus team member for initial proposal review - @narefyev91 (External
)
We can access task assignee page even though we don't have access to.
We already have a condition here to disable it if the user doesn't have the permission (canModifyTask). https://github.com/Expensify/App/blob/b3ecf327c585ca323a628405f4ffc70877c601a0/src/pages/tasks/TaskAssigneeSelectorModal.js#L208-L209
But the problem here is that the rootParentReportPolicy
is always empty. If we look at how we get that data, we can see that it depends on report
onyx data, but we never have the report
data, we only subscribe to reports
(the whole collection) data.
https://github.com/Expensify/App/blob/b3ecf327c585ca323a628405f4ffc70877c601a0/src/pages/tasks/TaskAssigneeSelectorModal.js#L249-L252
https://github.com/Expensify/App/blob/b3ecf327c585ca323a628405f4ffc70877c601a0/src/pages/tasks/TaskAssigneeSelectorModal.js#L262-L268
So, report
is always empty.
Add a new Onyx subscription to get the current report
, just like we do in other places. (put it before rootParentReportPolicy
)
report: {
key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${lodashGet(route, 'params.reportID')}`,
},
With this change, we can now remove this code and replace all of its usage with the report
from the props.
https://github.com/Expensify/App/blob/b3ecf327c585ca323a628405f4ffc70877c601a0/src/pages/tasks/TaskAssigneeSelectorModal.js#L129-L134
Task assignee list opens.
In here, we're relying on the report
in order to get the rootParentReportPolicy
, however, on that page we're not getting the report
, we get the full reports
collection as can be seen here. This is because this selector modal is used in both create and edit case, when used in edit case, it has the reportID
, when used in create case, it does not.
This leads to the report
here to always be empty, the rootParentReportPolicy
will be empty and the canModifyTask
here is true, which is incorrect. This causes the user to be able to access that page.
In here, we should use the reports
instead, and get the report
via the route.params.reportID
similar to here to use to get the rootParentReportPolicy
.
I believe it's intentional to not connect to the report
key in Onyx since the data is already available in reports
and we don't want extra (double) rerendering of the assignee page due to that redundant key.
Optionally, since both this change and this existing code are getting the report via reportID
and reports
, we can modify this util to accept a second reports
param (which defaults to the allReports
) and use it in both places for DRY.
NA
Task - Task assignee list opens with deep link when user has no access to edit task
We did get report
as props of parent on TaskAssigneeSelectorModal
so props.rootParentReportPolicy
is empty on TaskAssigneeSelectorModal
We can passed from reportID
from param.
rootParentReportPolicy: {
key: ({route}) => {
const report = ReportUtils.getReport(route.params.reportID)
const rootParentReport = ReportUtils.getRootParentReport(report);
return `${ONYXKEYS.COLLECTION.POLICY}${rootParentReport ? rootParentReport.policyID : '0'}`;
},
selector: (policy) => _.pick(policy, ['role']),
},
Proposal from @dukenv0307 looks good to me https://github.com/Expensify/App/issues/33296#issuecomment-1863051968 In case that we already have all reports at this page - no needs to have additional subscription to specific report from onyx Let's just work with reports and reportId π π π C+ reviewed
Triggered auto assignment to @lakchote, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@narefyev91 I think having a different way to get the report
object (to optimize it) is something that can be discussed on the PR stage itself.
@narefyev91 I think having a different way to get the report object (to optimize it) is something that can be discussed on the PR stage itself.
I think this issue is straightforward so an optimized solution that doesn't degrade performance should be preferred before we get to the PR, where we might or might not realize the issue and could have the bad code merged.
@dukenv0307's proposal LGTM π
π£ @dukenv0307 π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
Taking this over.
@narefyev91 this PR is ready for review.
π£ @c3024 π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
@c3024 you're up!
PR review done. Awaiting final approval for merge by @lakchote
Triggered auto assignment to @robertjchen (Engineering
), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
Reassigning since @lakchote is out for parental leave.
Merged!
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.21-4 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-01-11. :confetti_ball:
After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
/assignee
to the end of the URL and visit the URLπ or π
Everybody's paid and the QA issue is up. Closing!
If you havenβt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.14.0 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:
Action Performed:
Precondition:
Expected Result:
Not here page opens.
Actual Result:
Task assignee list opens.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/93399543/032635f8-42b0-445b-9c4f-bb89e19327b9
View all open jobs on GitHub
Upwork Automation - Do Not Edit