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

Account Profile rewritten #18076

Merged
merged 20 commits into from
Jul 14, 2020
Merged

Account Profile rewritten #18076

merged 20 commits into from
Jul 14, 2020

Conversation

gabriellsh
Copy link
Member

@gabriellsh gabriellsh commented Jun 30, 2020

Proposed changes

Rewrite User Profile Page using React

Issue(s)

How to test or reproduce

Screenshots

image

image

image

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Hotfix (a major bugfix that has to be merged asap)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Changelog

Further comments

@lgtm-com
Copy link

lgtm-com bot commented Jun 30, 2020

This pull request introduces 4 alerts and fixes 2 when merging 8cde558 into 0c26dca - view on LGTM.com

new alerts:

  • 2 for Duplicate HTML element attributes
  • 2 for Useless assignment to property

fixed alerts:

  • 1 for Duplicate HTML element attributes
  • 1 for Useless assignment to property

@ggazzo ggazzo changed the base branch from develop to rewrite/accounts June 30, 2020 17:36
@lgtm-com
Copy link

lgtm-com bot commented Jun 30, 2020

This pull request introduces 4 alerts and fixes 2 when merging 8cde558 into 1157075 - view on LGTM.com

new alerts:

  • 2 for Duplicate HTML element attributes
  • 2 for Useless assignment to property

fixed alerts:

  • 1 for Duplicate HTML element attributes
  • 1 for Useless assignment to property

@gabriellsh gabriellsh force-pushed the new/rewrite_account_profile branch from 8cde558 to 796d08b Compare June 30, 2020 18:24
gabriellsh and others added 6 commits June 30, 2020 15:36
…into new/rewrite_account_profile

* 'rewrite/accounts' of github.com:RocketChat/Rocket.Chat:
  [FIX] Avatar ETag missing from User (#18109)
  Handle callback returning promise. (#18102)
  [FIX] Not possible to read encrypted messages after disable E2E on channel level (#18101)
}, [url, username, userId]);

function UserAvatar({ url, username, userId, ...props }) {
const avatarUrl = useAvatarUrl({ url, username, userId });
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not lift this hook up to the parent? Instead of having two mutually exclusive props (url and userId) that can be accidentally set together, it can receive only url.

Copy link
Member Author

Choose a reason for hiding this comment

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

In my opinion, the idea of having a specific component like UserAvatar should allow me to not bother about how I get the URL. If we make it that only the URL is accepted, the behaviour won't differ from the Avatar component from fuselage.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree it's great to have some encapsulation, but it should be closely-knit. If I've the option to pass the user ID, then why did I need to set username too if it can be resolved the same way url is? If the answer is "sometimes you already have it and we don't need to recompute", then this url and username resolution shouldn't really be here.

Copy link
Contributor

Choose a reason for hiding this comment

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

As an example, in UserAvatar is a dumb component in UserAvatarEditor when it serves as a view for suggestions, but also it's used as the de facto component to show user avatar. If UserAvatar must have some logic to show the avatar for a user, then Avatar should be used elsewhere.

…into new/rewrite_account_profile

* 'rewrite/accounts' of github.com:RocketChat/Rocket.Chat:
  [FIX] Cannot open admin when server uses ROOT_URL with subpath (#18105) (#18147)
  [FIX] App details returns to apps table, instead of previous page (#18080)
  [FIX] Clipboard not working when permalinking a pinned message (#18047)
  [FIX] "Add reaction" icon missing when the viewport size is smaller than 500px (#18110)
  [FIX] Jitsi opening twice (#18111)
  [FIX] Email notifications were still being sent for online users (#18088)
  [FIX] The livechat agent activity monitor wasn't being initialised because due to an internal error (#18090)
@tassoevan tassoevan changed the title chore: Rewrite account profile [NEW] Account Profile rewritten Jul 7, 2020
client/account/AccountProfileForm.js Outdated Show resolved Hide resolved
client/account/AccountProfileForm.js Outdated Show resolved Hide resolved
client/account/AccountProfilePage.js Outdated Show resolved Hide resolved
app/threads/client/components/ThreadListMessage.js Outdated Show resolved Hide resolved
client/account/AccountProfileForm.js Show resolved Hide resolved
client/account/AccountProfilePage.js Outdated Show resolved Hide resolved
@tassoevan tassoevan added this to the 3.5.0 milestone Jul 13, 2020
@gabriellsh gabriellsh force-pushed the new/rewrite_account_profile branch from 5402457 to 630dafc Compare July 13, 2020 15:49
@tassoevan tassoevan self-requested a review July 13, 2020 16:40
@gabriellsh gabriellsh force-pushed the new/rewrite_account_profile branch from 630dafc to 3a5689e Compare July 13, 2020 17:45
client/account/AccountRoute.js Outdated Show resolved Hide resolved
client/admin/users/EditUser.js Outdated Show resolved Hide resolved

export function UserAvatarEditor({ username, setAvatarObj }) {
function UserAvatarSuggestions({ suggestions, setAvatarObj, setNewAvatarSource, disabled, ...props }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer event listeners (on*) over setters (set*) passed through props.

Comment on lines +10 to +11
setAvatarObj(suggestion);
setNewAvatarSource(suggestion.blob);
Copy link
Contributor

@tassoevan tassoevan Jul 13, 2020

Choose a reason for hiding this comment

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

If these setters are called together, it's interesting to trigger a single event for them, the reason being each setter call its own component update and we should let the parent component to decide if it two updates are needed or not (e.g. a single dispatch call from a useReducer hook).

client/helpers/getUserEmailAddress.js Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Jul 14, 2020

This pull request introduces 4 alerts when merging 8aa5c56 into b7668c5 - view on LGTM.com

new alerts:

  • 4 for Unused variable, import, function or class

@ggazzo ggazzo changed the title [NEW] Account Profile rewritten Account Profile rewritten Jul 14, 2020
@ggazzo ggazzo merged commit 96b094a into rewrite/accounts Jul 14, 2020
@ggazzo ggazzo deleted the new/rewrite_account_profile branch July 14, 2020 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants