Skip to content

[$1000] Task - Avatar for the same new user is different in Assignee and Share somewhere fields #24078

Closed

Description

@lanitochka17

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. Click + > Assign task.
  3. Enter title > Next.
  4. Enter an email that does not have a NewDot account

Expected Result:

Avatar for the same new user is the same in Assignee and Share somewhere fields

Actual Result:

Avatar for the same new user is different in Assignee and Share somewhere fields

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.49.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

Bug6150889_bandicam_2023-08-03_03-31-51-155.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/~013ee9160400af123a
  • Upwork Job ID: 1687218399795974144
  • Last Price Increase: 2023-09-22

Activity

  1. added
    Daily
    Bug
    on Aug 2, 2023
  2. melvin-bot commented on Aug 2, 2023

    @melvin-bot

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

  3. melvin-bot commented on Aug 2, 2023

    @melvin-bot

    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
  4. dummy-1111 commented on Aug 3, 2023

    @dummy-1111
    Contributor

    Proposal

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

    Avatar for the same new user is different in assignee and share destination fields

    What is the root cause of that problem?

    When task is created with a new user, new chat is created with the new user and set the new reportID to the shareDestination.

    if (!isCurrentUser) {
    let newChat = {};
    const chat = ReportUtils.getChatByParticipants([newAssigneeAccountID]);
    if (!chat) {
    newChat = ReportUtils.buildOptimisticChatReport([newAssigneeAccountID]);
    }
    const reportID = chat ? chat.reportID : newChat.reportID;
    if (!shareDestination) {
    setShareDestinationValue(reportID);
    }
    Report.openReport(reportID, [assignee], newChat);
    }

    Please note openReport is called

    To get display information of the assignee, Task.getAssignee is called and you'll get the icons by ReportUtils.getIconsForParticipants

    return {
    icons: ReportUtils.getIconsForParticipants([details.accountID], personalDetails),
    displayName: details.displayName,
    subtitle: details.login,
    };

    To get display information of the shareDestination, Task.getShareDestination is called and you'll get the icons by getIconsForParticipants function.

    That is, you'll get the icons for the assignee and shareDestination with the same function and same parameters([participantAccountIDs], personalDetails).

    The main problem is accountID. When open the new chat with new account, OpenReport API returns new personalDetails data and new [participantAccountIDs]. So we use old optimistic accountID for assignee(from onyx store), and use new accountID for shareDestination(from report). That's why shareDestination and assignee has the same icon for a while, and has different icon after that.

    This is the root cause.

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

    When open new report with new account, OpenReport API returns new personalDetails data and new [participantAccountIDs]. So personalDetails has two account information for the same user, one is optimistic data, the other is one returned from the API.

    1. Remove the old one when API successes. Add the following code here
            onyxData.successData.push({
                onyxMethod: Onyx.METHOD.MERGE,
                key: ONYXKEYS.PERSONAL_DETAILS_LIST,
                value: failurePersonalDetails,
            });
    
    1. When call Task.getAssignee, add additional parameter props.task.assignee(this is an assignee login)
            const displayDetails = Task.getAssignee(props.task.assigneeAccountID, props.task.assignee, props.personalDetails);
    

    To find the new accountID, add the following code in getAssignee function in Task.js

        if (!details) {
            details = _.find(personalDetails, (detail) => lodashGet(detail, 'login', lodashGet(detail, 'displayName', '')) === assigneeLogin);
        }
    

    This way we can synchronize the assignee and shareDestination

    Result
    24078.mp4

    What alternative solutions did you explore? (Optional)

  5. spcheema commented on Aug 3, 2023

    @spcheema
    Contributor

    @s-alves10 in my opinion, participant ID should not change if participant.loginText === assignee.loginText. Currently, a new participant is being created even when one already exists.

  6. dummy-1111 commented on Aug 3, 2023

    @dummy-1111
    Contributor

    @spcheema

    This is the case for the new account. I'm afraid I didn't catch you.
    Will you explain in more detail?

  7. dukenv0307 commented on Aug 3, 2023

    @dukenv0307
    Contributor

    Proposal

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

    Task - Avatar for the same new user is different in Assignee and Share somewhere fields

    What is the root cause of that problem?

    When selecting a new assignee on creating task flow, we will generate a new accountID for the new assignee, and use this accounID to display the assignee field.

    Onyx.merge(ONYXKEYS.TASK, {assignee, assigneeAccountID: newAssigneeAccountID});

    Then we call OpenReport API and the server returns another accounID for the new assignee. This accountID is used to display the share destination field

    The problem here is that we use 2 accountIDs for the same user

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

    After the server returns the accountID we should re-set assigneeAccountID to this accountID. With this approach, we only have one accountID for new assignee.

    To do that,

    1. here, we should save reportID to task field on ONYX

      Onyx.merge(ONYXKEYS.TASK, {assignee, assigneeAccountID: newAssigneeAccountID});

    2. Create new method to update assigneeAccountID in Task.js

    function updateAsigneeID(asigneeID) {
        Onyx.merge(ONYXKEYS.TASK, {assigneeAccountID: asigneeID});
    }
    
    
    1. In NewTaskPage, we will update new accountID from server to assigneeAccountID based on reportID
    if (props.task.reportID) {
          
                const assigneeReport = lodashGet(props.reports, `${ONYXKEYS.COLLECTION.REPORT}${props.task.reportID}`, undefined);
    
                if(assigneeReport) {
                    Task.updateAsigneeID(assigneeReport.participantAccountIDs[0])
                }
            }
    

    Result

    Screen.Recording.2023-08-03.at.14.53.41.mov
  8. twisterdotcom commented on Aug 3, 2023

    @twisterdotcom
    Contributor

    From @s-alves10:

    Remove the old one when API successes.

    From @dukenv0307:

    After the server returns the accountID we should re-set assigneeAccountID to this accountID. With this approach, we only have one accountID for new assignee.

    I think this makes sense, but let's get an expert opinion. I'm not sure how these differ, but it sounds like they're basically both solving the optimistic extra accountID in different ways. Regardless, this is a bug.

  9. added
    External
    on Aug 3, 2023
  10. changed the title [-]Task - Avatar for the same new user is different in Assignee and Share somewhere fields[/-] [+][$1000] Task - Avatar for the same new user is different in Assignee and Share somewhere fields[/+] on Aug 3, 2023
  11. melvin-bot commented on Aug 3, 2023

    @melvin-bot
  12. added
    Help Wanted
    on Aug 3, 2023
  13. melvin-bot commented on Aug 3, 2023

    @melvin-bot

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

  14. 33 remaining items

  15. sakluger commented on Sep 18, 2023

    @sakluger
    Contributor

    @aimane-chnaif what's the next step here? Do we need brand new proposals?

  16. melvin-bot commented on Sep 21, 2023

    @melvin-bot

    @sakluger, @twisterdotcom, @aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  17. aimane-chnaif commented on Sep 21, 2023

    @aimane-chnaif
    Contributor

    @aimane-chnaif what's the next step here? Do we need brand new proposals?

    yes, now awaiting new proposals.

    For contributors who previously posted proposals:
    please update proposals based on latest codebase

  18. melvin-bot commented on Sep 22, 2023

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  19. melvin-bot commented on Sep 25, 2023

    @melvin-bot

    @sakluger, @twisterdotcom, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

  20. sakluger commented on Sep 25, 2023

    @sakluger
    Contributor

    @s-alves10 @dukenv0307 @StevenKKC would you like to submit an updated proposal?

  21. dukenv0307 commented on Sep 25, 2023

    @dukenv0307
    Contributor

    @sakluger Actually we block assigned task for new user, so this issue cannot reproduce now.

  22. sakluger commented on Sep 29, 2023

    @sakluger
    Contributor

    Ah okay, I'll close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyExternalHelp Wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions