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

[HOLD for payment 2024-01-25] [HOLD for payment 2024-01-24] [$500] Task - Unable to add Assignee when creating a task #34518

Closed
6 tasks done
lanitochka17 opened this issue Jan 15, 2024 · 27 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 15, 2024

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.25-1
Reproducible in staging?: Y
Reproducible in production?: N
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:

Issue found when executing PR #33852

Action Performed:

  1. Open https://staging.new.expensify.com/
  2. Log in under your HT account
  3. Tap on the green plus button (FAB)
  4. Select Assign task
  5. Fill in the Title and Description fields
  6. Click next
  7. Click on the Assignee field
  8. Try adding any member

Expected Result:

User should be able to add Assignee at the time of task creation

Actual Result:

Unable to add Assignee when creating a task

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6343161_1705336875423.Recording__1082.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ed3d026d1f4f714a
  • Upwork Job ID: 1746959701793779712
  • Last Price Increase: 2024-01-15
  • Automatic offers:
    • ntdiary | Reviewer | 28102476
    • mkhutornyi | Contributor | 28102477
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Jan 15, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

Copy link

melvin-bot bot commented Jan 15, 2024

Triggered auto assignment to @flodnv (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@mkhutornyi
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

User is not able to add assignee in assign task flow

What is the root cause of that problem?

regression from #33426

After adding layout=narrow to route, this condition is no longer met because props.route.params always exists

if (!props.route.params && option.accountID) {
Task.setAssigneeValue(option.login, option.accountID, props.task.shareDestination, OptionsListUtils.isCurrentUser(option));
return Navigation.goBack(ROUTES.NEW_TASK);
}

What changes do you think we should make in order to solve the problem?

Update condition to check reportID existence in params as well:

        if ((!props.route.params || !props.route.params.reportID) && option.accountID) {

@flodnv
Copy link
Contributor

flodnv commented Jan 15, 2024

Can we entirely remove the check for !props.route.params?

@flodnv
Copy link
Contributor

flodnv commented Jan 15, 2024

@mkhutornyi
Copy link
Contributor

Can we entirely remove the check for !props.route.params?

I think there's case when it's undefined (when deeplink /new/task/details directly).
To prevent crash, we can use lodashGet alternatively.

@roryabraham
Copy link
Contributor

// If there's no route params, we're creating a new task

In general I think it's a very bad practice to have logic hinge on whether or not there are route params ... as evidenced by this issue.

It sounds like @mkhutornyi is saying that what we really should have been checking was whether there's a reportID in the route params. (should we also make sure it's valid?)

@roryabraham
Copy link
Contributor

In this case, there's already a local variable report that comes from the reportID in route params. So I think we can update that check to use that existing report variable:

  • Swap out props.route.params with report in the selectReport function
  • Wrap selectReport with useCallback
**Full diff**
diff --git a/src/pages/tasks/TaskAssigneeSelectorModal.js b/src/pages/tasks/TaskAssigneeSelectorModal.js
index a4fc61910b..cc2bf96432 100644
--- a/src/pages/tasks/TaskAssigneeSelectorModal.js
+++ b/src/pages/tasks/TaskAssigneeSelectorModal.js
@@ -184,29 +184,32 @@ function TaskAssigneeSelectorModal(props) {
         return sectionsList;
     }, [filteredCurrentUserOption, filteredPersonalDetails, filteredRecentReports, filteredUserToInvite, props]);
 
-    const selectReport = (option) => {
-        if (!option) {
-            return;
-        }
+    const selectReport = useCallback(
+        (option) => {
+            if (!option) {
+                return;
+            }
 
-        // Check to see if we're creating a new task
-        // If there's no route params, we're creating a new task
-        if (!props.route.params && option.accountID) {
-            Task.setAssigneeValue(option.login, option.accountID, props.task.shareDestination, OptionsListUtils.isCurrentUser(option));
-            return Navigation.goBack(ROUTES.NEW_TASK);
-        }
+            // Check to see if we're creating a new task
+            // If there's no route params, we're creating a new task
+            if (!report && option.accountID) {
+                Task.setAssigneeValue(option.login, option.accountID, props.task.shareDestination, OptionsListUtils.isCurrentUser(option));
+                return Navigation.goBack(ROUTES.NEW_TASK);
+            }
 
-        // Check to see if we're editing a task and if so, update the assignee
-        if (report) {
-            if (option.accountID !== report.managerID) {
-                const assigneeChatReport = Task.setAssigneeValue(option.login, option.accountID, props.route.params.reportID, OptionsListUtils.isCurrentUser(option));
+            // Check to see if we're editing a task and if so, update the assignee
+            if (report) {
+                if (option.accountID !== report.managerID) {
+                    const assigneeChatReport = Task.setAssigneeValue(option.login, option.accountID, report.reportID, OptionsListUtils.isCurrentUser(option));
 
-                // Pass through the selected assignee
-                Task.editTaskAssignee(report, props.session.accountID, option.login, option.accountID, assigneeChatReport);
+                    // Pass through the selected assignee
+                    Task.editTaskAssignee(report, props.session.accountID, option.login, option.accountID, assigneeChatReport);
+                }
+                return Navigation.dismissModal(report.reportID);
             }
-            return Navigation.dismissModal(report.reportID);
-        }
-    };
+        },
+        [props.session.accountID, props.task.shareDestination, report],
+    );
 
     const isOpen = ReportUtils.isOpenTaskReport(report);
     const canModifyTask = Task.canModifyTask(report, props.currentUserPersonalDetails.accountID, lodashGet(props.rootParentReportPolicy, 'role', ''));

@mkhutornyi
Copy link
Contributor

if (!props.route.params && option.accountID) {
Task.setAssigneeValue(option.login, option.accountID, props.task.shareDestination, OptionsListUtils.isCurrentUser(option));
return Navigation.goBack(ROUTES.NEW_TASK);
}
// Check to see if we're editing a task and if so, update the assignee
if (report) {

This can be simply if (report) {} else if (option.accountID) {}

@roryabraham roryabraham added the Bug Something is broken. Auto assigns a BugZero manager. label Jan 15, 2024
Copy link

melvin-bot bot commented Jan 15, 2024

Triggered auto assignment to @NicMendonca (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@roryabraham
Copy link
Contributor

Actually, hold off for one sec, @mkhutornyi I might've been too quick to assign you.

@roryabraham roryabraham added the External Added to denote the issue can be worked on by a contributor label Jan 15, 2024
@melvin-bot melvin-bot bot changed the title Task - Unable to add Assignee when creating a task [$500] Task - Unable to add Assignee when creating a task Jan 15, 2024
Copy link

melvin-bot bot commented Jan 15, 2024

Job added to Upwork: https://www.upwork.com/jobs/~01ed3d026d1f4f714a

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 15, 2024
Copy link

melvin-bot bot commented Jan 15, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @ntdiary (External)

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 15, 2024
Copy link

melvin-bot bot commented Jan 15, 2024

📣 @ntdiary 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jan 15, 2024

📣 @mkhutornyi 🎉 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 📖

@roryabraham
Copy link
Contributor

roryabraham commented Jan 15, 2024

@mkhutornyi this is an Hourly issue, which means you should leave a comment with your progress at least every hour. When do you estimate you'll have a PR ready for review?

@mkhutornyi
Copy link
Contributor

in an hour

@mkhutornyi
Copy link
Contributor

PR is up

@roryabraham roryabraham self-assigned this Jan 15, 2024
@mountiny mountiny removed the DeployBlockerCash This issue or pull request should block deployment label Jan 16, 2024
@mountiny
Copy link
Contributor

Tested, fixed, thanks!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 17, 2024
@melvin-bot melvin-bot bot changed the title [$500] Task - Unable to add Assignee when creating a task [HOLD for payment 2024-01-24] [$500] Task - Unable to add Assignee when creating a task Jan 17, 2024
Copy link

melvin-bot bot commented Jan 17, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 17, 2024
Copy link

melvin-bot bot commented Jan 17, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.25-10 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-01-24. 🎊

For reference, here are some details about the assignees on this issue:

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jan 18, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-01-24] [$500] Task - Unable to add Assignee when creating a task [HOLD for payment 2024-01-25] [HOLD for payment 2024-01-24] [$500] Task - Unable to add Assignee when creating a task Jan 18, 2024
Copy link

melvin-bot bot commented Jan 18, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.26-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-01-25. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Jan 18, 2024

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:

@flodnv
Copy link
Contributor

flodnv commented Jan 29, 2024

Regression proposal:

  1. Tap on the green plus button on the main screen of the app (FAB)
  2. Select Assign task
  3. Fill in the Title and Description fields
  4. Click next
  5. Click on the Assignee field
  6. Try adding any member
  7. Select 'share somewhere' to someone else
  8. Create the task
  9. Make sure it is sent and assigned to the member from (6), and shared to the other person from (7).

@melvin-bot melvin-bot bot removed the Overdue label Jan 29, 2024
@mkhutornyi
Copy link
Contributor

mkhutornyi commented Jan 29, 2024

This regression test case might already exist since this was deploy blocker (caught during staging regression testing)

  • [@mkhutornyi] Determine if we should create a regression test for this bug.
  • [@mkhutornyi] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

@NicMendonca
Copy link
Contributor

@mkhutornyi you've been paid! all set here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants