Skip to content

Commit

Permalink
Merge branch 'develop' into fix/unit-dep-removal-consitency
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Dec 11, 2024
2 parents 19df4e7 + e39db8d commit 97e3508
Show file tree
Hide file tree
Showing 39 changed files with 777 additions and 139 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/four-cows-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes an issue where room members menu doesn't display properly without enough space
5 changes: 5 additions & 0 deletions .changeset/green-queens-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes an issue with Federation startup where the bridge would intermittently fail to start causing error being shown "Matrix Bridge isn't running yet".
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/six-snails-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes a behavior of the mentions parser that identified mentions inside markdown links text. Now, these components will be removed from the text before trying to parse mentions.
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
10 changes: 8 additions & 2 deletions apps/meteor/app/mentions/lib/MentionsParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,17 @@ export class MentionsParser {
return this.roomTemplate({ prefix, reference, channel, mention });
});

getUserMentions(str: string) {
getUserMentions(msg: string) {
// First remove the text inside md links
const str = msg.replace(/\[[^\]]*\]\([^)]+\)/g, '');
// Then do the match
return (str.match(this.userMentionRegex) || []).map((match) => match.trim());
}

getChannelMentions(str: string) {
getChannelMentions(msg: string) {
// First remove the text inside md links
const str = msg.replace(/\[[^\]]*\]\([^)]+\)/g, '');
// Then do the match
return (str.match(this.channelMentionRegex) || []).map((match) => match.trim());
}

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
44 changes: 24 additions & 20 deletions apps/meteor/client/views/oauth/components/CurrentUserDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { IUser } from '@rocket.chat/core-typings';
import { css } from '@rocket.chat/css-in-js';
import { UserStatus } from '@rocket.chat/ui-client';
import { useRolesDescription, useSetting } from '@rocket.chat/ui-contexts';
import React from 'react';
import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next';

import LocalTime from '../../../components/LocalTime';
Expand All @@ -26,29 +26,33 @@ const CurrentUserDisplay = ({ user }: CurrentUserDisplayProps) => {
const getRoles = useRolesDescription();

const { t } = useTranslation();
const { username, avatarETag, name, statusText, nickname, roles, utcOffset, bio } = user;

const data = useMemo(
() => ({
username,
etag: avatarETag,
name: showRealNames ? name : username,
nickname,
status: <UserStatus.Online />,
customStatus: statusText ?? <></>,
roles: roles && getRoles(roles).map((role, index) => <UserCardRole key={index}>{role}</UserCardRole>),
localTime: utcOffset && Number.isInteger(utcOffset) && <LocalTime utcOffset={utcOffset} />,
bio: bio ? (
<UserCardInfo withTruncatedText={false} className={clampStyle} height='x60'>
{typeof bio === 'string' ? <MarkdownText variant='inline' content={bio} /> : bio}
</UserCardInfo>
) : (
<></>
),
}),
[avatarETag, bio, getRoles, name, nickname, roles, showRealNames, statusText, username, utcOffset],
);

return (
<>
<p>{t('core.You_are_logged_in_as')}</p>
<UserCard
username={user.username}
etag={user.avatarETag}
name={showRealNames ? user.name : user.username}
nickname={user.nickname}
status={<UserStatus.Online />}
customStatus={user.statusText ?? <></>}
roles={user.roles && getRoles(user.roles).map((role, index) => <UserCardRole key={index}>{role}</UserCardRole>)}
localTime={user.utcOffset && Number.isInteger(user.utcOffset) && <LocalTime utcOffset={user.utcOffset} />}
bio={
user.bio ? (
<UserCardInfo withTruncatedText={false} className={clampStyle} height='x60'>
{typeof user.bio === 'string' ? <MarkdownText variant='inline' content={user.bio} /> : user.bio}
</UserCardInfo>
) : (
<></>
)
}
/>
<UserCard user={data} />
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type AnnouncementComponenttParams = {
};

const AnnouncementComponent: FC<AnnouncementComponenttParams> = ({ children, onClickOpen }) => (
<RoomBanner className='rcx-header-section' onClick={onClickOpen}>
<RoomBanner className='rcx-header-section rcx-announcement-section' onClick={onClickOpen}>
<RoomBannerContent data-qa='AnnouncementAnnoucementComponent'>{children}</RoomBannerContent>
</RoomBanner>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const UserCardWithData = ({ username, rid, onOpenUserInfo, onClose }: UserCardWi
return <UserCardSkeleton />;
}

return <UserCard {...user} onClose={onClose} onOpenUserInfo={handleOpenUserInfo} actions={actions} />;
return <UserCard user={user} onClose={onClose} onOpenUserInfo={handleOpenUserInfo} actions={actions} />;
};

export default UserCardWithData;
2 changes: 1 addition & 1 deletion apps/meteor/client/views/room/body/RoomTopic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const RoomTopic = ({ room, user }: RoomTopicProps) => {
if (!topic && !roomLeader) return null;

return (
<RoomBanner className='rcx-header-section' role='note'>
<RoomBanner className='rcx-header-section rcx-topic-section' role='note'>
<RoomBannerContent>
{roomLeader && !topic && canEdit ? (
<Box is='a' href={href}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const RoomMembersActions = ({ username, _id, name, rid, freeSwitchExtension, rel
if (!menuOptions) {
return null;
}
return <GenericMenu title={t('More')} key='menu' data-qa-id='UserUserInfo-menu' sections={menuOptions} placement='bottom-end' />;
return <GenericMenu detached title={t('More')} key='menu' data-qa-id='UserUserInfo-menu' sections={menuOptions} placement='bottom-end' />;
};

export default RoomMembersActions;
6 changes: 3 additions & 3 deletions apps/meteor/ee/server/local-services/federation/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ abstract class AbstractBaseFederationServiceEE extends AbstractFederationService
await super.cleanUpHandlers();
}

public async created(): Promise<void> {
public async started(): Promise<void> {
await super.setupFederation();
await this.startFederation();
}
Expand Down Expand Up @@ -213,8 +213,8 @@ export class FederationServiceEE extends AbstractBaseFederationServiceEE impleme
return federationService;
}

async created(): Promise<void> {
return super.created();
async started(): Promise<void> {
return super.started();
}

async stopped(): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export class RocketChatSettingsAdapter {
'sender_localpart': registrationFile.botName,
'namespaces': registrationFile.listenTo,
'de.sorunome.msc2409.push_ephemeral': registrationFile.enableEphemeralEvents,
'use_appservice_legacy_authorization': true,
}),
);
}
Expand Down
Loading

0 comments on commit 97e3508

Please sign in to comment.