Skip to content

Commit

Permalink
Merge branch 'develop' into fix/mentions-inside-mdlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Dec 9, 2024
2 parents f4a8396 + c2cf2d7 commit 1cc9cb0
Show file tree
Hide file tree
Showing 43 changed files with 666 additions and 392 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-pants-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Removes a validation that allowed only the room creator to propagate E2EE room keys. This was causing issues when the rooms were created via apps or some other integration, as the creator may not be online or able to create E2EE keys
5 changes: 5 additions & 0 deletions .changeset/green-shirts-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes condition causing Omnichannel queue to start more than once.
5 changes: 5 additions & 0 deletions .changeset/proud-cups-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes `im.counters` endpoint returning `null` on `unread` messages property for users that have never opened the queried DM
5 changes: 5 additions & 0 deletions .changeset/real-crabs-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': minor
---

Organizes App Settings interface by introducing section-based accordion groups to improve navigation and readability for administrators.
4 changes: 2 additions & 2 deletions apps/meteor/app/api/server/v1/im.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ API.v1.addRoute(

lm = room?.lm ? new Date(room.lm).toISOString() : new Date(room._updatedAt).toISOString(); // lm is the last message timestamp

if (subscription?.open) {
if (subscription) {
unreads = subscription.unread ?? null;
if (subscription.ls && room.msgs) {
unreads = subscription.unread;
unreadsFrom = new Date(subscription.ls).toISOString(); // last read timestamp
}
userMentions = subscription.userMentions;
Expand Down
12 changes: 1 addition & 11 deletions apps/meteor/app/e2e/client/rocketchat.e2e.room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ export class E2ERoom extends Emitter {

try {
const room = Rooms.findOne({ _id: this.roomId })!;

Check warning on line 328 in apps/meteor/app/e2e/client/rocketchat.e2e.room.ts

View workflow job for this annotation

GitHub Actions / 🔎 Code Check / Code Lint

Forbidden non-null assertion
// Only room creator can set keys for room
if (!room.e2eKeyId && this.userShouldCreateKeys(room)) {
if (!room.e2eKeyId) {
this.setState(E2ERoomState.CREATING_KEYS);
await this.createGroupKey();
this.setState(E2ERoomState.READY);
Expand All @@ -343,15 +342,6 @@ export class E2ERoom extends Emitter {
}
}

userShouldCreateKeys(room: any) {
// On DMs, we'll allow any user to set the keys
if (room.t === 'd') {
return true;
}

return room.u._id === this.userId;
}

isSupportedRoomType(type: any) {
return roomCoordinator.getRoomDirectives(type).allowRoomSettingChange({}, RoomSettingsEnum.E2E);
}
Expand Down
48 changes: 0 additions & 48 deletions apps/meteor/app/message-mark-as-unread/client/actionButton.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/meteor/app/message-mark-as-unread/client/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion apps/meteor/app/reactions/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
import './init';
import './methods/setReaction';
43 changes: 0 additions & 43 deletions apps/meteor/app/reactions/client/init.ts

This file was deleted.

26 changes: 0 additions & 26 deletions apps/meteor/app/ui-utils/client/lib/messageActionDefault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,32 +118,6 @@ Meteor.startup(async () => {
group: 'message',
});

MessageAction.addButton({
id: 'permalink',
icon: 'permalink',
label: 'Copy_link',
// classes: 'clipboard',
context: ['message', 'message-mobile', 'threads', 'federated', 'videoconf', 'videoconf-threads'],
type: 'duplication',
async action(_, { message }) {
try {
const permalink = await getPermaLink(message._id);
await navigator.clipboard.writeText(permalink);
dispatchToastMessage({ type: 'success', message: t('Copied') });
} catch (e) {
dispatchToastMessage({ type: 'error', message: e });
}
},
condition({ subscription }) {
return !!subscription;
},
order: 5,
group: 'menu',
disabled({ message }) {
return isE2EEMessage(message);
},
});

MessageAction.addButton({
id: 'copy',
icon: 'copy',
Expand Down
69 changes: 47 additions & 22 deletions apps/meteor/client/components/UserCard/UserCard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,34 @@ import React from 'react';

import { UserCard, UserCardRole, UserCardAction } from '.';

const user = {
name: 'guilherme.gazzo',
customStatus: '🛴 currently working on User Card',
roles: (
<>
<UserCardRole>Admin</UserCardRole>
<UserCardRole>Rocket.Chat</UserCardRole>
<UserCardRole>Team</UserCardRole>
</>
),
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.',
localTime: 'Local Time: 7:44 AM',
};

export default {
title: 'Components/UserCard',
component: UserCard,
parameters: {
layout: 'centered',
},
args: {
name: 'guilherme.gazzo',
customStatus: '🛴 currently working on User Card',
roles: (
<>
<UserCardRole>Admin</UserCardRole>
<UserCardRole>Rocket.Chat</UserCardRole>
<UserCardRole>Team</UserCardRole>
</>
),
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.',
user,
actions: (
<>
<UserCardAction icon='message' />
<UserCardAction icon='phone' />
</>
),
localTime: 'Local Time: 7:44 AM',
},
} satisfies Meta<typeof UserCard>;

Expand All @@ -36,18 +40,27 @@ export const Example = Template.bind({});

export const Nickname = Template.bind({});
Nickname.args = {
nickname: 'nicknamenickname',
user: {
...user,
nickname: 'nicknamenickname',
},
} as any;

export const LargeName = Template.bind({});
LargeName.args = {
customStatus: '🛴 currently working on User Card on User Card on User Card on User Card on User Card ',
name: 'guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.',
user: {
...user,
customStatus: '🛴 currently working on User Card on User Card on User Card on User Card on User Card ',
name: 'guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.guilherme.gazzo.',
},
} as any;

export const NoRoles = Template.bind({});
NoRoles.args = {
roles: undefined,
user: {
...user,
roles: undefined,
},
} as any;

export const NoActions = Template.bind({});
Expand All @@ -57,25 +70,37 @@ NoActions.args = {

export const NoLocalTime = Template.bind({});
NoLocalTime.args = {
localTime: undefined,
user: {
...user,
localTime: undefined,
},
} as any;

export const NoBio = Template.bind({});
NoBio.args = {
bio: undefined,
user: {
...user,
bio: undefined,
},
} as any;

export const NoBioAndNoLocalTime = Template.bind({});
NoBioAndNoLocalTime.args = {
bio: undefined,
localTime: undefined,
user: {
...user,
bio: undefined,
localTime: undefined,
},
} as any;

export const NoBioNoLocalTimeNoRoles = Template.bind({});
NoBioNoLocalTimeNoRoles.args = {
bio: undefined,
localTime: undefined,
roles: undefined,
user: {
...user,
bio: undefined,
localTime: undefined,
roles: undefined,
},
} as any;

export const Loading = () => <UserCard />;
34 changes: 14 additions & 20 deletions apps/meteor/client/components/UserCard/UserCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,27 @@ const clampStyle = css`
`;

type UserCardProps = {
onOpenUserInfo?: () => void;
name?: string;
username?: string;
etag?: string;
customStatus?: ReactNode;
roles?: ReactNode;
bio?: ReactNode;
status?: ReactNode;
user?: {
nickname?: string;
name?: string;
username?: string;
etag?: string;
customStatus?: ReactNode;
roles?: ReactNode;
bio?: ReactNode;
status?: ReactNode;
localTime?: ReactNode;
};
actions?: ReactNode;
localTime?: ReactNode;
onOpenUserInfo?: () => void;
onClose?: () => void;
nickname?: string;
} & ComponentProps<typeof UserCardDialog>;

const UserCard = ({
onOpenUserInfo,
name,
username,
etag,
customStatus,
roles,
bio,
status = <Status.Offline />,
user: { name, username, etag, customStatus, roles, bio, status = <Status.Offline />, localTime, nickname } = {},
actions,
localTime,
onOpenUserInfo,
onClose,
nickname,
...props
}: UserCardProps) => {
const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { IMessage, ISubscription } from '@rocket.chat/core-typings';
import { useToastMessageDispatch } from '@rocket.chat/ui-contexts';
import { useMutation } from '@tanstack/react-query';

import { LegacyRoomManager } from '../../../../app/ui-utils/client';
import { sdk } from '../../../../app/utils/client/lib/SDKClient';

export const useMarkAsUnreadMutation = () => {
const dispatchToastMessage = useToastMessageDispatch();

return useMutation({
mutationFn: async ({ message, subscription }: { message: IMessage; subscription: ISubscription }) => {
await LegacyRoomManager.close(subscription.t + subscription.name);
await sdk.call('unreadMessages', message);
},
onError: (error) => {
dispatchToastMessage({ type: 'error', message: error });
},
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ export const usePinMessageMutation = () => {
onSuccess: () => {
dispatchToastMessage({ type: 'success', message: t('Message_has_been_pinned') });
},
onError: (error) => {
onError: (error, message) => {
dispatchToastMessage({ type: 'error', message: error });
updatePinMessage(message, { pinned: false });
},
onSettled: (_data, _error, message) => {
queryClient.invalidateQueries(roomsQueryKeys.pinnedMessages(message.rid));
Expand Down
Loading

0 comments on commit 1cc9cb0

Please sign in to comment.