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 2023-09-11] [$1000] Task - Time zone message for assignee disappears and does not update when changing assignee #24420

Closed
1 of 6 tasks
lanitochka17 opened this issue Aug 11, 2023 · 42 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 11, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Go to staging.new.expensify.com
  2. Assign a task to User A and select User B as Share somewhere destination
  3. Open the task detail page
  4. Tap on Assignee and change assignee to User C

Expected Result:

The time zone message for task assignee above composer will update with the new assignee

Actual Result:

The time zone message for task assignee disappears and never updates to a new one

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • Windows / Chrome
  • MacOS / Desktop

Version Number: 1.3.53.1

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Notes/Photos/Videos: Any additional supporting documentation

Bug6161026_bandicam_2023-08-11_12-56-28-195.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~016b86a5af45ed94fa
  • Upwork Job ID: 1690077183610470400
  • Last Price Increase: 2023-08-11
  • Automatic offers:
    • tienifr | Contributor | 26202460
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 11, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 11, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@StevenKKC
Copy link
Contributor

StevenKKC commented Aug 11, 2023

Proposal

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

Time zone message for assignee disappears and does not update when changing assignee.

What is the root cause of that problem?

If create a task, app does not set the task report's participantAccountIDs field, and CreateTask API does not return participantAccountIDs.

App/src/libs/ReportUtils.js

Lines 2205 to 2217 in 39ae317

function buildOptimisticTaskReport(ownerAccountID, assigneeAccountID = 0, parentReportID, title, description) {
return {
reportID: generateReportID(),
reportName: title,
description,
ownerAccountID,
managerID: assigneeAccountID,
type: CONST.REPORT.TYPE.TASK,
parentReportID,
stateNum: CONST.REPORT.STATE_NUM.OPEN,
statusNum: CONST.REPORT.STATUS.OPEN,
};
}

Screenshot 2023-08-11 133232

And ReportUtils.canShowReportRecipientLocalTime checks the report's participantAccountIDs.

App/src/libs/ReportUtils.js

Lines 813 to 829 in 39ae317

function canShowReportRecipientLocalTime(personalDetails, report, accountID) {
const reportParticipants = _.without(lodashGet(report, 'participantAccountIDs', []), accountID);
const participantsWithoutExpensifyAccountIDs = _.difference(reportParticipants, CONST.EXPENSIFY_ACCOUNT_IDS);
const hasMultipleParticipants = participantsWithoutExpensifyAccountIDs.length > 1;
const reportRecipient = personalDetails[participantsWithoutExpensifyAccountIDs[0]];
const reportRecipientTimezone = lodashGet(reportRecipient, 'timezone', CONST.DEFAULT_TIME_ZONE);
const isReportParticipantValidated = lodashGet(reportRecipient, 'validated', false);
return Boolean(
!hasMultipleParticipants &&
!isChatRoom(report) &&
!isPolicyExpenseChat(report) &&
reportRecipient &&
reportRecipientTimezone &&
reportRecipientTimezone.selected &&
isReportParticipantValidated,
);
}

So after create a task, does not show time zone for assignee.

After go to the parent report and navigate back, or refresh the task page, app sends OpenReport API to BE, and then BE returns the report that has participantAccountIDs field.
So in this time, app shows time zone for assignee.
Screenshot 2023-08-11 133306

If we change the task assignee, app does not change the report's participantAccountIDs field, so app still shows the previous task assignee's time zone.
Screenshot 2023-08-11 133335

But if we go to the parent report and navigate back, or refresh the task page, OpenReport API returns the report that has participantAccountIDs with two account ids (the original and current task assignee ids).
Screenshot 2023-08-11 133404

So app does not show time zone for assignee.

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

For the task report, we should show the report managerID's time zone instead of participantAccountIDs in this line.

const reportRecipient = ReportUtils.isTaskReport(this.props.report) ? this.props.personalDetails[this.props.report.managerID] : this.props.personalDetails[participantsWithoutExpensifyAccountIDs[0]];

And we should modify ReportUtils.canShowReportRecipientLocalTime to return true for the task report.

    if (isTaskReport(report) && report.managerID !== 0) {
        return true;
    }

What alternative solutions did you explore? (Optional)

None.

@joekaufmanexpensify
Copy link
Contributor

Yeah, I can reproduce this. Given we show the timezone of the task initial assignee, I think we'd want to update this if the assignee changes (perhaps unless you assign to yourself)?

I also think we'd want to show the timezone of the assignee, as soon as they are assigned (rather than having to click out and back into the task).

2023-08-11_14-59-26.mp4

@joekaufmanexpensify joekaufmanexpensify added the External Added to denote the issue can be worked on by a contributor label Aug 11, 2023
@melvin-bot melvin-bot bot changed the title Task - Time zone message for assignee disappears and does not update when changing assignee [$1000] Task - Time zone message for assignee disappears and does not update when changing assignee Aug 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 11, 2023

Job added to Upwork: https://www.upwork.com/jobs/~016b86a5af45ed94fa

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 11, 2023

Current assignee @joekaufmanexpensify is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Aug 11, 2023

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

@tienifr
Copy link
Contributor

tienifr commented Aug 12, 2023

Proposal

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

The time zone message for task assignee disappears and never updates to a new one

What is the root cause of that problem?

We're not actively using the participantAccountIDs when operating with tasks:

  • We're not adding/editing it optimistically when creating/editing the task
  • When the assignee changes, BE is returning the participantAccountIDs with both the old assignee and new assignee

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

For task report, we should use the managerID instead to determine the recipient local time.

  1. Create a new getReportRecipientAccountIDs method to get the recipientAccountIDs, which works well for both regular report and task report. For task report, it should exclude current user account id if the task is assigned to current user.
function getReportRecipientAccountIDs(report, currentLoginAccountID) {
    const participantAccountIDs = isTaskReport(report) ? [report.managerID] : lodashGet(report, 'participantAccountIDs');
    const reportParticipants = _.without(participantAccountIDs, currentLoginAccountID);
    const participantsWithoutExpensifyAccountIDs = _.difference(reportParticipants, CONST.EXPENSIFY_ACCOUNT_IDS);
    return participantsWithoutExpensifyAccountIDs;
}
  1. Use the above method in the canShowReportRecipientLocalTime here
const reportRecipientAccountIDs = getReportRecipientAccountIDs(report, accountID)
const hasMultipleParticipants = reportRecipientAccountIDs.length > 1;
const reportRecipient = personalDetails[reportRecipientAccountIDs[0]];

Other logic must remain, so we can ensure that if the task assignee did not reply to the current user, their personal timezone will not show which protects their privacy
3. Use the above method when getting the reportRecipient below this line

const reportRecipientAcountIDs = ReportUtils.getReportRecipientAccountIDs(this.props.report, this.props.currentUserPersonalDetails.accountID);
const reportRecipient = this.props.personalDetails[reportRecipientAcountIDs[0]];

The above method will also help remove the existing duplicated logic of getting the list of recipient account IDs between the canShowReportRecipientLocalTime and ReportActionCompose

What alternative solutions did you explore? (Optional)

We can handle the participantAccountIDs properly when operating with tasks:

  • Add/Edit it optimistically when creating/editing the task
  • When the assignee changes, BE should return participantAccountIDs that contains only the new assignee
  • If current user is assigned to the task, participantAccountIDs should be empty (BE should return empty as well)
  • Make sure participantAccountIDs is correct in all statuses of the task

@Tony-MK
Copy link
Contributor

Tony-MK commented Aug 12, 2023

Proposal

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

The time zone message for the assignee disappears and does not update when changing the assignee. Also does not show the Time zone immediately when the task is created as @joekaufmanexpensify
stated in #24420 (comment).

What is the root cause of that problem?

When the reportRecipient object is fetched, it uses the first participant id in the participantsWithoutExpensifyAccountIDs array. Therefore, when the assignee of the task changes, the new assignee is pushed to the bottom of the array. Hence, the reportRecipient variable won't change to the current assignee.

const reportRecipient = this.props.personalDetails[participantsWithoutExpensifyAccountIDs[0]];

const reportRecipient = personalDetails[participantsWithoutExpensifyAccountIDs[0]];

Also, the function canShowReportRecipientLocalTime returns false when the participantsWithoutExpensifyAccountIDs array has more than one participant.

const hasMultipleParticipants = participantsWithoutExpensifyAccountIDs.length > 1;

App/src/libs/ReportUtils.js

Lines 820 to 828 in 1e3f952

return Boolean(
!hasMultipleParticipants &&
!isChatRoom(report) &&
!isPolicyExpenseChat(report) &&
reportRecipient &&
reportRecipientTimezone &&
reportRecipientTimezone.selected &&
isReportParticipantValidated,
);

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

  1. We need to use the report.managerID when fetching the value for reportRecipient because the report.managerID variable is the id of the current assignee. Change the lines from the two first permalinks. To fetch the suitable reportRecipient value when the report is a task.

const reportRecipient = this.props.personalDetails[ReportUtils.isTaskReport(this.props.report) ? this.props.report.managerID : participantsWithoutExpensifyAccountIDs[0]]

const reportRecipient = personalDetails[isTaskReport(report) ? report.managerID : participantsWithoutExpensifyAccountIDs[0]]

  1. The function canShowReportRecipientLocalTime needs to return true if a report of type task is not assigned to the owner. Regardless of the size of participants it has.

!hasMultipleParticipants &&

Change the line above as below to satisfy the conditions of a report of type task.

isTaskReport(report) ? report.managerID != report.ownerID : !hasMultipleParticipants

@melvin-bot melvin-bot bot added the Overdue label Aug 14, 2023
@joekaufmanexpensify
Copy link
Contributor

Proposals pending review

@melvin-bot melvin-bot bot removed the Overdue label Aug 14, 2023
@joekaufmanexpensify
Copy link
Contributor

@sobitneupane mind taking a look at proposals here when you have a chance?

@sobitneupane
Copy link
Contributor

Thanks for proposal everyone.

@tienifr's proposal looks good to me.

🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Aug 16, 2023

Triggered auto assignment to @youssef-lr, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@joekaufmanexpensify
Copy link
Contributor

Pending review of proposal

@joekaufmanexpensify
Copy link
Contributor

@youssef-lr could you confirm whether we're good to proceed with this proposal when you have a sec? TY!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 2023

📣 @sobitneupane Please request via NewDot manual requests for the Reviewer role ($1000)

@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 2023

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

@youssef-lr
Copy link
Contributor

Proposal looks good to me as well.

@melvin-bot
Copy link

melvin-bot bot commented Sep 4, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.62-4 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 2023-09-11. 🎊

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.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Sep 4, 2023

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:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR: I don't think specific PR is responsible for this issue. We used existing canShowReportRecipientLocalTime function in Task Report as well which behave quite differently.
  • [@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: N/A
  • [@sobitneupane] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: N/A
  • [@sobitneupane] Determine if we should create a regression test for this bug.
  • [@sobitneupane] 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.
  • [@joekaufmanexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/316625

@joekaufmanexpensify
Copy link
Contributor

Payment due in a week. @sobitneupane mind completing the BZ checklist this week?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 Daily KSv2 labels Sep 11, 2023
@joekaufmanexpensify
Copy link
Contributor

joekaufmanexpensify commented Sep 11, 2023

@sobitneupane mind completing BZ checklist so we can issue payment?

@joekaufmanexpensify
Copy link
Contributor

Bumped in Slack.

@joekaufmanexpensify
Copy link
Contributor

Still pending.

@sobitneupane
Copy link
Contributor

sobitneupane commented Sep 13, 2023

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:

  • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:

I don't think specific PR is responsible for this issue. We used existing canShowReportRecipientLocalTime function in Task Report as well which behave quite differently.

  • [@sobitneupane] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

N/A

  • [@sobitneupane] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:

Not required.

  • [@sobitneupane] Determine if we should create a regression test for this bug.

Yes

  • [@sobitneupane] 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.

#24420 (comment)

@sobitneupane
Copy link
Contributor

Regression Test Proposal

  1. Assign a task to User A and select User B as Share somewhere destination
  2. Open the task detail page
  3. Tap on Assignee and change assignee to User C
  4. Verify that the time zone message for task assignee above composer will update with the new assignee

Do we agree 👍 or 👎

@joekaufmanexpensify
Copy link
Contributor

BZ checklist is complete!

@joekaufmanexpensify
Copy link
Contributor

All set to issue payment.

@joekaufmanexpensify
Copy link
Contributor

This one does not qualify for the bonus. So we need to make the following payments:

@joekaufmanexpensify
Copy link
Contributor

@sobitneupane mind requesting $1,000 via NewDot and confirming here once complete? TY!

@joekaufmanexpensify
Copy link
Contributor

@tienifr $1,000 sent and contract ended!

@joekaufmanexpensify
Copy link
Contributor

Bumped payment request in NewDot.

@joekaufmanexpensify
Copy link
Contributor

@sobitneupane could you please submit your payment request here so we can close this?

@sobitneupane
Copy link
Contributor

@joekaufmanexpensify I am waiting to receive payment for the older requests. Once it is done, I will request payment for this one. It should not take long.

@joekaufmanexpensify
Copy link
Contributor

Got it, sounds good! Moving to weekly then in the interim.

@joekaufmanexpensify joekaufmanexpensify added Weekly KSv2 and removed Daily KSv2 labels Sep 21, 2023
@joekaufmanexpensify
Copy link
Contributor

@sobitneupane any update on this?

@sobitneupane
Copy link
Contributor

Requested payment on newDot.

#24420 (comment)

@joekaufmanexpensify
Copy link
Contributor

TY! Closing this for now. Payment summary message is here.

@JmillsExpensify
Copy link

$1,000 payment approved for @sobitneupane based on BZ summary.

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants