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

Cloudpresser/user details tooltip #20276

Merged

Conversation

cloudpresser
Copy link
Contributor

@cloudpresser cloudpresser commented Jun 6, 2023

Details

  • Create a UserDetailsTooltip component, which uses 2 prop, accountID, and fallbackUserDetails
  • UserDetailsTooltip returns a Tooltip component with a custom renderTooltipContent and passes it's children into it, like this:
const UserDetailsTooltip = props => {
    const { avatarSource, name, handle, children } = props

    return (
        <Tooltip
            renderTooltipContent={()=> (
                    <View>
                        <Avatar
                            containerStyles={[styles.actionAvatar]}
                            source={avatarSource}
                        />
                        <Text>{name}</Text>
                        <Text>@{handle}</Text>
                    </View>
                )}
            children={children}
        />
    )
}
  • Modified call sites to use ReportUtils.getPersonalDetailsForLogin to get userDetails object for login and access accountID.
  • Used fallback object to handle cases where personalDetails are not in Onyx (app@t.com is one such case).

Fixed Issues

$ #20086
$ #20086 (comment)

Tests

  • Verify that no errors appear in the JS console
  • Run app on web
  • Hover over the user name or image on a chat, sidebar, or anywhere user tooltips were previously used, except mentions
  • Verify new tooltip style is being used
  • Verify component renders well with and without a login, name and avatar

Offline tests

  • Native and mobile platforms do not apply, verify app does not have regressions (no-op)
  • Verify that no errors appear in the JS console
  • Run app on web
  • Hover over the user name or image on a chat, sidebar, or anywhere user tooltips were previously used, except mentions
  • Verify new tooltip style is being used
  • Verify component renders well with and without a login, name and avatar

QA Steps

  • Native and mobile platforms do not apply, verify app does not have regressions (no-op)
  • Verify that no errors appear in the JS console
  • Run app on web
  • Hover over the user name or image on a chat
  • Verify new tooltip style is being used

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web Screenshot 2023-06-11 at 11 16 46 AM
Mobile Web - Chrome Does not apply (component does not render on mobile)
Mobile Web - Safari Does not apply (component does not render on mobile)
Desktop Screenshot 2023-06-11 at 11 18 37 AM
iOS Does not apply (component does not render on mobile)
Android Does not apply (component does not render on mobile)

@cloudpresser cloudpresser requested a review from a team as a code owner June 6, 2023 15:34
@melvin-bot melvin-bot bot requested review from fedirjh and puneetlath and removed request for a team June 6, 2023 15:34
@melvin-bot
Copy link

melvin-bot bot commented Jun 6, 2023

@puneetlath @fedirjh One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@cloudpresser
Copy link
Contributor Author

Still waiting for a high-traffic account at luiz+high-traffic-1@cloudpresser.com

@cloudpresser
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@cloudpresser cloudpresser force-pushed the cloudpresser/userDetailsTooltip branch from 1d3790d to a00dfab Compare June 6, 2023 15:48
@puneetlath
Copy link
Contributor

@cloudpresser let's make sure the tooltip is also getting the proper styling. And can you try setting a handle manually in Onyx to show what it looks like with the handle as well.

Screenshot 2023-06-06 at 11 49 55 AM Screenshot 2023-06-06 at 11 50 08 AM Screenshot 2023-06-06 at 11 50 18 AM

@cloudpresser cloudpresser force-pushed the cloudpresser/userDetailsTooltip branch 2 times, most recently from 17b6680 to 788a2bd Compare June 6, 2023 15:56
@cloudpresser
Copy link
Contributor Author

@cloudpresser let's make sure the tooltip is also getting the proper styling. And can you try setting a handle manually in Onyx to show what it looks like with the handle as well.

Screenshot 2023-06-06 at 11 49 55 AM Screenshot 2023-06-06 at 11 50 08 AM Screenshot 2023-06-06 at 11 50 18 AM

Sounds good, I'll work on this after lunch today. Should have an update in 2-3hrs.

Copy link
Contributor

@fedirjh fedirjh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good , left few comments

src/components/UserDetailsTooltip/UserDetailsTooltip.js Outdated Show resolved Hide resolved
src/components/UserDetailsTooltip/UserDetailsTooltip.js Outdated Show resolved Hide resolved
src/components/UserDetailsTooltip/UserDetailsTooltip.js Outdated Show resolved Hide resolved
Copy link
Contributor

@fedirjh fedirjh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An extra suggestion

src/components/UserDetailsTooltip/UserDetailsTooltip.js Outdated Show resolved Hide resolved
@fedirjh
Copy link
Contributor

fedirjh commented Jun 6, 2023

@cloudpresser For style consistency , we can use same style used in ReactionTooltipContent.js

<View style={[styles.alignItemsCenter, styles.ph2]}>
<View style={styles.flexRow}>
{_.map(props.emojiCodes, (emojiCode) => (
<Text
key={emojiCode}
style={styles.reactionEmojiTitle}
>
{emojiCode}
</Text>
))}
</View>
<Text style={[styles.mt1, styles.textMicroBold, styles.textReactionSenders, styles.textAlignCenter]}>{namesString}</Text>
<Text style={[styles.textMicro, styles.fontColorReactionLabel]}>{`${props.translate('emojiReactions.reactedWith')} :${props.emojiName}:`}</Text>
</View>

@fedirjh

This comment was marked as resolved.

@cloudpresser
Copy link
Contributor Author

@cloudpresser let's make sure the tooltip is also getting the proper styling. And can you try setting a handle manually in Onyx to show what it looks like with the handle as well.

Screenshot 2023-06-06 at 11 49 55 AM Screenshot 2023-06-06 at 11 50 08 AM Screenshot 2023-06-06 at 11 50 18 AM

In order for to handle the case with no handle or name, the dimensions of the overall tooltip should probably use paddings instead of a fixed height. Looking at the screenshots I can only guess the value for those margins, could you tell me:

  • What is the distance from top of avatar to the top of the tooltip
  • What is the distance from bottom of handle to the bottom of the tooltip

Alternatively I could extract it from the design files, but I'm not sure where or if I can access those.

@cloudpresser
Copy link
Contributor Author

@cloudpresser For style consistency , we can use same style used in ReactionTooltipContent.js

<View style={[styles.alignItemsCenter, styles.ph2]}>
<View style={styles.flexRow}>
{_.map(props.emojiCodes, (emojiCode) => (
<Text
key={emojiCode}
style={styles.reactionEmojiTitle}
>
{emojiCode}
</Text>
))}
</View>
<Text style={[styles.mt1, styles.textMicroBold, styles.textReactionSenders, styles.textAlignCenter]}>{namesString}</Text>
<Text style={[styles.textMicro, styles.fontColorReactionLabel]}>{`${props.translate('emojiReactions.reactedWith')} :${props.emojiName}:`}</Text>
</View>

Are you suggesting I use this for the name? It looks like these styles do not match the ones on the screenshot @puneetlath shared. I was looking at styles.h4 for title and styles.textMicroMuted (to be created) for handle

textMicroMuted: {
        color: themeColors.greenIcons,
        fontFamily: fontFamily.EXP_NEUE,
        fontSize: variables.fontSizeSmall,
        lineHeight: variables.lineHeightSmall,
    },

@cloudpresser
Copy link
Contributor Author

We have a console warning as well

Screenshot 2023-06-06 at 7 38 23 PM

Just resolved this. Sorry, that got lost in a stash earlier

@fedirjh
Copy link
Contributor

fedirjh commented Jun 6, 2023

Are you suggesting I use this for the name?

I am suggesting to use same template , same style classes , change emoji code with avatar , emoji name with handle ...

@cloudpresser
Copy link
Contributor Author

Are you suggesting I use this for the name?

I am suggesting to use same template , same style classes , change emoji code with avatar , emoji name with handle ...

That makes sense, and saves me from guessing on those paddings. Thank you for the suggestion and for clarifying

@fedirjh
Copy link
Contributor

fedirjh commented Jun 6, 2023

@cloudpresser I have got this bug , where the tooltip position in not stable , causing this layout glitches

Bug.mov

Copy link
Contributor

@fedirjh fedirjh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cloudpresser We should update all tooltips instances that display the user's email address

Examples :

  • LHN
LHN
  • Search Page
Search
  • Chat Header
Header
  • Details Page
details
  • Threads
Threads
  • Mentions
Mentions

/>
</View>

{Boolean(props.name.trim()) ? <Text style={[styles.mt1, styles.textMicroBold, styles.textReactionSenders, styles.textAlignCenter]}>{props.name}</Text> : ''}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{Boolean(props.name.trim()) ? <Text style={[styles.mt1, styles.textMicroBold, styles.textReactionSenders, styles.textAlignCenter]}>{props.name}</Text> : ''}
{Boolean(props.name.trim()) ? <Text style={[styles.mt1, styles.textStrong, styles.textAlignCenter]}>{props.name}</Text> : ''}

We should use bold Style for name , I think we can create new style class for name that includes font-size and line-Height along side with styles.textStrong

@fedirjh
Copy link
Contributor

fedirjh commented Jun 7, 2023

@cloudpresser Just a quick reminder that this PR is highly important and should be merged this week. Could you please provide an update on when we can expect it to be ready?

@puneetlath
Copy link
Contributor

Sorry, one new request. Can we have the third line be login instead of handle. Looks like we're not going to get the back-end update to add handles in time.

However, we should still gracefully handle the login field not being there.

@cloudpresser
Copy link
Contributor Author

Sorry, one new request. Can we have the third line be login instead of handle. Looks like we're not going to get the back-end update to add handles in time.

However, we should still gracefully handle the login field not being there.

@puneetlath No problem, I'll get that in.

@fedirjh, I'm expecting to finish it within the next 1-2 hours.

Only variable I'm not sure how long it'll take is the bug @fedirjh reported. Hopefully is simple, I'm not sure it was caused by my changes, but maybe in combination with. Investigating...

@cloudpresser
Copy link
Contributor Author

@fedirjh I have not been granted a high traffic account yet. My understanding is I should use that to test cases like the one you found a bug in, is that right? I requested it twice so far on slack luiz+high-traffic-1@cloudpresser.com

@puneetlath
Copy link
Contributor

@cloudpresser just made luiz+high-traffic-1@cloudpresser.com a high traffic account.

@cloudpresser
Copy link
Contributor Author

Still working on this. The tooltips I had not accounted for are a bit of a deeper hole than anticipated. Will need to come back to it after lunch time. Expect another update before 5pm EST.

@fedirjh
Copy link
Contributor

fedirjh commented Jun 12, 2023

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web Screenshot 2023-06-12 at 6 56 42 PM Screenshot 2023-06-12 at 6 56 49 PM Screenshot 2023-06-12 at 6 56 54 PM Screenshot 2023-06-12 at 6 57 02 PM Screenshot 2023-06-12 at 6 57 11 PM Screenshot 2023-06-12 at 6 57 27 PM Screenshot 2023-06-12 at 6 57 30 PM Screenshot 2023-06-12 at 6 57 38 PM Screenshot 2023-06-12 at 6 57 42 PM Screenshot 2023-06-12 at 7 10 33 PM Screenshot 2023-06-12 at 7 10 36 PM Screenshot 2023-06-12 at 7 10 37 PM Screenshot 2023-06-12 at 7 10 41 PM
Mobile Web - Chrome Screenshot 2023-06-12 at 7 15 33 PM
Mobile Web - Safari Screenshot 2023-06-12 at 7 11 40 PM
Desktop Screenshot 2023-06-12 at 7 01 14 PM Screenshot 2023-06-12 at 7 01 29 PM Screenshot 2023-06-12 at 7 01 32 PM Screenshot 2023-06-12 at 7 01 35 PM Screenshot 2023-06-12 at 7 01 39 PM Screenshot 2023-06-12 at 7 01 41 PM Screenshot 2023-06-12 at 7 01 44 PM Screenshot 2023-06-12 at 7 01 52 PM Screenshot 2023-06-12 at 7 01 54 PM Screenshot 2023-06-12 at 7 02 00 PM Screenshot 2023-06-12 at 7 02 21 PM Screenshot 2023-06-12 at 7 03 05 PM Screenshot 2023-06-12 at 7 03 08 PM
iOS Screenshot 2023-06-12 at 7 11 13 PM
Android Screenshot 2023-06-12 at 7 26 49 PM

Copy link
Contributor

@fedirjh fedirjh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the great work @cloudpresser , It looks good and tests well for all cases 🚀 🚀

All yours @puneetlath

@cloudpresser
Copy link
Contributor Author

Thank you @fedirjh @puneetlath for all the help and reviews! I learned a lot about the codebase with this PR

@puneetlath
Copy link
Contributor

Thank you both so much for your persistence and urgency on this one! It's really much appreciated. Looking forward to more contributions from you @cloudpresser.

@puneetlath puneetlath merged commit aa70abf into Expensify:main Jun 12, 2023
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 1.3.27-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 1.3.27-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@@ -873,7 +884,8 @@ function getDisplayNameForParticipant(login, shouldUseShortForm = false) {
function getDisplayNamesWithTooltips(participants, isMultipleParticipantReport) {
return _.map(participants, (participant) => {
const displayName = getDisplayNameForParticipant(participant.login, isMultipleParticipantReport);
const tooltip = participant.login ? Str.removeSMSDomain(participant.login) : '';
const avatar = UserUtils.getDefaultAvatar(participant.login);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this caused a regression where we are unable to load a user's uploaded/custom avatar in some cases as identified on #20683

I believe I've got a fix so will push it up and request reviews from ya'll.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR is here #20727

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bondydaa The root cause of that issue is that we are not passing the accountID. The avatar you are referring to should only be displayed in case we have a user without an accountID (I believe these cases are mentions or when you search for a new account).

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/AndrewGable in version: 1.3.27-7 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@grgia
Copy link
Contributor

grgia commented Jun 15, 2023

I just reported this, but it seems we didn't handle the case for Workspace Avatars https://expensify.slack.com/archives/C049HHMV9SM/p1686821040533159

* @param {String} login
* @returns {String}
*/
function getAccountIDForLogin(login) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cloudpresser @puneetlath
This method no longer works after accountID migration because we have accountID as they and not login anymore. This is causing the following issues:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue reported here: #20934

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@esh-g If the the method no longer works after accountID migration , then the migration PR caused this regression , it broke this function which was working fine before the migration.

So it's not a regression from this PR.

Comment on lines +29 to +31
<Text style={[styles.textMicro, styles.fontColorReactionLabel]}>
{String(userDetails.login).trim() && !_.isEqual(userDetails.login, userDetails.displayName) ? Str.removeSMSDomain(userDetails.login) : ''}
</Text>
Copy link
Collaborator

@Santhosh-Sellavel Santhosh-Sellavel Jul 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user with mobile number login case was handled incorrectly resulting in the regression showing the phone number twice with different formatting. Handled it by improving the checks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We added the login handling here, but we didn't account for overflowing content on the tooltip with a very long email. This caused a regression here.

return props.children;
}

return <Tooltip renderTooltipContent={renderTooltipContent}>{props.children}</Tooltip>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tooltip supports renderTooltipContentKey prop for resize when renderTooltipContent dynamically changes. As it was missed to pass this key, caused minor regression below:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tooltip also supports shiftHorizontal to adjust horizontal position of tooltip. As it was missed to pass this key, caused another minor regression below:

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Aug 10, 2023

This PR adds UserTooltip and while testing we failed to catch inconsistency in the user tooltip due to a missing account id from the new task page.

@fedirjh
Copy link
Contributor

fedirjh commented Aug 11, 2023

cc @Santhosh-Sellavel, I don't think this PR introduced that regression. It's probably a regression from :

In this PR we used the name to get the accountID :

<UserDetailsTooltip
accountID={ReportUtils.getAccountIDForLogin(props.icons[0].name)}

@@ -74,7 +77,14 @@ const MultipleAvatars = (props) => {

if (props.icons.length === 1 && !props.shouldStackHorizontally) {
return (
<Tooltip text={tooltipTexts[0]}>
<UserDetailsTooltip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't properly migrate the shouldShowTooltip prop to UserDetailsTooltip which was being applied indirectly to the old Tooltip via tooltipTexts at line 72.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.