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-08-28] [$1000] not able to show preview of avatr in thread #21073

Closed
1 of 6 tasks
kavimuru opened this issue Jun 19, 2023 · 98 comments
Closed
1 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

Comments

@kavimuru
Copy link

kavimuru commented Jun 19, 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 any chat
  2. send any message
  3. click on reply in thread option
  4. click the header of thread
  5. click on avatar to see preview

Expected Result:

should show preview of avatar

Actual Result:

does not show preview of avatar

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

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

Version Number: 1.3.29-0
Reproducible in staging?: y
Reproducible in production?: y
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

Screen.Recording.2023-06-12.at.2.30.30.PM.mov
Recording.1026.mp4

Expensify/Expensify Issue URL:
Issue reported by: @gadhiyamanan
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1686560482456669

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~015a875266a3d365a7
  • Upwork Job ID: 1671152204532953088
  • Last Price Increase: 2023-07-11
  • Automatic offers:
    • aimane-chnaif | Reviewer | 26069023
    • spcheema | Contributor | 26069025
    • gadhiyamanan | Reporter | 26069029
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 19, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 19, 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

@spcheema
Copy link
Contributor

spcheema commented Jun 20, 2023

Proposed solution

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

Not able to show preview of avatar in thread

What is the root cause of that problem?

On details page, Avatar component is not wrapped in a AttachmentModal

https://github.com/Expensify/App/blob/main/src/components/RoomHeaderAvatars.js#L26-L37

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

  • Wrap Avatar in AttachmentModal & PressableWithoutFocus similar to profile page
        const displayName = props.icons[0].type === CONST.ICON_TYPE_AVATAR ? getDisplayNameForParticipant(props.icons[0].id) : props.icons[0].name
        return (
            <AttachmentModal
                headerTitle={props.icons[0].name}
                source={UserUtils.getFullSizeAvatar(props.icons[0].source, props.icons[0].id)}
                isAuthTokenRequired
            >
                {({ show }) => (
            <PressableWithoutFocus
                onPress={show}
                accessibilityRole="imagebutton"
                accessibilityLabel={props.icons[0].name}>
                <Avatar
                    source={props.icons[0].source}
                    imageStyles={[styles.avatarLarge]}
                    fill={themeColors.iconSuccessFill}
                    size={CONST.AVATAR_SIZE.LARGE}
                    name={props.icons[0].name}
                    type={props.icons[0].type}
                />
                </PressableWithoutFocus>
            )}
            </AttachmentModal>
        );
  • Replicate similar changes in the case of multiple avatars (reply in thread to a message in workspace)
  • Change view pointerEvents from none to box-none in order to make avatars clickable.
<View pointerEvents="box-none">
            <View style={[styles.flexRow, styles.wAuto, styles.ml3]}>
                {_.map(iconsToDisplay, (icon, index) => {
                    const displayName = icon.type === CONST.ICON_TYPE_AVATAR ? getDisplayNameForParticipant(icon.id) : icon.name
                    return (
                        <View
                            key={`${icon.source}${index}`}
                            style={[styles.justifyContentCenter, styles.alignItemsCenter]}
                        >
                            <AttachmentModal
                                headerTitle={icon.name}
                                source={UserUtils.getFullSizeAvatar(icon.source, details.accountID)}
                                isAuthTokenRequired
                                originalFileName={lodashGet(details, 'originalFileName', '')}
                            >
                                {({ show }) => (
                                    <PressableWithoutFocus
                                        onPress={show}
                                        accessibilityRole="imagebutton"
                                        accessibilityLabel={icon.name}>
                            <Avatar
                                source={icon.source}
                                fill={themeColors.iconSuccessFill}
                                size={CONST.AVATAR_SIZE.LARGE}
                                containerStyles={[...iconStyle, StyleUtils.getAvatarBorderRadius(CONST.AVATAR_SIZE.LARGE_BORDERED, icon.type)]}
                                name={icon.name}
                                type={icon.type}
                            />
                                    </PressableWithoutFocus>
                                )}
                            </AttachmentModal>
                            {index === CONST.REPORT.MAX_PREVIEW_AVATARS - 1 && props.icons.length - CONST.REPORT.MAX_PREVIEW_AVATARS !== 0 && (
                                <>
                                    <View
                                        style={[
                                            styles.roomHeaderAvatarSize,
                                            styles.roomHeaderAvatar,
                                            ...iconStyle,
                                            StyleUtils.getAvatarBorderRadius(CONST.AVATAR_SIZE.LARGE_BORDERED, icon.type),
                                            styles.roomHeaderAvatarOverlay,
                                        ]}
                                    />
                                    <Text
                                        style={styles.avatarInnerTextChat}>{`+${props.icons.length - CONST.REPORT.MAX_PREVIEW_AVATARS}`}</Text>
                                </>
                            )}
                        </View>
                    )
                })}
            </View>
        </View>

What alternative solutions did you explore? (Optional)

N/A

@getusha
Copy link
Contributor

getusha commented Jun 20, 2023

Proposal

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

Preview is not implemented for avatars in thread

What is the root cause of that problem?

There is no implementation for avatar preview in both single and multiple avatars like on other places that show preview for the avatars. in this case it's just rendering the icons.

if (props.icons.length === 1) {
return (
<Avatar
source={props.icons[0].source}
imageStyles={[styles.avatarLarge]}
fill={themeColors.iconSuccessFill}
size={CONST.AVATAR_SIZE.LARGE}
name={props.icons[0].name}
type={props.icons[0].type}
/>
);
}

<Avatar
source={icon.source}
fill={themeColors.iconSuccessFill}
size={CONST.AVATAR_SIZE.LARGE}
containerStyles={[...iconStyle, StyleUtils.getAvatarBorderRadius(CONST.AVATAR_SIZE.LARGE_BORDERED, icon.type)]}
name={icon.name}
type={icon.type}

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

The first thing we should do is get personalDetails for each participants

    const participantProfiles = _.map(participants, participant => lodashGet(props.personalDetails, participant));

we can pass participantProfiles to RoomHeaderAvatars component as a prop and use that to get the full size avatar and also the originalFileName

As suggested by @aimane-chnaif we should check if the displayName exists and show the name accordingly, the code below will behave like ProfilePage taking the details from props.participantProfiles

const displayName = details.displayName ? details.displayName : props.translate('common.hidden');

or we can check if the displayName exists and if not use the details.login which is the email address or phone.

const displayName = details.displayName ? details.displayName : details.login;
<AttachmentModal
    headerTitle={props.participantProfiles[0].login}
    source={UserUtils.getFullSizeAvatar(props.icons[0].source, props.participantProfiles[index])}
    isAuthTokenRequired
    originalFileName={props.participantProfiles[index].originalFileName}
>

we can also handle for multiple avatars

<AttachmentModal
    headerTitle={props.participantProfiles[index].login}
    source={UserUtils.getFullSizeAvatar(props.icons[index].source, props.participantProfiles[index])}
    isAuthTokenRequired
    originalFileName={props.participantProfiles[index].originalFileName}
>

We should also handle this every place RoomHeaderAvatars used.
the Overall implementation will be like:

<AttachmentModal
headerTitle={details.displayName}
source={UserUtils.getFullSizeAvatar(details.avatar, details.accountID)}
isAuthTokenRequired
originalFileName={details.originalFileName}
>
{({show}) => (
<PressableWithoutFocus
style={styles.noOutline}
onPress={show}
>
<OfflineWithFeedback pendingAction={lodashGet(details, 'pendingFields.avatar', null)}>
<Avatar
containerStyles={[styles.avatarLarge, styles.mb3]}
imageStyles={[styles.avatarLarge]}
source={UserUtils.getAvatar(details.avatar, details.accountID)}
size={CONST.AVATAR_SIZE.LARGE}
/>
</OfflineWithFeedback>
</PressableWithoutFocus>
)}
</AttachmentModal>

Result:

Screen.Recording.2023-06-20.at.8.31.21.AM.mov

What alternative solutions did you explore? (Optional)

@spcheema
Copy link
Contributor

@getusha Yeah if needed can be done in the same way. Just need to replicated the same code for each participants.

@kevinksullivan kevinksullivan added the External Added to denote the issue can be worked on by a contributor label Jun 20, 2023
@melvin-bot melvin-bot bot changed the title not able to show preview of avatr in thread [$1000] not able to show preview of avatr in thread Jun 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 20, 2023

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

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

melvin-bot bot commented Jun 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 20, 2023

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

@melvin-bot melvin-bot bot added the Overdue label Jun 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 22, 2023

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

@kevinksullivan
Copy link
Contributor

Hi @aimane-chnaif can you review the proposals above? Thanks

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jun 23, 2023
@aimane-chnaif
Copy link
Contributor

No satisfactory proposals yet

@melvin-bot melvin-bot bot removed the Overdue label Jun 26, 2023
@getusha
Copy link
Contributor

getusha commented Jun 26, 2023

@aimane-chnaif any comment on my proposal? Thanks

@spcheema
Copy link
Contributor

@aimane-chnaif Can you please shed some light so I can improve my proposal. Because root cause is same that Avatar isn't wrapped with PressableWithoutFocus component which can also be applied in the case of multiple avatars.

if (props.icons.length === 1) {
return (
<Avatar
source={props.icons[0].source}
imageStyles={[styles.avatarLarge]}
fill={themeColors.iconSuccessFill}
size={CONST.AVATAR_SIZE.LARGE}
name={props.icons[0].name}
type={props.icons[0].type}
/>
);
}

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Jun 26, 2023

Let's make everything consistent between attachment preview modals

diff.mov

@spcheema
Copy link
Contributor

@aimane-chnaif Thanks. I'll update my proposal

@spcheema
Copy link
Contributor

@aimane-chnaif I have updated my proposal

Detail.page.preview.mp4

@getusha
Copy link
Contributor

getusha commented Jun 27, 2023

@aimane-chnaif what's the expected one? the email or the name?

@aimane-chnaif
Copy link
Contributor

If user has display name set, should show display name. If not, email/phone.
Current attachment modal in profile page is the perfect one.

@getusha
Copy link
Contributor

getusha commented Jun 27, 2023

@aimane-chnaif thank you! for the clarification

@melvin-bot
Copy link

melvin-bot bot commented Aug 11, 2023

📣 @spcheema 🎉 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
Copy link

melvin-bot bot commented Aug 11, 2023

📣 @gadhiyamanan 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 11, 2023
@PauloGasparSv PauloGasparSv added Daily KSv2 and removed Weekly KSv2 labels Aug 14, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 15, 2023

🎯 ⚡️ Woah @aimane-chnaif / @spcheema, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @spcheema got assigned: 2023-08-11 13:34:11 Z
  • when the PR got merged: 2023-08-15 18:12:04 UTC

On to the next one 🚀

@kevinksullivan
Copy link
Contributor

@sonialiap I am back to handle payments when they come up!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Aug 21, 2023
@melvin-bot melvin-bot bot changed the title [$1000] not able to show preview of avatr in thread [HOLD for payment 2023-08-28] [$1000] not able to show preview of avatr in thread Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.55-8 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-08-28. 🎊

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 Aug 21, 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:

  • [@aimane-chnaif] The PR that introduced the bug has been identified. Link to the PR:
  • [@aimane-chnaif] 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:
  • [@aimane-chnaif] 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:
  • [@aimane-chnaif] Determine if we should create a regression test for this bug.
  • [@aimane-chnaif] 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.
  • [@sonialiap / @kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@kevinksullivan
Copy link
Contributor

Hey @aimane-chnaif please finish out the steps above so we can pay this out after the hold. Thanks!

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 Daily KSv2 Overdue labels Aug 28, 2023
@sonialiap
Copy link
Contributor

@aimane-chnaif please fill out the checklist so that we can issue payment

@sonialiap sonialiap removed their assignment Aug 29, 2023
@aimane-chnaif
Copy link
Contributor

This is feature request so I don't think regression test is needed

@kevinksullivan
Copy link
Contributor

Paid and contratcs closed!

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
Projects
None yet
Development

No branches or pull requests

9 participants