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

fix: VideoConf message not considers display avatar pref #33141

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

dougfabris
Copy link
Member

@dougfabris dougfabris commented Aug 23, 2024

Proposed changes (including videos or screenshots)

Depends on: #35031

Issue(s)

Steps to test or reproduce

Further comments

CORE-656

Copy link
Contributor

dionisio-bot bot commented Aug 23, 2024

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is targeting the wrong base branch. It should target 7.4.0, but it targets 7.3.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

Copy link

changeset-bot bot commented Aug 23, 2024

🦋 Changeset detected

Latest commit: 6a27c57

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 37 packages
Name Type
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/i18n Patch
@rocket.chat/meteor Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-voip Patch
@rocket.chat/gazzodown Patch
@rocket.chat/livechat Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/model-typings Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/instance-status Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dougfabris dougfabris added this to the 6.13 milestone Aug 23, 2024
Copy link

codecov bot commented Aug 23, 2024

Codecov Report

Attention: Patch coverage is 29.16667% with 17 lines in your changes missing coverage. Please review.

Project coverage is 59.16%. Comparing base (c8c8eaa) to head (6a27c57).
Report is 6 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #33141      +/-   ##
===========================================
- Coverage    59.17%   59.16%   -0.01%     
===========================================
  Files         2822     2822              
  Lines        68124    68137      +13     
  Branches     15149    15153       +4     
===========================================
+ Hits         40314    40316       +2     
- Misses       24978    24988      +10     
- Partials      2832     2833       +1     
Flag Coverage Δ
unit 74.97% <29.16%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@scuciatto scuciatto removed this from the 6.13 milestone Sep 16, 2024
@dougfabris dougfabris added this to the 7.3.0 milestone Dec 20, 2024
@scuciatto scuciatto modified the milestones: 7.3.0, 7.4.0 Jan 20, 2025
@dougfabris dougfabris force-pushed the fix/videoconf-display-avatars branch from 78fe4d9 to 3d5471f Compare January 22, 2025 19:09
@dougfabris dougfabris added this to the 7.4.0 milestone Jan 22, 2025
@dougfabris dougfabris force-pushed the fix/videoconf-display-avatars branch from 3d5471f to 7666449 Compare January 23, 2025 19:26
Copy link
Contributor

github-actions bot commented Jan 23, 2025

PR Preview Action v1.6.0

🚀 View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-33141/

Built to branch gh-pages at 2025-01-24 12:56 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@dougfabris dougfabris marked this pull request as ready for review January 24, 2025 13:45
@dougfabris dougfabris requested a review from a team as a code owner January 24, 2025 13:45
await setUserPreferences(api, { displayAvatars: true });
});

test('should not render avatars in video conference message block', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Does it make sense to have different combinations like: should render the avatars if the user preference is true, also, what should happen when the list contains user with and without avatars?

Copy link
Member Author

@dougfabris dougfabris Jan 24, 2025

Choose a reason for hiding this comment

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

I don't see why making a test to check the default assertion for this preference, we already have a test to check if the message block is there and the preference is true by default, so I added a test just to check if its ignoring the avatars properly when changing the preference. But if you think that makes sense adding an extra assertion for that, I can add it

what should happen when the list contains user with and without avatars

Basically what I'm testing, if the avatars are there or not

Copy link
Member

Choose a reason for hiding this comment

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

There's never "users without avatar" afaik. If the user has no avatar it's the default one...

<Box display='flex' alignItems='center' mi='neg-x2'>
{users.slice(0, MAX_USERS).map(({ name, username }, index) => (
<Box mi={2} key={index}>
<Avatar size='x28' alt={username || ''} title={showRealName ? name : username} url={getUserAvatarPath(username as string)} />
Copy link
Member

Choose a reason for hiding this comment

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

Name can be undefined here, so we have to fallback to username when that happens

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, let's replace it with the hook we're isolating in ui-client

Comment on lines +10 to +12
displayAvatars?: boolean;
iconTitle?: string;
showRealName?: ISetting['value'];
Copy link
Member

Choose a reason for hiding this comment

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

Why not get this info from the context inside the component, instead of passing as props?

@@ -97,6 +101,23 @@ const VideoConferenceBlock = ({
}
};

const getMessageFooterText = useCallback(
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this has to be a useCallback, since it's just called below, it won't trigger rendering.

Maybe instead we could have a useMemo, or define this function outside the component?


const joinedUsernames = [...data.users]
.splice(0, MAX_USERS)
.map(({ name, username }) => (showRealName ? name : username))
Copy link
Member

Choose a reason for hiding this comment

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

Name can be undefined here.

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, let's replace it with the hook we're isolating in ui-client

Comment on lines +137 to +142
data.users.length > MAX_USERS
? t('__usernames__and__count__more_joined', {
usernames: joinedUsernames,
count: data.users.length - MAX_USERS,
})
: t('__usernames__joined', { usernames: joinedUsernames });
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this respect the useRealName setting aswell?

Copy link
Member

Choose a reason for hiding this comment

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

I didn't realize that joinedUsernames was already doing the check. Can you change the name of that var to joinedNamesOrUsernames so that it's clearer?

Copy link
Member Author

Choose a reason for hiding this comment

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

Shouldn't this respect the useRealName setting aswell?

yep, let's replace it with the hook we're isolating in ui-client

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.

4 participants