App icon indicating copy to clipboard operation
App copied to clipboard

[$250] Web - Task - Contact number is not set as an assignee followed by @expensify.sms via [] method

Open kbecciv opened this issue 10 months ago β€’ 15 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.63-0 Reproducible in staging?: y Reproducible in production?: y Issue found when executing PR: https://github.com/Expensify/App/pull/39475 Issue reported by: Applause - Internal Team

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Open any chat
  3. Type [] @<contact number followed by @expensify.sms> <task_name> and send to chat

Expected Result:

Task gets created with the contact number set as the assignee

Actual Result:

No user is filled out as the assignee

Workaround:

n/a

Platforms:

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

  • [ ] Android: Native
  • [ ] Android: mWeb Chrome
  • [ ] iOS: Native
  • [ ] iOS: mWeb Safari
  • [x] MacOS: Chrome / Safari
  • [ ] MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/93399543/ff9a8042-91bb-436e-86a4-67abb513673f

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0107ae9ef02190251b
  • Upwork Job ID: 1783250182918488064
  • Last Price Increase: 2024-04-24
  • Automatic offers:
    • s77rt | Reviewer | 0
    • nkdengineer | Contributor | 0

kbecciv avatar Apr 18 '24 22:04 kbecciv

Triggered auto assignment to @johncschuster (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

melvin-bot[bot] avatar Apr 18 '24 22:04 melvin-bot[bot]

We think that this bug might be related to #vip-vsb

kbecciv avatar Apr 18 '24 23:04 kbecciv

@johncschuster FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors.

kbecciv avatar Apr 18 '24 23:04 kbecciv

Proposal

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

No user is filled out as the assignee

What is the root cause of that problem?

For the mentionWithDomain that we don't have the login data of it in personalDetails, assignee value is empty and then the task is created without assignee.

https://github.com/Expensify/App/blob/68e69623a8bca0dce5f384fa351d5cbb2214aeb4/src/pages/home/report/ReportFooter.tsx#L111

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

If assignee value here is empty object, we should create a optimistic personal detail for this and also create optimistic chat report as we do in setAssigneeValue function here.

https://github.com/Expensify/App/blob/68e69623a8bca0dce5f384fa351d5cbb2214aeb4/src/pages/home/report/ReportFooter.tsx#L111

  1. Create a util like buildOptimisticTaskDataForNewAssingee that will merge the optimistic data to Onyx and return an optimistic personal detail and an optimistic assigneeChatReport
function buildOptimisticTaskDataForNewAssingee(assigneeLogin: string) {
    const assigneeAccountID = UserUtils.generateAccountID(assigneeLogin);
    let report: OnyxEntry<Report> | undefined = buildOptimisticChatReport([assigneeAccountID]);
    report.isOptimisticReport = true;

    // When assigning a task to a new user, by default we share the task in their DM
    // However, the DM doesn't exist yet - and will be created optimistically once the task is created
    // We don't want to show the new DM yet, because if you select an assignee and then change the assignee, the previous DM will still be shown
    // So here, we create it optimistically to share it with the assignee, but we have to hide it until the task is created
    if (report) {
        report.isHidden = true;
    }
    Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report);

    const optimisticPersonalDetailsListAction = {
        accountID: assigneeAccountID,
        avatar: allPersonalDetails?.[assigneeAccountID]?.avatar ?? UserUtils.getDefaultAvatarURL(assigneeAccountID),
        displayName: assigneeLogin,
        login: assigneeLogin,
    };
    Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, {[assigneeAccountID]: optimisticPersonalDetailsListAction});
    return {assignee: optimisticPersonalDetailsListAction, assigneeReport: report}
}
  1. Call the function above here if assignee is empty object to get the optimistic data.
let assignee: OnyxTypes.PersonalDetails | EmptyObject = {};
let assigneeChatReport = undefined;
if (mentionWithDomain) {
    assignee = Object.values(allPersonalDetails).find((value) => value?.login === mentionWithDomain) ?? {};
    if (!Object.keys(assignee).length) {
        const optimisticDataForNewAssignee = ReportUtils.buildOptimisticTaskDataForNewAssingee(mentionWithDomain);
        assignee = optimisticDataForNewAssignee.assignee;
        assigneeChatReport = optimisticDataForNewAssignee.assigneeReport;
    }
}
Task.createTaskAndNavigate(report.reportID, title, '', assignee?.login ?? '', assignee.accountID, assigneeChatReport, report.policyID);

https://github.com/Expensify/App/blob/68e69623a8bca0dce5f384fa351d5cbb2214aeb4/src/pages/home/report/ReportFooter.tsx#L111

What alternative solutions did you explore? (Optional)

NA

nkdengineer avatar Apr 19 '24 07:04 nkdengineer

@johncschuster Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Apr 22 '24 18:04 melvin-bot[bot]

@johncschuster Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Apr 24 '24 18:04 melvin-bot[bot]

Agreed that this fits into #vip-vsb.

johncschuster avatar Apr 24 '24 21:04 johncschuster

Job added to Upwork: https://www.upwork.com/jobs/~0107ae9ef02190251b

melvin-bot[bot] avatar Apr 24 '24 21:04 melvin-bot[bot]

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

melvin-bot[bot] avatar Apr 24 '24 21:04 melvin-bot[bot]

@nkdengineer Thanks for the proposal. Your RCA is correct. The solution looks good to me.

πŸŽ€ πŸ‘€ πŸŽ€ C+ reviewed Link to proposal

s77rt avatar Apr 25 '24 22:04 s77rt

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

melvin-bot[bot] avatar Apr 25 '24 22:04 melvin-bot[bot]

I reported this bug here.. wondering if I am eligible for reporting bounty.

cc @nkuoch @johncschuster

abzokhattab avatar Apr 25 '24 23:04 abzokhattab

πŸ“£ @s77rt πŸŽ‰ 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

melvin-bot[bot] avatar Apr 26 '24 07:04 melvin-bot[bot]

πŸ“£ @nkdengineer πŸŽ‰ 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 πŸ“–

melvin-bot[bot] avatar Apr 26 '24 07:04 melvin-bot[bot]

@s77rt The PR is here.

nkdengineer avatar Apr 28 '24 15:04 nkdengineer

This issue has not been updated in over 15 days. @nkuoch, @johncschuster, @s77rt, @nkdengineer eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

melvin-bot[bot] avatar May 21 '24 18:05 melvin-bot[bot]

PR was deployed to production 2 weeks ago

s77rt avatar May 21 '24 19:05 s77rt

@johncschuster This has been on production for a while, could you help with payments here?

Thanks

nkdengineer avatar Jul 02 '24 16:07 nkdengineer

Payment has been issued. Thanks for your patience on this!

johncschuster avatar Jul 02 '24 18:07 johncschuster

@s77rt do you feel we need a regression test for this? If not, I think we can close this up!

johncschuster avatar Jul 03 '24 15:07 johncschuster

@johncschuster I don't think this needs a regression test. It's unlikely for this to resurface again.

s77rt avatar Jul 03 '24 20:07 s77rt

@nkuoch, @johncschuster, @s77rt, @nkdengineer, this Monthly task hasn't been acted upon in 6 weeks; closing.

If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.

melvin-bot[bot] avatar Aug 30 '24 18:08 melvin-bot[bot]