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

chore(a11y): ProfileView #6036

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

Conversation

OtavioStasiak
Copy link
Contributor

@OtavioStasiak OtavioStasiak commented Dec 2, 2024

Proposed changes

Migrate ProfileView to hooks and Added accessibility features to the RegisterView.

Issue(s)

https://rocketchat.atlassian.net/browse/MA-198
https://rocketchat.atlassian.net/browse/NATIVE-19

How to test or reproduce

Screenshots

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)
  • 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

Further comments

@OtavioStasiak OtavioStasiak force-pushed the chore-a11y-profile-view branch from 233ca73 to f92c7b7 Compare December 4, 2024 20:40
@OtavioStasiak OtavioStasiak marked this pull request as ready for review December 4, 2024 20:57
app/i18n/locales/en.json Show resolved Hide resolved

// https://github.com/RocketChat/Rocket.Chat/blob/174c28d40b3d5a52023ee2dca2e81dd77ff33fa5/apps/meteor/app/lib/server/functions/saveUser.js#L24-L25
const MAX_BIO_LENGTH = 260;
const MAX_NICKNAME_LENGTH = 120;
const passwordRules = /^(?!.*(.)\1{2})^(?=.*[a-z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,24}$/;
Copy link
Member

Choose a reason for hiding this comment

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

Where did you get this from?
Password policy are built around admin choices

image

https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/ui-contexts/src/hooks/useVerifyPassword.ts#L8

},
resolver: yupResolver(validationSchema)
});
const parsedCustomFields = getParsedCustomFields(Accounts_CustomFields);
Copy link
Member

Choose a reason for hiding this comment

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

Since getParsedCustomFields does a serialization with a try/catch, I think it makes sense to make it a custom hook with useMemo.
The way it is right now, getParsedCustomFields is called on every render, which does a JSON.parse.

You can use useMemo to run these parses only once and a custom hook would remove the need of a getParsedCustomFields file, since you're going to add the whole logic inside useParsedCustomFields file.

app/views/ProfileView/index.tsx Outdated Show resolved Hide resolved
app/views/ProfileView/index.tsx Outdated Show resolved Hide resolved
return null;
}
try {
const parsedCustomFields = JSON.parse(Accounts_CustomFields);
Copy link
Member

Choose a reason for hiding this comment

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

Same thing.
Just use useParsedCustomFields

app/views/ProfileView/index.tsx Outdated Show resolved Hide resolved
app/views/RoomInfoEditView/index.tsx Outdated Show resolved Hide resolved
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.

2 participants