Skip to content

[$500] User avatars aren't showing on Tasks  #31372

Closed

Description

@Julesssss

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: v1.3.99-0
Reproducible in staging?: yes
Reproducible in production?: Yes
Issue reported by: Me
Slack conversation: N/A

Action Performed:

  • Create or locate two users with custom avatars
  • Create a task and assign to another user
  • View the task as the task assignee
  • View the task as the task creator

Expected Result:

  • User avatars should be displayed

Actual Result:

  • Default avatars are displayed

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
Screenshot 2023-11-15 at 14 46 43
Screenshot 2023-11-15 at 14 42 56

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e392efbd2033f1dc
  • Upwork Job ID: 1725084537297600512
  • Last Price Increase: 2023-11-16
  • Automatic offers:
    • alitoshmatov | Reviewer | 27861088
    • bernhardoj | Contributor | 27861089

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 15, 2023
  2. self-assigned this
    on Nov 15, 2023
  3. melvin-bot commented on Nov 15, 2023

    @melvin-bot

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

  4. melvin-bot commented on Nov 15, 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
  5. DylanDylann commented on Nov 16, 2023

    @DylanDylann
    Contributor

    Proposal

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

    • Default avatars are displayed

    What is the root cause of that problem?

    1. The default avatar is displayed in task view
    • Currently, we use the below logic to get the assignee avatar:
      icon={OptionsListUtils.getAvatarsForAccountIDs([props.report.managerID], props.personalDetails)}
    • But props.personalDetails is undefined because we do not subscribe ONYXKEYS.PERSONAL_DETAILS_LIST
    1. The default avatar is displayed in OptionRowLHN
    • We are using the below logic to get the optionItem to display in LHN:
      const item = SidebarUtils.getOptionData(fullReport, reportActions, personalDetails, preferredLocale, policy, parentReportAction);

      with the personalDetails is from the below logic:
      const participantsPersonalDetails = OptionsListUtils.getPersonalDetailsForAccountIDs(itemFullReport.participantAccountIDs, personalDetails);
    • With the task report, report.participantAccountIDs does not contain the owner `s accountID, that leads to the default avatar displayed

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

    • We need to subscribe ONYXKEYS.PERSONAL_DETAILS_LIST in TaskView:
        withOnyx({
            personalDetails: {
                key: ONYXKEYS.PERSONAL_DETAILS_LIST,
            },
        }),
    
    • We can update the getParticipantsIDs (It will also fix other sections that are missing the participants, for example, report detail page): to:
    function getParticipantsIDs(report) {
    ...
    +    if (isMoneyRequestReport(report) || isTaskReport(report)) {
            return _.chain([report.managerID, report.ownerAccountID, ...participants])
                .compact()
                .uniq()
                .value();
        }
        return participants;
    }

    to:

    const participantsPersonalDetails 
        = OptionsListUtils.getPersonalDetailsForAccountIDs(getParticipantsIDs(itemFullReport), personalDetails);
    

    What alternative solutions did you explore? (Optional)

    • Also we can use the allPersonalDetails that is subscribed in OptionsListUtils if the param allPersonalDetails is empty

    Result

    image

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 16, 2023
  7. changed the title [-]User avatars aren't showing on Tasks [/-] [+][$500] User avatars aren't showing on Tasks [/+] on Nov 16, 2023
  8. melvin-bot commented on Nov 16, 2023

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Nov 16, 2023
  10. melvin-bot commented on Nov 16, 2023

    @melvin-bot

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

  11. bernhardoj commented on Nov 16, 2023

    @bernhardoj
    Contributor

    Proposal

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

    1. The assignee avatar shows a default avatar
    2. The task owner avatar on LHN also shows a default avatar

    What is the root cause of that problem?

    For the first issue, the assignee avatar is coming from this line of code.

    icon={OptionsListUtils.getAvatarsForAccountIDs([props.report.managerID], props.personalDetails)}

    The avatar is supposed to be retrieved from the personalDetails onyx object, but it's undefined because we are not subscribing the object from the onyx, so the avatar here is always an empty string, thus a default avatar is used.

    const userPersonalDetail = lodashGet(personalDetails, accountID, {login, accountID, avatar: ''});
    return {
    id: accountID,
    source: UserUtils.getAvatar(userPersonalDetail.avatar, userPersonalDetail.accountID),

    For the second issue, the LHN avatar is coming from ReportUtils.getReportIcon. It takes the assigner (owner) avatar from the personalDetails onyx object.

    App/src/libs/ReportUtils.js

    Lines 1159 to 1166 in 6ea4539

    if (isTaskReport(report)) {
    const ownerIcon = {
    id: report.ownerAccountID,
    source: UserUtils.getAvatar(lodashGet(personalDetails, [report.ownerAccountID, 'avatar']), report.ownerAccountID),
    type: CONST.ICON_TYPE_AVATAR,
    name: lodashGet(personalDetails, [report.ownerAccountID, 'displayName'], ''),
    fallbackIcon: lodashGet(personalDetails, [report.ownerAccountID, 'fallbackIcon']),
    };

    However, the personalDetails object that is passed down from LHNOptionsList component only contains the personal details of the report participants.

    const participantsPersonalDetails = OptionsListUtils.getPersonalDetailsForAccountIDs(itemFullReport.participantAccountIDs, personalDetails);

    personalDetails={participantsPersonalDetails}

    In the case of a task, the report participants only contain the assignee (manager). So, when we are trying to get the avatar of the owner, we get nothing, and again, the default avatar is used.

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

    1. Subscribe to personal details onyx in TaskView.
    compose(..., withOnyx({personalDetails: { key: ONYXKEYS.PERSONAL_DETAILS_LIST }}))(TaskView)
    
    1. Include ownerAccountID in the personal details.
      const participantsPersonalDetails = OptionsListUtils.getPersonalDetailsForAccountIDs(itemFullReport.participantAccountIDs, personalDetails);
    // filter out account ID of 0. ownerAccountID can be 0 if it's not a task.
    const participants = [itemFullReport.ownerAccountID, ...itemFullReport.participantAccountIDs].filter((p) => p !== 0);
    
    or
    
    const participants = [...itemFullReport.participantAccountIDs]
    if (itemFullReport.ownerAccountID > 0) {
        participants.push(itemFullReport.ownerAccountID);
    }
    
    const participantsPersonalDetails = OptionsListUtils.getPersonalDetailsForAccountIDs(participants, personalDetails);
    
  12. 31 remaining items

  13. Julesssss commented on Nov 28, 2023

    @Julesssss
    ContributorAuthor

    Regardless of how the feature currently works, we only need to resolve the initial bug. Lets not increase scope here.

    We should go with @bernhardoj's proposal.

  14. alitoshmatov commented on Nov 28, 2023

    @alitoshmatov
    Contributor

    Thank you

    @bernhardoj You can proceed with PR

  15. bernhardoj commented on Nov 28, 2023

    @bernhardoj
    Contributor

    PR is ready

    cc: @alitoshmatov

  16. alitoshmatov commented on Dec 21, 2023

    @alitoshmatov
    Contributor

    This issue is long overdue. The corresponding PR was deployed to production on 7th of December. It caused this regression - #32416. We successfully fixed that regression in this PR and it was also deployed to product on 7th of December.

  17. Julesssss commented on Dec 21, 2023

    @Julesssss
    ContributorAuthor

    Ah thanks, it looks like our automation failed to add the 'HOLD for payment' warning. Does this sound right?

  18. Julesssss commented on Dec 21, 2023

    @Julesssss
    ContributorAuthor

    Hey @miljakljajic, would you mind paying this one out? Thanks

  19. alitoshmatov commented on Jan 4, 2024

    @alitoshmatov
    Contributor

    @miljakljajic Friendly bump

  20. miljakljajic commented on Jan 4, 2024

    @miljakljajic
    Contributor

    So sorry, paying right away!

  21. miljakljajic commented on Jan 4, 2024

    @miljakljajic
    Contributor

    Paid in upwork.

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions