Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into improve-create-roo…
Browse files Browse the repository at this point in the history
…m-multiple-users
  • Loading branch information
sampaiodiego committed Oct 5, 2023
2 parents 08a57e4 + 9aee190 commit a524c2a
Show file tree
Hide file tree
Showing 158 changed files with 1,668 additions and 1,330 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-cows-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

download translation files through CDN
5 changes: 5 additions & 0 deletions .changeset/sweet-chefs-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Check for room scoped permissions for starting discussions
5 changes: 5 additions & 0 deletions .changeset/tiny-wolves-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/ui-theming': patch
---

fix: light-theme font-disabled color
7 changes: 7 additions & 0 deletions .changeset/tough-carrots-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@rocket.chat/rest-typings': minor
'@rocket.chat/license': patch
'@rocket.chat/meteor': patch
---

feat: added `licenses.info` endpoint
2 changes: 2 additions & 0 deletions .github/actions/build-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ runs:

steps:
- name: Login to GitHub Container Registry
if: (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'release' || github.ref == 'refs/heads/develop')
uses: docker/login-action@v2
with:
registry: ghcr.io
Expand Down Expand Up @@ -62,6 +63,7 @@ runs:
docker compose -f docker-compose-ci.yml build "${args[@]}"
- name: Publish Docker images to GitHub Container Registry
if: (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'release' || github.ref == 'refs/heads/develop')
shell: bash
run: |
args=(rocketchat)
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci-test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ jobs:
cache-modules: true
install: true

# if we are testing a PR from a fork, we need to build the docker image at this point
- uses: ./.github/actions/build-docker
if: github.event.pull_request.head.repo.full_name != github.repository
with:
CR_USER: ${{ secrets.CR_USER }}
CR_PAT: ${{ secrets.CR_PAT }}
node-version: ${{ inputs.node-version }}

- uses: dtinth/setup-github-actions-caching-for-turbo@v1

- name: Start httpbin container and wait for it to be ready
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ jobs:
build-gh-docker-coverage:
name: 🚢 Build Docker Images for Testing
needs: [build, release-versions]
if: (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'release' || github.ref == 'refs/heads/develop')
runs-on: ubuntu-20.04

env:
Expand All @@ -189,7 +188,10 @@ jobs:

steps:
- uses: actions/checkout@v3

# we only build and publish the actual docker images if not a PR from a fork
- uses: ./.github/actions/build-docker
if: (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'release' || github.ref == 'refs/heads/develop')
with:
CR_USER: ${{ secrets.CR_USER }}
CR_PAT: ${{ secrets.CR_PAT }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Meteor.startup(() => {
return false;
}

return uid !== user._id ? hasPermission('start-discussion-other-user') : hasPermission('start-discussion');
return uid !== user._id ? hasPermission('start-discussion-other-user', room._id) : hasPermission('start-discussion', room._id);
},
order: 1,
group: 'menu',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export const createDiscussion = async (
});
}

if (!(await hasAtLeastOnePermissionAsync(userId, ['start-discussion', 'start-discussion-other-user']))) {
if (!(await hasAtLeastOnePermissionAsync(userId, ['start-discussion', 'start-discussion-other-user'], prid))) {
throw new Meteor.Error('error-action-not-allowed', 'You are not allowed to create a discussion', { method: 'createDiscussion' });
}
const user = await Users.findOneById(userId);
Expand Down
6 changes: 0 additions & 6 deletions apps/meteor/app/theme/client/imports/general/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ body {

a {
cursor: pointer;
text-decoration: none;

&:hover,
&:active {
text-decoration: none;
}
}

button {
Expand Down
50 changes: 32 additions & 18 deletions apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import type { IMessage, IRoom, IUser } from '@rocket.chat/core-typings';
import { Modal, Field, FieldGroup, ToggleSwitch, TextInput, TextAreaInput, Button, Icon, Box } from '@rocket.chat/fuselage';
import {
Modal,
Field,
FieldGroup,
ToggleSwitch,
TextInput,
TextAreaInput,
Button,
Icon,
Box,
FieldDescription,
FieldLabel,
FieldRow,
FieldError,
} from '@rocket.chat/fuselage';
import { useTranslation, useEndpoint } from '@rocket.chat/ui-contexts';
import { useMutation } from '@tanstack/react-query';
import type { ComponentProps, ReactElement } from 'react';
Expand Down Expand Up @@ -79,11 +93,11 @@ const CreateDiscussion = ({ onClose, defaultParentRoom, parentMessageId, nameSug
<Modal.Content>
<FieldGroup>
<Field>
<Field.Description>{t('Discussion_description')}</Field.Description>
<FieldDescription>{t('Discussion_description')}</FieldDescription>
</Field>
<Field>
<Field.Label>{t('Discussion_target_channel')}</Field.Label>
<Field.Row>
<FieldLabel>{t('Discussion_target_channel')}</FieldLabel>
<FieldRow>
{defaultParentRoom && (
<Controller
control={control}
Expand All @@ -107,12 +121,12 @@ const CreateDiscussion = ({ onClose, defaultParentRoom, parentMessageId, nameSug
)}
/>
)}
</Field.Row>
{errors.parentRoom && <Field.Error>{errors.parentRoom.message}</Field.Error>}
</FieldRow>
{errors.parentRoom && <FieldError>{errors.parentRoom.message}</FieldError>}
</Field>
<Field display='flex' alignItems='center' flexDirection='row' justifyContent='spaceBetween' flexGrow={1}>
<Box display='flex' flexDirection='column' width='full'>
<Field.Label>{t('Encrypted')}</Field.Label>
<FieldLabel>{t('Encrypted')}</FieldLabel>
</Box>
<Controller
control={control}
Expand All @@ -128,34 +142,34 @@ const CreateDiscussion = ({ onClose, defaultParentRoom, parentMessageId, nameSug
/>
</Field>
<Field>
<Field.Label>{t('Discussion_name')}</Field.Label>
<Field.Row>
<FieldLabel>{t('Discussion_name')}</FieldLabel>
<FieldRow>
<TextInput
{...register('name', { required: t('Field_required') })}
placeholder={t('New_discussion_name')}
addon={<Icon name='baloons' size='x20' />}
/>
</Field.Row>
{errors.name && <Field.Error>{errors.name.message}</Field.Error>}
</FieldRow>
{errors.name && <FieldError>{errors.name.message}</FieldError>}
</Field>
<Field>
<Field.Label>{t('Invite_Users')}</Field.Label>
<Field.Row w='full' display='flex' flexDirection='column' alignItems='stretch'>
<FieldLabel>{t('Invite_Users')}</FieldLabel>
<FieldRow w='full' display='flex' flexDirection='column' alignItems='stretch'>
<Controller
control={control}
name='usernames'
render={({ field: { onChange, value } }) => (
<UserAutoCompleteMultiple value={value} onChange={onChange} placeholder={t('Username_Placeholder')} />
)}
/>
</Field.Row>
</FieldRow>
</Field>
<Field>
<Field.Label>{t('Discussion_first_message_title')}</Field.Label>
<Field.Row>
<FieldLabel>{t('Discussion_first_message_title')}</FieldLabel>
<FieldRow>
<TextAreaInput {...register('firstMessage')} placeholder={t('New_discussion_first_message')} rows={5} disabled={encrypted} />
</Field.Row>
{encrypted && <Field.Description>{t('Discussion_first_message_disabled_due_to_e2e')}</Field.Description>}
</FieldRow>
{encrypted && <FieldDescription>{t('Discussion_first_message_disabled_due_to_e2e')}</FieldDescription>}
</Field>
</FieldGroup>
</Modal.Content>
Expand Down
18 changes: 9 additions & 9 deletions apps/meteor/client/components/Omnichannel/Tags.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Field, TextInput, Chip, Button } from '@rocket.chat/fuselage';
import { TextInput, Chip, Button, FieldLabel, FieldRow } from '@rocket.chat/fuselage';
import { useMutableCallback } from '@rocket.chat/fuselage-hooks';
import { useToastMessageDispatch, useTranslation } from '@rocket.chat/ui-contexts';
import type { ChangeEvent, ReactElement } from 'react';
Expand Down Expand Up @@ -71,12 +71,12 @@ const Tags = ({ tags = [], handler, error, tagRequired, department }: TagsProps)

return (
<>
<Field.Label required={tagRequired} mb={4}>
<FieldLabel required={tagRequired} mb={4}>
{t('Tags')}
</Field.Label>
</FieldLabel>

{EETagsComponent && tagsResult?.tags && tagsResult?.tags.length ? (
<Field.Row>
<FieldRow>
<EETagsComponent
value={paginatedTagValue}
handler={(tags: { label: string; value: string }[]): void => {
Expand All @@ -85,10 +85,10 @@ const Tags = ({ tags = [], handler, error, tagRequired, department }: TagsProps)
department={department}
viewAll={!department}
/>
</Field.Row>
</FieldRow>
) : (
<>
<Field.Row>
<FieldRow>
<TextInput
error={error}
value={tagValue}
Expand All @@ -99,18 +99,18 @@ const Tags = ({ tags = [], handler, error, tagRequired, department }: TagsProps)
<Button disabled={!tagValue} mis={8} title={t('Add')} onClick={handleTagTextSubmit}>
{t('Add')}
</Button>
</Field.Row>
</FieldRow>
</>
)}

{customTags.length > 0 && (
<Field.Row justifyContent='flex-start'>
<FieldRow justifyContent='flex-start'>
{customTags?.map((tag, i) => (
<Chip key={i} onClick={(): void => removeTag(tag)} mie={8}>
{tag}
</Chip>
))}
</Field.Row>
</FieldRow>
)}
</>
);
Expand Down
61 changes: 37 additions & 24 deletions apps/meteor/client/components/Omnichannel/modals/CloseChatModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import type { ILivechatDepartment } from '@rocket.chat/core-typings';
import { Field, FieldGroup, Button, TextInput, Modal, Box, CheckBox, Divider, EmailInput } from '@rocket.chat/fuselage';
import {
Field,
FieldGroup,
Button,
TextInput,
Modal,
Box,
CheckBox,
Divider,
EmailInput,
FieldLabel,
FieldRow,
FieldError,
} from '@rocket.chat/fuselage';
import { usePermission, useSetting, useTranslation, useUserPreference } from '@rocket.chat/ui-contexts';
import type { ReactElement } from 'react';
import React, { useCallback, useState, useEffect, useMemo } from 'react';
Expand Down Expand Up @@ -134,8 +147,8 @@ const CloseChatModal = ({
<Box color='annotation'>{t('Close_room_description')}</Box>
<FieldGroup>
<Field>
<Field.Label required={commentRequired}>{t('Comment')}</Field.Label>
<Field.Row>
<FieldLabel required={commentRequired}>{t('Comment')}</FieldLabel>
<FieldRow>
<TextInput
{...register('comment')}
error={
Expand All @@ -147,50 +160,50 @@ const CloseChatModal = ({
flexGrow={1}
placeholder={t('Please_add_a_comment')}
/>
</Field.Row>
<Field.Error>{errors.comment?.message}</Field.Error>
</FieldRow>
<FieldError>{errors.comment?.message}</FieldError>
</Field>
<Field>
<Tags tagRequired={tagRequired} tags={tags} handler={handleTags} {...(department && { department: department._id })} />
<Field.Error>{errors.tags?.message}</Field.Error>
<FieldError>{errors.tags?.message}</FieldError>
</Field>
{canSendTranscript && (
<>
<Field>
<Divider />
<Field.Label marginBlockStart={8}>{t('Chat_transcript')}</Field.Label>
<FieldLabel marginBlockStart={8}>{t('Chat_transcript')}</FieldLabel>
</Field>
{canSendTranscriptPDF && (
<Field marginBlockStart={10}>
<Field.Row>
<FieldRow>
<CheckBox id='transcript-pdf' {...register('transcriptPDF', { value: userTranscriptPDF })} />
<Field.Label htmlFor='transcript-pdf' color='default' fontScale='c1'>
<FieldLabel htmlFor='transcript-pdf' color='default' fontScale='c1'>
{t('Omnichannel_transcript_pdf')}
</Field.Label>
</Field.Row>
</FieldLabel>
</FieldRow>
</Field>
)}
{canSendTranscriptEmail && (
<>
<Field marginBlockStart={10}>
<Field.Row>
<FieldRow>
<CheckBox id='transcript-email' {...register('transcriptEmail', { value: userTranscriptEmail })} />
<Field.Label htmlFor='transcript-email' color='default' fontScale='c1'>
<FieldLabel htmlFor='transcript-email' color='default' fontScale='c1'>
{t('Omnichannel_transcript_email')}
</Field.Label>
</Field.Row>
</FieldLabel>
</FieldRow>
</Field>
{transcriptEmail && (
<>
<Field marginBlockStart={14}>
<Field.Label required>{t('Contact_email')}</Field.Label>
<Field.Row>
<FieldLabel required>{t('Contact_email')}</FieldLabel>
<FieldRow>
<EmailInput value={visitorEmail} required disabled flexGrow={1} />
</Field.Row>
</FieldRow>
</Field>
<Field marginBlockStart={12}>
<Field.Label required>{t('Subject')}</Field.Label>
<Field.Row>
<FieldLabel required>{t('Subject')}</FieldLabel>
<FieldRow>
<TextInput
{...register('subject', { required: true })}
className='active'
Expand All @@ -202,19 +215,19 @@ const CloseChatModal = ({
}
flexGrow={1}
/>
</Field.Row>
<Field.Error>{errors.subject?.message}</Field.Error>
</FieldRow>
<FieldError>{errors.subject?.message}</FieldError>
</Field>
</>
)}
</>
)}
<Field marginBlockStart={16}>
<Field.Label color='annotation' fontScale='c1'>
<FieldLabel color='annotation' fontScale='c1'>
{canSendTranscriptPDF && canSendTranscriptEmail
? t('These_options_affect_this_conversation_only_To_set_default_selections_go_to_My_Account_Omnichannel')
: t('This_option_affect_this_conversation_only_To_set_default_selection_go_to_My_Account_Omnichannel')}
</Field.Label>
</FieldLabel>
</Field>
</>
)}
Expand Down
Loading

0 comments on commit a524c2a

Please sign in to comment.