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

Set up Avatars for Workspace Chats #7852

Merged
merged 91 commits into from
Mar 4, 2022
Merged

Conversation

marcochavezf
Copy link
Contributor

@marcochavezf marcochavezf commented Feb 22, 2022

Details

This PR includes the avatars for workspace chats (for both admins and workspace members) and shows the workspace chats when the user has the policyExpenseChat beta. I also included fixes for some minor issues I found (like duplicate rows on the Search Page and the user name not included in the second line of the chat header).

Additionally, I created a Web-E PR to fix a few issues I found while I was implementing the workspace chats: https://github.com/Expensify/Web-Expensify/pull/33166

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/195471

Tests / QA

Pre-requisites:

  • Create an account which will be the admin
  • Create 2 or more accounts which will be the workspace members
  • Add the created accounts to policyExpenseChat beta

Steps:

  1. With the admin account create a Workspace and invite the workspace members.
  2. Check the workspace chats were created for each workspace member in the Search Page and send them a message.
  3. Login with the workspace members and verify there's only one workspace chat and check the message of the admin was received.
  • (Test) Verify that no errors appear in the JS console
  • (QA) Verify that no errors appear in the JS console

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

User:
Screen Shot 2022-02-23 at 18 41 44

Admin:
Screen Shot 2022-02-23 at 18 43 15

Mobile Web

User (with search value):
Screen Shot 2022-02-23 at 18 49 21

Admin (with search value):
Screen Shot 2022-02-23 at 18 30 34

Desktop

Screen Shot 2022-02-23 at 18 52 38

iOS

Screen Shot 2022-02-23 at 19 01 07

Screen Shot 2022-02-23 at 19 02 30

Android

Screen Shot 2022-02-23 at 19 52 32

Screen Shot 2022-02-23 at 19 52 41

@marcochavezf marcochavezf self-assigned this Feb 22, 2022
@TomatoToaster TomatoToaster self-requested a review February 23, 2022 20:26
Copy link
Contributor

@TomatoToaster TomatoToaster left a comment

Choose a reason for hiding this comment

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

Great start on this, excited for you to finish it. I just had one suggestion ahead of you finishing this.

src/libs/OptionsListUtils.js Outdated Show resolved Hide resolved
@marcochavezf marcochavezf requested a review from roryabraham March 2, 2022 21:59
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

This LGTM just one had more comment to leave.

Very nice work overall with this and I appreciate the clean up that is happening here. I would maybe have liked to see a PR with fewer changes (though not sure how possible it would have been in this case). Did find it a bit hard to focus on all the changes at once.

* @returns {Array<*>}
*/
function getAvatarSources(report) {
return _.map(lodashGet(report, 'icons', ['']), (source) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

If can, please add some kind of comment here about why we are defaulting to an array with an empty string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I'm planning to merge this function with getReportIcons in another PR (GH issue), in theory if we use only one function (get the Icon components just when the option row is created) we won't need to use empty strings to represent a possible icon.

Also I think this solution is important in order to show the up-to-date avatar when the workspace avatar is changed, because right now we can only display the up-to-date workspace image when we reload the app (yesterday I tried to addressed this by updating the icons from Onyx storage, but then I realized is better to merge these functions and get the icons after the reports are retrieved from Onyx, and not before like currently happens).

I'm going to be OOO for a few days but I will address this issue when I'm come back.

@marcaaron
Copy link
Contributor

This is some good advice here (at least I realized how important it is as time goes on).

Copy link
Contributor

@TomatoToaster TomatoToaster left a comment

Choose a reason for hiding this comment

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

You can add the comment that Marc mentioned but otherwise this LGTM.

containerStyles={[styles.singleAvatarLarge, styles.mb4]}
imageStyles={[styles.singleAvatarLarge]}
source={this.props.report.icons[0]}
source={_.first(OptionsListUtils.getAvatarSources(this.props.report))}
Copy link
Contributor

Choose a reason for hiding this comment

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

I wanna note that this breaks the icons here, but I've already fixed that in my PR with this commit (I used your updates to RoomHeaderAvatars too!): 5030078

It's not really relevant in this PR, so no need to add it here, I just noticed it when I added reportDetailsView for the policyExpenseChats (which is something I have to do for my PR). The only reason I bring it up is that if anyone notices this is off, it's already fixed!

secondaryTooltip: PropTypes.string,

/** Set the size of avatars */
mode: PropTypes.oneOf(_.values(CONST.OPTION_MODE)),
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB but in your follow-up I would recommend changing this prop to size to match the other avatar components

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing, also I will add a Storybook stories of SubscriptAvatar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I addressed this change here #8144

@roryabraham roryabraham merged commit 7d6ed27 into main Mar 4, 2022
@roryabraham roryabraham deleted the marco-avatarsWorkspaceChats branch March 4, 2022 00:33
@MelvinBot
Copy link

Triggered auto assignment to @ctkochan22 (InternalQA), see https://stackoverflow.com/c/expensify/questions/5042 for more details.

@botify
Copy link

botify commented Mar 4, 2022

@roryabraham looks like this was merged without passing tests. Please add a note explaining why this was done and remove the Emergency label if this is not an emergency.

@roryabraham
Copy link
Contributor

roryabraham commented Mar 4, 2022

I'm like 90% sure tests were already passing here. If not, that was a mistake on my part 😬

Unless I'm going crazy I've seen this Emergency label get mis-applied a few times recently

@OSBotify
Copy link
Contributor

OSBotify commented Mar 4, 2022

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

@thesahindia
Copy link
Member

Looks like we have got a regression
Screenshot 2022-03-04 at 1 52 26 PM
cc: @roryabraham @marcochavezf

@TomatoToaster
Copy link
Contributor

TomatoToaster commented Mar 4, 2022

@thesahindia I've got a fix for this, let me pull it out of my PR so it can be merged sooner.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @roryabraham in version: 1.1.42-0 🚀

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

@TomatoToaster
Copy link
Contributor

Verified this worked on web:
user view:
image

From admin view:
image

Admin's own chat:
image

iOS images in next comment.

@TomatoToaster
Copy link
Contributor

iOS images:
admin chat view:
image

admin viewing user's chat:
image

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @chiragsalian in version: 1.1.42-6 🚀

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
InternalQA This pull request required internal QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants