Skip to content

Commit

Permalink
Merge branch 'develop' into chore/password-policies-new
Browse files Browse the repository at this point in the history
  • Loading branch information
hugocostadev authored Sep 11, 2023
2 parents 3407344 + 7b0b4f9 commit 3252f3e
Show file tree
Hide file tree
Showing 83 changed files with 913 additions and 514 deletions.
29 changes: 29 additions & 0 deletions apps/meteor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# @rocket.chat/meteor

## 6.3.4

### Patch Changes

- db919f9b23: Bump @rocket.chat/meteor version.
- Bump @rocket.chat/meteor version.
- ebeb088441: fix: Prevent `RoomProvider.useEffect` from subscribing to room-data stream multiple times
- 8a7d5d3898: fix: agent role being removed upon user deactivation
- 759fe2472a: chore: Increase cache time from 5s to 10s on `getUnits` helpers. This should reduce the number of DB calls made by this method to fetch the unit limitations for a user.
- Updated dependencies [8a7d5d3898]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]
- @rocket.chat/[email protected]

## 6.3.3

### Patch Changes
Expand Down
168 changes: 100 additions & 68 deletions apps/meteor/client/views/account/profile/AccountProfileForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import UserAvatarEditor from '../../../components/avatar/UserAvatarEditor';
import { useUpdateAvatar } from '../../../hooks/useUpdateAvatar';
import { USER_STATUS_TEXT_MAX_LENGTH, BIO_TEXT_MAX_LENGTH } from '../../../lib/constants';
import type { AccountProfileFormValues } from './getProfileInitialValues';
import { getProfileInitialValues } from './getProfileInitialValues';
import { useAccountProfileSettings } from './useAccountProfileSettings';

const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>): ReactElement => {
Expand All @@ -46,10 +45,8 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>): ReactEle
} = useAccountProfileSettings();

const {
register,
control,
watch,
reset,
handleSubmit,
formState: { errors },
} = useFormContext<AccountProfileFormValues>();
Expand Down Expand Up @@ -97,10 +94,10 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>): ReactEle
try {
await updateOwnBasicInfo(
{
...(allowRealNameChange ? { realname: name } : {}),
...(allowEmailChange && user ? getUserEmailAddress(user) !== email && { email } : {}),
...(canChangeUsername ? { username } : {}),
...(allowUserStatusMessageChange ? { statusText } : {}),
realname: name,
...(user ? getUserEmailAddress(user) !== email && { email } : {}),
username,
statusText,
statusType,
nickname,
bio,
Expand All @@ -110,7 +107,6 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>): ReactEle

await updateAvatar();
dispatchToastMessage({ type: 'success', message: t('Profile_saved_successfully') });
reset(getProfileInitialValues(user));
} catch (error) {
dispatchToastMessage({ type: 'error', message: error });
}
Expand Down Expand Up @@ -147,16 +143,21 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>): ReactEle
{t('Name')}
</Field.Label>
<Field.Row>
<TextInput
{...register('name', {
validate: (name) => (requireName && name === '' ? t('error-the-field-is-required', { field: t('Name') }) : true),
})}
id={nameId}
error={errors.name?.message}
disabled={!allowRealNameChange}
aria-required='true'
aria-invalid={errors.username ? 'true' : 'false'}
aria-describedby={`${nameId}-error ${nameId}-hint`}
<Controller
control={control}
name='name'
rules={{ validate: (name) => (requireName && name === '' ? t('error-the-field-is-required', { field: t('Name') }) : true) }}
render={({ field }) => (
<TextInput
{...field}
id={nameId}
error={errors.name?.message}
disabled={!allowRealNameChange}
aria-required='true'
aria-invalid={errors.username ? 'true' : 'false'}
aria-describedby={`${nameId}-error ${nameId}-hint`}
/>
)}
/>
</Field.Row>
{errors.name && (
Expand All @@ -171,17 +172,25 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>): ReactEle
{t('Username')}
</Field.Label>
<Field.Row>
<TextInput
{...register('username', {
<Controller
control={control}
name='username'
rules={{
required: t('error-the-field-is-required', { field: t('Username') }),
validate: (username) => validateUsername(username),
})}
id={usernameId}
error={errors.username?.message}
addon={<Icon name='at' size='x20' />}
aria-required='true'
aria-invalid={errors.username ? 'true' : 'false'}
aria-describedby={`${usernameId}-error ${usernameId}-hint`}
}}
render={({ field }) => (
<TextInput
{...field}
id={usernameId}
disabled={!canChangeUsername}
error={errors.username?.message}
addon={<Icon name='at' size='x20' />}
aria-required='true'
aria-invalid={errors.username ? 'true' : 'false'}
aria-describedby={`${usernameId}-error ${usernameId}-hint`}
/>
)}
/>
</Field.Row>
{errors?.username && (
Expand All @@ -195,26 +204,31 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>): ReactEle
<Field>
<Field.Label htmlFor={statusTextId}>{t('StatusMessage')}</Field.Label>
<Field.Row>
<TextInput
id={statusTextId}
{...register('statusText', {
maxLength: { value: USER_STATUS_TEXT_MAX_LENGTH, message: t('Max_length_is', USER_STATUS_TEXT_MAX_LENGTH) },
})}
error={errors?.statusText?.message}
disabled={!allowUserStatusMessageChange}
flexGrow={1}
placeholder={t('StatusMessage_Placeholder')}
aria-invalid={errors.statusText ? 'true' : 'false'}
aria-describedby={`${statusTextId}-error ${statusTextId}-hint`}
addon={
<Controller
control={control}
name='statusType'
render={({ field: { value, onChange } }) => (
<UserStatusMenu margin='neg-x2' onChange={onChange} initialStatus={value as IUser['status']} />
)}
<Controller
control={control}
name='statusText'
rules={{ maxLength: { value: USER_STATUS_TEXT_MAX_LENGTH, message: t('Max_length_is', USER_STATUS_TEXT_MAX_LENGTH) } }}
render={({ field }) => (
<TextInput
{...field}
id={statusTextId}
error={errors?.statusText?.message}
disabled={!allowUserStatusMessageChange}
flexGrow={1}
placeholder={t('StatusMessage_Placeholder')}
aria-invalid={errors.statusText ? 'true' : 'false'}
aria-describedby={`${statusTextId}-error ${statusTextId}-hint`}
addon={
<Controller
control={control}
name='statusType'
render={({ field: { value, onChange } }) => (
<UserStatusMenu margin='neg-x2' onChange={onChange} initialStatus={value as IUser['status']} />
)}
/>
}
/>
}
)}
/>
</Field.Row>
{errors?.statusText && (
Expand All @@ -227,21 +241,34 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>): ReactEle
<Field>
<Field.Label htmlFor={nicknameId}>{t('Nickname')}</Field.Label>
<Field.Row>
<TextInput id={nicknameId} {...register('nickname')} flexGrow={1} addon={<Icon name='edit' size='x20' alignSelf='center' />} />
<Controller
control={control}
name='nickname'
render={({ field }) => (
<TextInput {...field} id={nicknameId} flexGrow={1} addon={<Icon name='edit' size='x20' alignSelf='center' />} />
)}
/>
</Field.Row>
</Field>
<Field>
<Field.Label htmlFor={bioId}>{t('Bio')}</Field.Label>
<Field.Row>
<TextAreaInput
id={bioId}
{...register('bio', { maxLength: { value: BIO_TEXT_MAX_LENGTH, message: t('Max_length_is', BIO_TEXT_MAX_LENGTH) } })}
error={errors.bio?.message}
rows={3}
flexGrow={1}
addon={<Icon name='edit' size='x20' alignSelf='center' />}
aria-invalid={errors.statusText ? 'true' : 'false'}
aria-describedby={`${bioId}-error`}
<Controller
control={control}
name='bio'
rules={{ maxLength: { value: BIO_TEXT_MAX_LENGTH, message: t('Max_length_is', BIO_TEXT_MAX_LENGTH) } }}
render={({ field }) => (
<TextAreaInput
{...field}
id={bioId}
error={errors.bio?.message}
rows={3}
flexGrow={1}
addon={<Icon name='edit' size='x20' alignSelf='center' />}
aria-invalid={errors.statusText ? 'true' : 'false'}
aria-describedby={`${bioId}-error`}
/>
)}
/>
</Field.Row>
{errors?.bio && (
Expand All @@ -255,18 +282,23 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>): ReactEle
{t('Email')}
</Field.Label>
<Field.Row display='flex' flexDirection='row' justifyContent='space-between'>
<TextInput
id={emailId}
{...register('email', {
validate: { validateEmail: (email) => (validateEmail(email) ? undefined : t('error-invalid-email-address')) },
})}
flexGrow={1}
error={errors.email?.message}
addon={<Icon name={isUserVerified ? 'circle-check' : 'mail'} size='x20' />}
disabled={!allowEmailChange}
aria-required='true'
aria-invalid={errors.email ? 'true' : 'false'}
aria-describedby={`${emailId}-error ${emailId}-hint`}
<Controller
control={control}
name='email'
rules={{ validate: { validateEmail: (email) => (validateEmail(email) ? undefined : t('error-invalid-email-address')) } }}
render={({ field }) => (
<TextInput
{...field}
id={emailId}
flexGrow={1}
error={errors.email?.message}
addon={<Icon name={isUserVerified ? 'circle-check' : 'mail'} size='x20' />}
disabled={!allowEmailChange}
aria-required='true'
aria-invalid={errors.email ? 'true' : 'false'}
aria-describedby={`${emailId}-error ${emailId}-hint`}
/>
)}
/>
{!isUserVerified && (
<Button disabled={email !== previousEmail} onClick={handleSendConfirmationEmail} mis={24}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Grid } from '@rocket.chat/fuselage';
import { Card } from '@rocket.chat/ui-client';
import { Card, CardBody, CardTitle } from '@rocket.chat/ui-client';
import React from 'react';

import useFeatureBullets from '../hooks/useFeatureBullets';
Expand All @@ -12,8 +12,8 @@ const RegisterWorkspaceCards = () => {
{bulletFeatures.map((card) => (
<Grid.Item key={card.key} xs={4} sm={4} md={4} lg={4} xl={3}>
<Card>
<Card.Title>{card.title}</Card.Title>
<Card.Body height='x88'>{card.description}</Card.Body>
<CardTitle>{card.title}</CardTitle>
<CardBody height='x88'>{card.description}</CardBody>
</Card>
</Grid.Item>
))}
Expand Down
64 changes: 32 additions & 32 deletions apps/meteor/client/views/admin/info/DeploymentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { IServerInfo, IStats, Serialized } from '@rocket.chat/core-typings'
import { ButtonGroup, Button } from '@rocket.chat/fuselage';
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import type { IInstance } from '@rocket.chat/rest-typings';
import { Card } from '@rocket.chat/ui-client';
import { Card, CardBody, CardCol, CardTitle, CardColSection, CardColTitle, CardFooter } from '@rocket.chat/ui-client';
import { useSetModal, useTranslation } from '@rocket.chat/ui-contexts';
import type { ReactElement } from 'react';
import React, { memo } from 'react';
Expand Down Expand Up @@ -31,57 +31,57 @@ const DeploymentCard = ({ info, statistics, instances }: DeploymentCardProps): R

return (
<Card data-qa-id='deployment-card'>
<Card.Title>{t('Deployment')}</Card.Title>
<Card.Body>
<Card.Col>
<Card.Col.Section>
<Card.Col.Title>{t('Version')}</Card.Col.Title>
<CardTitle>{t('Deployment')}</CardTitle>
<CardBody>
<CardCol>
<CardColSection>
<CardColTitle>{t('Version')}</CardColTitle>
{statistics.version}
</Card.Col.Section>
<Card.Col.Section>
<Card.Col.Title>{t('Deployment_ID')}</Card.Col.Title>
</CardColSection>
<CardColSection>
<CardColTitle>{t('Deployment_ID')}</CardColTitle>
{statistics.uniqueId}
</Card.Col.Section>
</CardColSection>
{appsEngineVersion && (
<Card.Col.Section>
<Card.Col.Title>{t('Apps_Engine_Version')}</Card.Col.Title>
<CardColSection>
<CardColTitle>{t('Apps_Engine_Version')}</CardColTitle>
{appsEngineVersion}
</Card.Col.Section>
</CardColSection>
)}
<Card.Col.Section>
<Card.Col.Title>{t('Node_version')}</Card.Col.Title>
<CardColSection>
<CardColTitle>{t('Node_version')}</CardColTitle>
{statistics.process.nodeVersion}
</Card.Col.Section>
<Card.Col.Section>
<Card.Col.Title>{t('DB_Migration')}</Card.Col.Title>
</CardColSection>
<CardColSection>
<CardColTitle>{t('DB_Migration')}</CardColTitle>
{`${statistics.migration.version} (${formatDateAndTime(statistics.migration.lockedAt)})`}
</Card.Col.Section>
<Card.Col.Section>
<Card.Col.Title>{t('MongoDB')}</Card.Col.Title>
</CardColSection>
<CardColSection>
<CardColTitle>{t('MongoDB')}</CardColTitle>
{`${statistics.mongoVersion} / ${statistics.mongoStorageEngine} ${
!statistics.msEnabled ? `(oplog ${statistics.oplogEnabled ? t('Enabled') : t('Disabled')})` : ''
}`}
</Card.Col.Section>
<Card.Col.Section>
<Card.Col.Title>{t('Commit_details')}</Card.Col.Title>
</CardColSection>
<CardColSection>
<CardColTitle>{t('Commit_details')}</CardColTitle>
{t('github_HEAD')}: ({commit.hash ? commit.hash.slice(0, 9) : ''}) <br />
{t('Branch')}: {commit.branch}
</Card.Col.Section>
<Card.Col.Section>
<Card.Col.Title>{t('PID')}</Card.Col.Title>
</CardColSection>
<CardColSection>
<CardColTitle>{t('PID')}</CardColTitle>
{statistics.process.pid}
</Card.Col.Section>
</Card.Col>
</Card.Body>
</CardColSection>
</CardCol>
</CardBody>

{!!instances.length && (
<Card.Footer>
<CardFooter>
<ButtonGroup align='end'>
<Button small onClick={handleInstancesModal}>
{t('Instances')}
</Button>
</ButtonGroup>
</Card.Footer>
</CardFooter>
)}
</Card>
);
Expand Down
Loading

0 comments on commit 3252f3e

Please sign in to comment.