Skip to content

Commit

Permalink
Merge branch 'develop' into chore/team-mentions-ce
Browse files Browse the repository at this point in the history
  • Loading branch information
scuciatto authored Sep 11, 2023
2 parents 2ce2b28 + 7b0b4f9 commit 2b79b74
Show file tree
Hide file tree
Showing 86 changed files with 927 additions and 523 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-bees-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': minor
---

New helper for Apps to notify users via a Direct Message
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
4 changes: 2 additions & 2 deletions apps/meteor/app/apps/server/bridges/messages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IMessage } from '@rocket.chat/apps-engine/definition/messages';
import type { IMessage, IDirectMessage } from '@rocket.chat/apps-engine/definition/messages';
import type { IRoom } from '@rocket.chat/apps-engine/definition/rooms';
import type { IUser } from '@rocket.chat/apps-engine/definition/users';
import type { ITypingDescriptor } from '@rocket.chat/apps-engine/server/bridges/MessageBridge';
Expand All @@ -17,7 +17,7 @@ export class AppMessageBridge extends MessageBridge {
super();
}

protected async create(message: IMessage, appId: string): Promise<string> {
protected async create(message: IMessage | IDirectMessage, appId: string): Promise<string> {
this.orch.debugLog(`The App ${appId} is creating a new message.`);

const convertedMessage = await this.orch.getConverters()?.get('messages').convertAppMessage(message);
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
Loading

0 comments on commit 2b79b74

Please sign in to comment.