Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/chilled-chicken-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": patch
"@rocket.chat/ddp-streamer": patch
---

Adds deprecation warning on `livechat:setupConnection`
5 changes: 5 additions & 0 deletions .changeset/clever-cycles-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Adds deprecation warning on `sendFileLivechatMessage`
5 changes: 5 additions & 0 deletions .changeset/lemon-kings-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes an issue where messages are not being translated immediately in omnichannel rooms
5 changes: 5 additions & 0 deletions .changeset/rare-schools-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes real-time monitoring displaying incorrect data
5 changes: 5 additions & 0 deletions .changeset/slow-tomatoes-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes an issue where pagination is not working properly in “users in role” table
1 change: 0 additions & 1 deletion apps/meteor/app/autotranslate/client/lib/autotranslate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export const createAutoTranslateMessageStreamHandler = (): ((message: ITranslate
(record) => record._id === message._id,
({ autoTranslateFetching: _, ...record }) => ({
...record,
autoTranslateShowInverse: true,
}),
);
delete AutoTranslate.messageIdsToWait[message._id];
Expand Down
9 changes: 9 additions & 0 deletions apps/meteor/app/livechat/client/lib/chartHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,12 @@ export const updateChart = async <TChartType extends chartjs.ChartType>(

chart.update();
};

export const resetChart = <TChartType extends chartjs.ChartType>(chart: chartjs.Chart<TChartType>): void => {
chart.data.labels = [];
chart.data.datasets.forEach((dataset) => {
dataset.data = [];
});

chart.update();
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Meteor } from 'meteor/meteor';

import { sendMessageLivechat } from './sendMessageLivechat';
import { FileUpload } from '../../../file-upload/server';
import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger';

interface ISendFileLivechatMessage {
roomId: string;
Expand Down Expand Up @@ -112,6 +113,7 @@ export const sendFileLivechatMessage = async ({ roomId, visitorToken, file, msgD

Meteor.methods<ServerMethods>({
async sendFileLivechatMessage(roomId, visitorToken, file, msgData = {}) {
methodDeprecationLogger.method('sendFileLivechatMessage', '8.0.0', '/v1/livechat/upload/:rid');
return sendFileLivechatMessage({ roomId, visitorToken, file, msgData });
},
});
2 changes: 2 additions & 0 deletions apps/meteor/app/livechat/server/methods/setUpConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { ServerMethods } from '@rocket.chat/ddp-client';
import { check } from 'meteor/check';
import { Meteor } from 'meteor/meteor';

import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger';
import { notifyGuestStatusChanged } from '../lib/guests';

declare module '@rocket.chat/ddp-client' {
Expand All @@ -24,6 +25,7 @@ declare module 'meteor/meteor' {

Meteor.methods<ServerMethods>({
'livechat:setUpConnection'(data) {
methodDeprecationLogger.method('livechat:setUpConnection', '8.0.0', 'This functionality is no longer supported');
check(data, {
token: String,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { useItemsPerPage } from './useItemsPerPage';
import { useItemsPerPageLabel } from './useItemsPerPageLabel';
import { useShowingResultsLabel } from './useShowingResultsLabel';

/**
* TODO: Move `usePagination` outside from `GenericTable` folder
*/
export const usePagination = (): {
current: ReturnType<typeof useCurrent>[0];
setCurrent: ReturnType<typeof useCurrent>[1];
Expand Down
18 changes: 18 additions & 0 deletions apps/meteor/client/components/UserInfo/UserInfo.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { composeStories } from '@storybook/react';
import { render } from '@testing-library/react';
import { axe } from 'jest-axe';

import * as stories from './UserInfo.stories';

const testCases = Object.values(composeStories(stories)).map((Story) => [Story.storyName || 'Story', Story]);
test.each(testCases)(`renders %s without crashing`, async (_storyname, Story) => {
const { baseElement } = render(<Story />);
expect(baseElement).toMatchSnapshot();
});

test.each(testCases)('%s should have no a11y violations', async (_storyname, Story) => {
const { container } = render(<Story />);

const results = await axe(container);
expect(results).toHaveNoViolations();
});
41 changes: 21 additions & 20 deletions apps/meteor/client/components/UserInfo/UserInfo.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
import type { Meta, StoryFn } from '@storybook/react';

import { Contextualbar } from '../Contextualbar';
import { ContextualbarDialog } from '../Contextualbar';
import * as Status from '../UserStatus';
import UserInfo from './UserInfo';
import { UserCardRole } from '../UserCard';

export default {
component: UserInfo,
parameters: {
layout: 'fullscreen',
actions: { argTypesRegex: '^on.*' },
},
decorators: [(fn) => <Contextualbar height='100vh'>{fn()}</Contextualbar>],
decorators: [
(fn) => (
<ContextualbarDialog aria-label='User Info' height='100vh'>
{fn()}
</ContextualbarDialog>
),
],
} satisfies Meta<typeof UserInfo>;

const Template: StoryFn<typeof UserInfo> = (args) => <UserInfo {...args} />;

export const Default = Template.bind({});
Default.args = {
const defaultArgs = {
name: 'Guilherme Gazzo',
username: 'guilherme.gazzo',
nickname: 'gazzo',
statusText: '🛴 currently working on User Card',
bio: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla tempus, eros convallis vulputate cursus, nisi neque eleifend libero, eget lacinia justo purus nec est. In at sodales ipsum. Sed lacinia quis purus eget pulvinar. Aenean eu pretium nunc, at aliquam magna. Praesent dignissim, tortor sed volutpat mattis, mauris diam pulvinar leo, porta commodo risus est non purus. Mauris in justo vel lorem ullamcorper hendrerit. Nam est metus, viverra a pellentesque vitae, ornare eget odio. Morbi tempor feugiat mattis. Morbi non felis tempor, aliquam justo sed, sagittis nibh. Mauris consequat ex metus. Praesent sodales sit amet nibh a vulputate. Integer commodo, mi vel bibendum sollicitudin, urna lectus accumsan ante, eget faucibus augue ex id neque. Aenean consectetur, orci a pellentesque mattis, tortor tellus fringilla elit, non ullamcorper risus nunc feugiat risus. Fusce sit amet nisi dapibus turpis commodo placerat. In tortor ante, vehicula sit amet augue et, imperdiet porta sem.',
// actions: [<UserCard.Action icon='message'/>, <UserCard.Action icon='phone'/>],
utcOffset: -3,
bio: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla tempus, eros convallis vulputate cursus, nisi neque eleifend libero, eget lacinia justo purus nec est. In at sodales ipsum. Sed lacinia quis purus eget pulvinar. Aenean eu pretium nunc, at aliquam magna. Praesent dignissim, tortor sed volutpat mattis, mauris diam pulvinar leo, porta commodo risus est non purus.',
email: 'rocketchat@rocket.chat',
status: <Status.Offline />,
roles: [<UserCardRole key='admin'>admin</UserCardRole>, <UserCardRole key='user'>user</UserCardRole>],
};

export const WithNickname = Template.bind({});
WithNickname.args = {
name: 'Guilherme Gazzo',
username: 'guilherme.gazzo',
statusText: '🛴 currently working on User Card',
bio: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla tempus, eros convallis vulputate cursus, nisi neque eleifend libero, eget lacinia justo purus nec est. In at sodales ipsum. Sed lacinia quis purus eget pulvinar. Aenean eu pretium nunc, at aliquam magna. Praesent dignissim, tortor sed volutpat mattis, mauris diam pulvinar leo, porta commodo risus est non purus. Mauris in justo vel lorem ullamcorper hendrerit. Nam est metus, viverra a pellentesque vitae, ornare eget odio. Morbi tempor feugiat mattis. Morbi non felis tempor, aliquam justo sed, sagittis nibh. Mauris consequat ex metus. Praesent sodales sit amet nibh a vulputate. Integer commodo, mi vel bibendum sollicitudin, urna lectus accumsan ante, eget faucibus augue ex id neque. Aenean consectetur, orci a pellentesque mattis, tortor tellus fringilla elit, non ullamcorper risus nunc feugiat risus. Fusce sit amet nisi dapibus turpis commodo placerat. In tortor ante, vehicula sit amet augue et, imperdiet porta sem.',
// actions: [<UserCard.Action icon='message'/>, <UserCard.Action icon='phone'/>],
utcOffset: -3,
email: 'rocketchat@rocket.chat',
status: <Status.Offline />,
nickname: 'Nickname',
const Template: StoryFn<typeof UserInfo> = (args) => <UserInfo {...defaultArgs} {...args} />;

export const Default = Template.bind({});

export const WithABACAttributes = Template.bind({});
WithABACAttributes.args = {
// @ts-expect-error - abacAttributes is not yet implemented in Users properties
abacAttributes: ['Classified', 'Top Secret', 'Confidential'],
};
17 changes: 14 additions & 3 deletions apps/meteor/client/components/UserInfo/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import MarkdownText from '../MarkdownText';
import UTCClock from '../UTCClock';
import { UserCardRoles } from '../UserCard';
import UserInfoABACAttributes from './UserInfoABACAttributes';
import UserInfoAvatar from './UserInfoAvatar';

type UserInfoDataProps = Serialized<
Expand Down Expand Up @@ -70,6 +71,8 @@ const UserInfo = ({
canViewAllInfo,
actions,
reason,
// @ts-expect-error - abacAttributes is not yet implemented in Users properties
abacAttributes = null,
...props
}: UserInfoProps): ReactElement => {
const { t } = useTranslation();
Expand Down Expand Up @@ -113,7 +116,7 @@ const UserInfo = ({
</InfoPanelField>
)}

{roles.length !== 0 && (
{roles?.length !== 0 && (
<InfoPanelField>
<InfoPanelLabel>{t('Roles')}</InfoPanelLabel>
<UserCardRoles>{roles}</UserCardRoles>
Expand All @@ -127,10 +130,12 @@ const UserInfo = ({
</InfoPanelField>
)}

{Number.isInteger(utcOffset) && (
{utcOffset && Number.isInteger(utcOffset) && (
<InfoPanelField>
<InfoPanelLabel>{t('Local_Time')}</InfoPanelLabel>
<InfoPanelText>{utcOffset && <UTCClock utcOffset={utcOffset} />}</InfoPanelText>
<InfoPanelText>
<UTCClock utcOffset={utcOffset} />
</InfoPanelText>
</InfoPanelField>
)}

Expand Down Expand Up @@ -175,6 +180,12 @@ const UserInfo = ({
</InfoPanelField>
)}

{abacAttributes?.length > 0 && (
<InfoPanelField>
<InfoPanelLabel title={t('ABAC_Attributes_description')}>{t('ABAC_Attributes')}</InfoPanelLabel>
<UserInfoABACAttributes abacAttributes={abacAttributes} />
</InfoPanelField>
)}
{userCustomFields?.map(
(customField) =>
customField?.value && (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Tag } from '@rocket.chat/fuselage';

type UserInfoABACAttributeProps = {
attribute: string;
};

const UserInfoABACAttribute = ({ attribute }: UserInfoABACAttributeProps) => {
return <Tag variant='secondary-warning' children={attribute} />;
};

export default UserInfoABACAttribute;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Box, Margins } from '@rocket.chat/fuselage';

import UserInfoABACAttribute from './UserInfoABACAttribute';

type UserInfoABACAttributesProps = {
abacAttributes: string[];
};

const UserInfoABACAttributes = ({ abacAttributes }: UserInfoABACAttributesProps) => {
return (
<Box m='neg-x2'>
<Box flexWrap='wrap' display='flex' flexShrink={0} mb={8}>
{abacAttributes.map((attribute, index) => (
<Margins inline={2} blockEnd={4} key={`${attribute}-${index}`}>
<UserInfoABACAttribute attribute={attribute} />
</Margins>
))}
</Box>
</Box>
);
};

export default UserInfoABACAttributes;
Loading