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

[Payment Request] [$250] Mention - Avatar is not displaying on Concierge in mention list #41014

Closed
4 of 6 tasks
lanitochka17 opened this issue Apr 25, 2024 · 33 comments
Closed
4 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@lanitochka17
Copy link

lanitochka17 commented Apr 25, 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.66-0
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4516979&group_by=cases:section_id&group_order=asc&group_id=306201&group_by=cases:section_id&group_order=asc&group_id=306201
Email or phone of affected tester (no customers): shussain+accoun1@applausemail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Open a chat
  2. Press @ and check Concierge

Expected Result:

Avatar should be displayed on Concierge in mention list

Actual Result:

Avatar is not displaying on Concierge in mention list

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

Bug6461797_1714061858309.2024-04-25_21-12-29.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015c5e79bf2b62e7b7
  • Upwork Job ID: 1783566739983851520
  • Last Price Increase: 2024-04-25
Issue OwnerCurrent Issue Owner: @allroundexperts
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Apr 25, 2024
Copy link

melvin-bot bot commented Apr 25, 2024

Triggered auto assignment to @neil-marcellini (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

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.

@lanitochka17
Copy link
Author

@neil-marcellini 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

@neil-marcellini
Copy link
Contributor

Ok, taking a look. In general we can add external and the contributors can help us figure out if it's a backend problem.

@neil-marcellini neil-marcellini added the External Added to denote the issue can be worked on by a contributor label Apr 25, 2024
@melvin-bot melvin-bot bot changed the title Mention - Avatar is not displaying on Concierge in mention list [$250] Mention - Avatar is not displaying on Concierge in mention list Apr 25, 2024
Copy link

melvin-bot bot commented Apr 25, 2024

Job added to Upwork: https://www.upwork.com/jobs/~015c5e79bf2b62e7b7

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

melvin-bot bot commented Apr 25, 2024

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

@neil-marcellini
Copy link
Contributor

I finally confirmed that the personal detail for concierge has the correct avatar link https://d2k5nsl2zxldvw.cloudfront.net/images/icons/concierge_2022.png. On production it's the same value, so I don't think it's a problem with the data.

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Apr 25, 2024

Proposal

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

Mention - Avatar is not displaying on Concierge in mention list

What is the root cause of that problem?

The problem is that when we try to get the default avatar, we use accountID, which in the case of suggestionList , we do not pass

App/src/libs/UserUtils.ts

Lines 85 to 107 in 6060e6f

function getDefaultAvatar(accountID = -1, avatarURL?: string): IconAsset | undefined {
if (Number(accountID) === CONST.ACCOUNT_ID.CONCIERGE) {
return ConciergeAvatar;
}
if (Number(accountID) === CONST.ACCOUNT_ID.NOTIFICATIONS) {
return NotificationsAvatar;
}
// There are 24 possible default avatars, so we choose which one this user has based
// on a simple modulo operation of their login number. Note that Avatar count starts at 1.
// When creating a chat, we generate an avatar using an ID and the backend response will modify the ID to the actual user ID.
// But the avatar link still corresponds to the original ID-generated link. So we extract the SVG image number from the backend's link instead of using the user ID directly
let accountIDHashBucket: AvatarRange;
if (avatarURL) {
const match = avatarURL.match(/(default-avatar_|avatar_)(\d+)(?=\.)/);
const lastDigit = match && parseInt(match[2], 10);
accountIDHashBucket = lastDigit as AvatarRange;
} else {
accountIDHashBucket = ((accountID % CONST.DEFAULT_AVATAR_COUNT) + 1) as AvatarRange;
}
return defaultAvatars[`Avatar${accountIDHashBucket}`];
}

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

To fix this issue we can update this code and add accountID: detail?.accountID,

suggestions.push({
text: formatLoginPrivateDomain(PersonalDetailsUtils.getDisplayNameOrDefault(detail), detail?.login),
alternateText: `@${formatLoginPrivateDomain(detail?.login, detail?.login)}`,
handle: detail?.login,
icons: [
{
name: detail?.login,
source: detail?.avatar ?? FallbackAvatar,
type: CONST.ICON_TYPE_AVATAR,
fallbackIcon: detail?.fallbackIcon,
id: detail?.accountID,
},
],

And also pass accountID for Avatar

<Avatar
source={item.icons[0].source}
size={isIcon ? CONST.AVATAR_SIZE.MENTION_ICON : CONST.AVATAR_SIZE.SMALLER}
name={item.icons[0].name}
type={item.icons[0].type}
fill={isIcon ? theme.success : undefined}
fallbackIcon={item.icons[0].fallbackIcon}
/>

What alternative solutions did you explore? (Optional)

As alternative we can update getUserMentionOptions and pass accountID only in case CONCIERGE, NOTIFICATIONS and so on

@neil-marcellini
Copy link
Contributor

Thanks @ZhenjaHorbach. Can you explain the root cause a bit more please? Why is it that we don't pass the accountID when creating the mention? It looks to me like we do.

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Apr 25, 2024

Thanks @ZhenjaHorbach. Can you explain the root cause a bit more please? Why is it that we don't pass the accountID when creating the mention? It looks to me like we do.

In this PR we added accountID for Avatar and added additional checking which use accountID inside getAvatar
But since we didn’t pass this ID for mentionsList
It turns out that this function does not work correctly

https://github.com/Expensify/App/pull/39229/files#diff-244cdd9be92eb59eaa9aa7b7d3e310ab0b3845111e3de28746ec3ea59ae970b4R89-R90

And here we can't get ConciergeAvatar without accountID

if (Number(accountID) === CONST.ACCOUNT_ID.CONCIERGE) {
return ConciergeAvatar;
}

Actually in this case I think we need to check all places where we use Avatar

@neil-marcellini
Copy link
Contributor

Ok @ZhenjaHorbach I think I finally understand your proposal. I would say the root cause is this.

  1. When we build the suggestions the source is set to this

    source: detail?.avatar ?? FallbackAvatar,

    Previously it was this, and was changed here.
    source: UserUtils.getAvatar(detail?.avatar, detail?.accountID),

  2. MentionSuggestions renders the Avatar here and doesn't pass an accountID

    <Avatar
    source={item.icons[0].source}
    size={isIcon ? CONST.AVATAR_SIZE.MENTION_ICON : CONST.AVATAR_SIZE.SMALLER}
    name={item.icons[0].name}
    type={item.icons[0].type}
    fill={isIcon ? theme.success : undefined}
    fallbackIcon={item.icons[0].fallbackIcon}
    />

  3. The avatar source is set here using UserUtils.getAvatar. The accountID is undefined

    const source = isWorkspace ? originalSource : UserUtils.getAvatar(originalSource, accountID);

  4. That calls getDefaultAvatar

    return isDefaultAvatar(avatarSource) ? getDefaultAvatar(accountID, avatarSource) : avatarSource;

  5. Since there's not accountID, it incorrectly returns a default avatar

    return defaultAvatars[`Avatar${accountIDHashBucket}`];

I'm wondering how we can test this. I can't reproduce on dev because the avatar is always blank for me. I'll try against the staging api instead of our dev api.

Or we could just revert Use fallback user avatar in cases where the user is unknown to us. @grgia what do you think since you were involved there?

@neil-marcellini
Copy link
Contributor

@ZhenjaHorbach I put up a PR based loosely on your proposal. I hope that's cool with you and I really appreciate you pointing me in the right direction. I would have approved your proposal earlier, but I didn't really understand the root cause until I investigate it thoroughly myself.

@ZhenjaHorbach
Copy link
Contributor

Fix concierge avatar in mention suggestion #41034

Happy to help )

@grgia
Copy link
Contributor

grgia commented Apr 26, 2024

@Kicu could you take a look at this?

@grgia
Copy link
Contributor

grgia commented Apr 26, 2024

@neil-marcellini I doubt we will need to revert, I'm fairly certain this will be an easy fix

@Kicu
Copy link
Contributor

Kicu commented Apr 26, 2024

hey I'm the author of #39229 and I took a look at this, few points from me in random order

Because of this I believe the best fix for this is to actually do pass accountID prop correctly. This PR seems to do just that (#41034).

I tested locally on my dev the same fix, and it looks good

before (main)

after passing accountID

In general we only need accountID to be able to display the "pretty" svg versions of: default avatars, ConciergeAvatar and NotificationsAvatar. Otherwise .avatar from user details is always correct.
In addition I can supply a separate PR that adds the new accountID prop in a few places where Avatar is used, because it seems I might miss them.

@grgia

Copy link

melvin-bot bot commented Apr 27, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@allroundexperts
Copy link
Contributor

The PR was closed and the offending PR was reverted. As such, we don't need to wait for the 7 days for the payment.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Apr 29, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-05-03] [$250] Mention - Avatar is not displaying on Concierge in mention list [HOLD for payment 2024-05-06] [HOLD for payment 2024-05-03] [$250] Mention - Avatar is not displaying on Concierge in mention list Apr 29, 2024
Copy link

melvin-bot bot commented Apr 29, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.67-7 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-05-06. 🎊

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

  • @Kicu does not require payment (Contractor)
  • @allroundexperts requires payment through NewDot Manual Requests

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels May 3, 2024
@neil-marcellini
Copy link
Contributor

Sounds like this is all done then. Please correct me if I'm wrong.

@allroundexperts
Copy link
Contributor

Can I have a payment summary @neil-marcellini? Thanks!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels May 8, 2024
@JmillsExpensify
Copy link

Re-opening for payment summary.

@neil-marcellini
Copy link
Contributor

Assigning a bug zero member to handle payment

@neil-marcellini neil-marcellini added the Bug Something is broken. Auto assigns a BugZero manager. label Jun 17, 2024
Copy link

melvin-bot bot commented Jun 17, 2024

Triggered auto assignment to @strepanier03 (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 melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 17, 2024
@strepanier03
Copy link
Contributor

strepanier03 commented Jun 17, 2024

Payment Summary

@JmillsExpensify - Payment request incoming.

@strepanier03 strepanier03 changed the title [HOLD for payment 2024-05-06] [HOLD for payment 2024-05-03] [$250] Mention - Avatar is not displaying on Concierge in mention list [Payment Request] [$250] Mention - Avatar is not displaying on Concierge in mention list Jun 17, 2024
@JmillsExpensify
Copy link

$250 approved for @allroundexperts

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. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

10 participants