Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 5.3.0 #27159

Merged
merged 54 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
d248048
Chore: Bump Apps-Engine version (#27059)
d-gubert Oct 13, 2022
eaf6c42
Merge remote-tracking branch 'origin/master' into develop-sync
tassoevan Oct 14, 2022
881e08d
Bump version to 5.3.0-develop
tassoevan Oct 14, 2022
31ee000
Merge pull request #27067 from RocketChat/develop-sync
sampaiodiego Oct 14, 2022
ac5ae66
[IMPROVE] Change status/price badge to fuselage tag (#27044)
rique223 Oct 14, 2022
f4f8cd1
Chore: Implement short description for marketplace apps (#27030)
rique223 Oct 14, 2022
c2e93cc
[FIX] Switch deprecated fields for projection (#27025)
tiagoevanp Oct 14, 2022
9d42405
[IMPROVE] Respect convert ascii to emoji preference for new message t…
yash-rajpal Oct 14, 2022
3244070
[FIX] On hold reactivity for Omnichannel rooms (#27013)
tiagoevanp Oct 14, 2022
11b1588
[FIX] Email inbox memory leak on connection failure (#26850)
cauefcr Oct 14, 2022
1866dfc
Update and rename apps/meteor/app.json to app.json
engelgabriel Oct 14, 2022
9f26e96
i18n: Language update from LingoHub 🤖 on 2022-10-03Z (#26992)
lingohub[bot] Oct 14, 2022
ab7d97f
Chore: remove excess space from html preview (#27043)
yash-rajpal Oct 14, 2022
9956a84
Chore: Remove default value from custom home content setting (#26995)
gabriellsh Oct 15, 2022
b2a3408
[FIX] Remove voip extension when agent is removed or deactivated (#26…
KevLehman Oct 15, 2022
de1eed7
Chore: Refactor AppLogs to TS (#26938)
rique223 Oct 15, 2022
ded6352
[IMPROVE] Automatically open call info contextual bar when voip room …
aleksandernsilva Oct 17, 2022
e28228d
i18n: Language update from LingoHub 🤖 on 2022-10-17Z (#27082)
lingohub[bot] Oct 17, 2022
dd10fc3
[FIX] Remove contact mananger always to support old servers (#27053)
KevLehman Oct 17, 2022
38b3749
i18n: Language update from LingoHub 🤖 on 2022-10-10Z (#27035)
lingohub[bot] Oct 17, 2022
127d118
[FIX] Actionable messages are now sent to integrations webhook (#27052)
cauefcr Oct 17, 2022
c8f61e5
Chore: Use a single notification listener for all videoconf messages …
pierre-lehnen-rc Oct 17, 2022
6e85e85
[FIX] Warning about livechat/inquiries.queuedForUser (#27086)
MartinSchoeler Oct 17, 2022
cac9f97
Chore: UserCard loader tweaks (#27068)
dougfabris Oct 17, 2022
96ed9a5
[FIX] check if message block has item to show message body (#27040)
Oct 18, 2022
0c811f6
[FIX] Uncaught error by listening stream-notify-room without subscrip…
tiagoevanp Oct 18, 2022
f707ba2
Chore: Email Inbox Sanitization (#26796)
dougfabris Oct 18, 2022
1f0c863
[NEW] Health check for data stream (#27026)
sampaiodiego Oct 18, 2022
f3be7be
[FIX] Preview message not showing when reply direct message (#27050)
Oct 18, 2022
cb2d219
Chore: Remove Unused CSS (#27012)
MartinSchoeler Oct 18, 2022
348aca1
Chore: Tests for EE dashboards (#26974)
KevLehman Oct 18, 2022
4cd1280
Chore: Apply correct fuselage color tokens (#27089)
ggazzo Oct 18, 2022
5f5730c
[IMPROVE] Better /health response when service not healthy (#27091)
sampaiodiego Oct 18, 2022
86ffdca
[NEW] Add new endpoint 'livechat/room.saveInfo' & deprecate 'livechat…
murtaza98 Oct 18, 2022
f6bea29
[FIX] Livechat CurrentChats infinity re-rendering (#27076)
tiagoevanp Oct 18, 2022
9349fea
Bump version to 5.3.0-rc.0
ggazzo Oct 19, 2022
ed5aa1c
Chore: Update Image and link previews (#27019)
Oct 19, 2022
78e3ef1
Regression: Remove margin-bottom inside UserCard actions (#27100)
dougfabris Oct 19, 2022
7e43859
[FIX] CSS vars usage (#27107)
ggazzo Oct 20, 2022
3274db9
Merge remote-tracking branch 'origin/develop' into release-candidate
ggazzo Oct 20, 2022
5919340
Bump version to 5.3.0-rc.1
ggazzo Oct 20, 2022
d0c5d01
Regression: Toolbox Divider Color (#27116)
dougfabris Oct 20, 2022
a79fadc
Regression: Quote colors (#27110)
gabriellsh Oct 20, 2022
5c87587
[NEW] Matrix federation events coverage expansion (adding support for…
MarcosSpessatto Oct 20, 2022
c25358b
Merge remote-tracking branch 'origin/develop' into release-candidate
ggazzo Oct 20, 2022
34ca34f
Bump version to 5.3.0-rc.2
ggazzo Oct 20, 2022
0c6871e
[FIX] starting conferences with mic and cam on their default states d…
dougfabris Oct 21, 2022
205a64c
Regression: Unify isLastDocDelayed logic (#27120)
sampaiodiego Oct 21, 2022
bd55470
[FIX] Microphone icon alignment issue (# 27073) (#27123)
mani-rsg Oct 31, 2022
befcec9
Chore: bump fuselage packages (#27122)
dougfabris Oct 31, 2022
f457469
Chore: bump fuselage packages (#27157)
dougfabris Oct 31, 2022
deca863
Merge remote-tracking branch 'origin/develop' into release-candidate
ggazzo Nov 1, 2022
6283b6b
Bump version to 5.3.0-rc.3
ggazzo Nov 1, 2022
8ce0098
Bump version to 5.3.0
ggazzo Nov 1, 2022
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
523 changes: 523 additions & 0 deletions .github/history.json

Large diffs are not rendered by default.

228 changes: 227 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,230 @@

# 5.3.0
`2022-10-31 · 3 🎉 · 4 🚀 · 13 🐛 · 23 🔍 · 23 👩‍💻👨‍💻`

### Engine versions
- Node: `14.19.3`
- NPM: `6.14.17`
- MongoDB: `4.2, 4.4, 5.0`

### 🎉 New features


- Add new endpoint 'livechat/room.saveInfo' & deprecate 'livechat:saveInfo' meteor method ([#26789](https://github.com/RocketChat/Rocket.Chat/pull/26789))

- Health check for data stream ([#27026](https://github.com/RocketChat/Rocket.Chat/pull/27026))

- Matrix federation events coverage expansion (adding support for 3 extra events) ([#26859](https://github.com/RocketChat/Rocket.Chat/pull/26859))

FED-17
FED-25
FED-27
FED-28
FED-30
The goal of this PR is to add support for more events on Matrix Federation feature. The new supported events are:

- Mentions
- User avatar sync
- Quotes

### 🚀 Improvements


- Automatically open call info contextual bar when voip room is opened ([#26963](https://github.com/RocketChat/Rocket.Chat/pull/26963))

This pull request adds the logic necessary to automatically open the call information contextual bar when entering a voip room. This mirrors the behavior we already have for livechat rooms.

**Before:**
![before-voip-480p-speed](https://user-images.githubusercontent.com/6494543/192610275-a81ab19e-2b60-4466-9e04-81b2e938afda.gif)

**After:**
![after-voip-480p-speed](https://user-images.githubusercontent.com/6494543/192610356-896ccd48-8c26-4fb9-8fb4-f792ab63e6d5.gif)

- Better /health response when service not healthy ([#27091](https://github.com/RocketChat/Rocket.Chat/pull/27091))

Not healthy services will send a HTTP 500 response when not healthy.

- Change status/price badge to fuselage tag ([#27044](https://github.com/RocketChat/Rocket.Chat/pull/27044))

## Jira task: [MKP-131](https://rocketchat.atlassian.net/browse/MKP-131?atlOrigin=eyJpIjoiODRjOTk4OGYyZDAwNDIzNmI5N2EyZGRhNTUxOGY2NGEiLCJwIjoiaiJ9)
Changed the custom component that showed prices and statuses to a fuselage Tag component for maintainability reasons since after this PR every general design change to the tag component will be automatically reflected in the marketplace UI.
Demo image (App List):
![image](https://user-images.githubusercontent.com/43561537/194942430-ba4153f1-2315-4117-85e6-01832cc09d91.png)

Demo Image (App price):
![image](https://user-images.githubusercontent.com/43561537/194942498-5ff64a27-7232-47b8-a686-2fda2289e491.png)

- Respect convert ascii to emoji preference for new message template ([#27038](https://github.com/RocketChat/Rocket.Chat/pull/27038))

### 🐛 Bug fixes


- Actionable messages are now sent to integrations webhook ([#27052](https://github.com/RocketChat/Rocket.Chat/pull/27052))

Actionable messages, with buttons and similar, (saved as blocks internally) were not being sent to external integrations, so CRMs and the like had no visibility on what was the actionable message sent, this PR adds a yaml version of the actions, as well as a proper json object with the same data on the webhook output, so that our clients can have more visibility in their process

- check if message block has item to show message body ([#27040](https://github.com/RocketChat/Rocket.Chat/pull/27040))

- CSS vars usage ([#27107](https://github.com/RocketChat/Rocket.Chat/pull/27107))

- Email inbox memory leak on connection failure ([#26850](https://github.com/RocketChat/Rocket.Chat/pull/26850))

- Properly removing event listeners on re-connection.
- Attachments handling changed from beforeMessageSent to afterMessageSent, as the id of the message was needed, now rocket.cat will send the "Send Attachment To Email" button.
- Self-disable email inbox when reaching max re-connection attempts

- Livechat CurrentChats infinity re-rendering ([#27076](https://github.com/RocketChat/Rocket.Chat/pull/27076))

- Microphone icon alignment issue (# 27073) ([#27123](https://github.com/RocketChat/Rocket.Chat/pull/27123) by [@mani-rsg](https://github.com/mani-rsg))

Aligned microphone icon to its respective position on screen widths <= 500 (mobile screens)

<img width="360" alt="image" src="https://user-images.githubusercontent.com/72298612/197343254-1506125f-06f4-43d1-b42b-e36071862254.png">
<img width="439" alt="image" src="https://user-images.githubusercontent.com/72298612/197343268-d7f0e294-4b76-4e5b-9874-0b41586b0487.png">

- On hold reactivity for Omnichannel rooms ([#27013](https://github.com/RocketChat/Rocket.Chat/pull/27013))

- Fix instabilities from room when changed from on-hold to resume
- Fix gray messages when resume from on-hold

- Preview message not showing when reply direct message ([#27050](https://github.com/RocketChat/Rocket.Chat/pull/27050))

- Remove contact mananger always to support old servers ([#27053](https://github.com/RocketChat/Rocket.Chat/pull/27053))

- Remove voip extension when agent is removed or deactivated ([#26960](https://github.com/RocketChat/Rocket.Chat/pull/26960))

- starting conferences with mic and cam on their default states do not sync the state with the provider ([#26966](https://github.com/RocketChat/Rocket.Chat/pull/26966))

Task: [VC-3]

- Uncaught error by listening stream-notify-room without subscription ([#27020](https://github.com/RocketChat/Rocket.Chat/pull/27020))

fix this:
<img width="458" alt="image" src="https://user-images.githubusercontent.com/17487063/194358060-7d0fb534-9d04-4af8-abd9-fa2bd79b66c0.png">

- Warning about livechat/inquiries.queuedForUser ([#27086](https://github.com/RocketChat/Rocket.Chat/pull/27086))

<details>
<summary>🔍 Minor changes</summary>


- Chore: Apply correct fuselage color tokens ([#27089](https://github.com/RocketChat/Rocket.Chat/pull/27089))

- Chore: Bump Apps-Engine version ([#27059](https://github.com/RocketChat/Rocket.Chat/pull/27059))

- Chore: bump fuselage packages ([#27157](https://github.com/RocketChat/Rocket.Chat/pull/27157))

- Chore: bump fuselage packages ([#27122](https://github.com/RocketChat/Rocket.Chat/pull/27122))

- Chore: Email Inbox Sanitization ([#26796](https://github.com/RocketChat/Rocket.Chat/pull/26796))

Jira Issue [UFR-3]

- Rewrite Email Inbox to typescript
- Replace `useForm`
- Fix: return an error if there are no email inboxes in `email-inbox` endpoint
**documentation update**: https://github.com/RocketChat/developer-docs/pull/132
- Add e2e test cases for creating email inboxes and deleting email inboxes

- Chore: Implement short description for marketplace apps ([#27030](https://github.com/RocketChat/Rocket.Chat/pull/27030))

## Jira task: [MKP-126](https://rocketchat.atlassian.net/browse/MKP-126)
Implemented the shortDescription field in the marketplace app details header. Now apps have either a shorter description or nothing, in case it doesn't have a shortDescription registered, in their headers description section.
Demo image:
![image](https://user-images.githubusercontent.com/43561537/194640492-9942f6d9-66ad-4df9-97e8-98c7d51a724c.png)

- Chore: Refactor AppLogs to TS ([#26938](https://github.com/RocketChat/Rocket.Chat/pull/26938))

Rewrote the AppLogs component to TS. Also, improved some error handling logic.

- Chore: Remove default value from custom home content setting ([#26995](https://github.com/RocketChat/Rocket.Chat/pull/26995))

Remove content from `Custom body` setting so that new workspaces don't have initial unstyled HTML in their homepages.

- Chore: remove excess space from html preview ([#27043](https://github.com/RocketChat/Rocket.Chat/pull/27043))

- Chore: Remove Unused CSS ([#27012](https://github.com/RocketChat/Rocket.Chat/pull/27012))

- Chore: Switch deprecated fields for projection ([#27025](https://github.com/RocketChat/Rocket.Chat/pull/27025))

- Chore: Tests for EE dashboards ([#26974](https://github.com/RocketChat/Rocket.Chat/pull/26974))

- Chore: Update Image and link previews ([#27019](https://github.com/RocketChat/Rocket.Chat/pull/27019))

- Add message generic cover image preview component to OEmbed Links
- Add new functionalities to URL Image preview, like click to open preview and arrows to move between images in the current chat
- Design changes to keep the original aspect ratio of the image to prevent loss of important image pieces of information
- Add fallback to common issues related to meta tags like `og:image` and others

- Chore: Use a single notification listener for all videoconf messages ([#26682](https://github.com/RocketChat/Rocket.Chat/pull/26682))

Task: [VC-1]

- Chore: UserCard loader tweaks ([#27068](https://github.com/RocketChat/Rocket.Chat/pull/27068))

### before
![Kapture 2022-10-14 at 12 47 43](https://user-images.githubusercontent.com/27704687/195888045-6fd900ab-feb1-4dc7-924c-a0fd7634eab6.gif)


### after
![Kapture 2022-10-14 at 12 45 30](https://user-images.githubusercontent.com/27704687/195887641-652f388b-cf9f-413d-9c07-c0df9a3f7287.gif)

- i18n: Language update from LingoHub 🤖 on 2022-10-03Z ([#26992](https://github.com/RocketChat/Rocket.Chat/pull/26992))

- i18n: Language update from LingoHub 🤖 on 2022-10-10Z ([#27035](https://github.com/RocketChat/Rocket.Chat/pull/27035))

- i18n: Language update from LingoHub 🤖 on 2022-10-17Z ([#27082](https://github.com/RocketChat/Rocket.Chat/pull/27082))

- Merge master into develop & Set version to 5.3.0-develop ([#27067](https://github.com/RocketChat/Rocket.Chat/pull/27067))

- Regression: Quote colors ([#27110](https://github.com/RocketChat/Rocket.Chat/pull/27110))

Before
![image](https://user-images.githubusercontent.com/40830821/196947705-f1b2edf9-7341-4d2a-b8e8-4e3720ab7289.png)


After
![image](https://user-images.githubusercontent.com/40830821/196947512-1267f992-11c7-4ff4-b7a2-9f0b3534f69d.png)

- Regression: Remove margin-bottom inside UserCard actions ([#27100](https://github.com/RocketChat/Rocket.Chat/pull/27100))

- Regression: Toolbox Divider Color ([#27116](https://github.com/RocketChat/Rocket.Chat/pull/27116))

![image](https://user-images.githubusercontent.com/27704687/197018407-d591d6bc-e390-4bcd-9b6a-0bf0a1420bc2.png)

- Regression: Unify `isLastDocDelayed` logic ([#27120](https://github.com/RocketChat/Rocket.Chat/pull/27120))

</details>

### 👩‍💻👨‍💻 Contributors 😍

- [@mani-rsg](https://github.com/mani-rsg)

### 👩‍💻👨‍💻 Core Team 🤓

- [@KevLehman](https://github.com/KevLehman)
- [@MarcosSpessatto](https://github.com/MarcosSpessatto)
- [@MartinSchoeler](https://github.com/MartinSchoeler)
- [@aleksandernsilva](https://github.com/aleksandernsilva)
- [@casalsgh](https://github.com/casalsgh)
- [@cauefcr](https://github.com/cauefcr)
- [@d-gubert](https://github.com/d-gubert)
- [@debdutdeb](https://github.com/debdutdeb)
- [@dougfabris](https://github.com/dougfabris)
- [@filipemarins](https://github.com/filipemarins)
- [@gabriellsh](https://github.com/gabriellsh)
- [@ggazzo](https://github.com/ggazzo)
- [@guijun13](https://github.com/guijun13)
- [@hugocostadev](https://github.com/hugocostadev)
- [@juliajforesti](https://github.com/juliajforesti)
- [@murtaza98](https://github.com/murtaza98)
- [@pierre-lehnen-rc](https://github.com/pierre-lehnen-rc)
- [@rique223](https://github.com/rique223)
- [@sampaiodiego](https://github.com/sampaiodiego)
- [@tassoevan](https://github.com/tassoevan)
- [@tiagoevanp](https://github.com/tiagoevanp)
- [@yash-rajpal](https://github.com/yash-rajpal)

# 5.2.0
`2022-10-13 · 5 🎉 · 13 🚀 · 19 🐛 · 62 🔍 · 28 👩‍💻👨‍💻`

Expand Down Expand Up @@ -10429,7 +10655,7 @@
- [@ggazzo](https://github.com/ggazzo)

# 3.18.6
`2022-05-26 · 1 🐛 · 1 👩‍💻👨‍💻`
`2022-05-20 · 1 🐛 · 1 👩‍💻👨‍💻`

### Engine versions
- MongoDB: `3.4, 3.6, 4.0, 4.2`
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/app.json → app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"name": "Rocket.Chat",
"description": "Have your own open-source Slack-like online chat platform.",
"repository": "https://github.com/RocketChat/Rocket.Chat",
"logo": "https://raw.githubusercontent.com/RocketChat/Rocket.Chat/master/public/images/logo/1024x1024.png",
"logo": "https://raw.githubusercontent.com/RocketChat/Rocket.Chat.Artwork/master/Logos/2020/png/logo-horizontal-red.png",
"keywords": ["meteor", "social", "community", "chat"],
"website": "https://rocket.chat",
"env": {
"BUILDPACK_URL": "https://github.com/RocketChat/meteor-buildpack-horse.git",
"METEOR_APP_DIR": "apps/meteor/",
"HEROKU_APP_NAME": {
"description": "Please re-enter your App Name from the top.",
"required": true
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/.docker/Dockerfile.rhel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM registry.access.redhat.com/ubi8/nodejs-12

ENV RC_VERSION 5.2.0
ENV RC_VERSION 5.3.0

MAINTAINER buildmaster@rocket.chat

Expand Down
14 changes: 9 additions & 5 deletions apps/meteor/app/api/server/v1/email-inbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ API.v1.addRoute(
active: Boolean,
name: String,
email: String,
description: String,
senderInfo: String,
department: String,
description: Match.Maybe(String),
senderInfo: Match.Maybe(String),
department: Match.Maybe(String),
smtp: Match.ObjectIncluding({
server: String,
port: Number,
Expand Down Expand Up @@ -79,9 +79,13 @@ API.v1.addRoute(
if (!_id) {
throw new Error('error-invalid-param');
}
const emailInboxes = await findOneEmailInbox({ _id });
const emailInbox = await findOneEmailInbox({ _id });

return API.v1.success(emailInboxes);
if (!emailInbox) {
return API.v1.notFound();
}

return API.v1.success(emailInbox);
},
async delete() {
check(this.urlParams, {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { IUser } from '@rocket.chat/core-typings';

import { FederatedUser } from '../domain/FederatedUser';
import type { IFederationBridge } from '../domain/IFederationBridge';
import type { RocketChatFileAdapter } from '../infrastructure/rocket-chat/adapters/File';
import type { RocketChatSettingsAdapter } from '../infrastructure/rocket-chat/adapters/Settings';
import type { RocketChatUserAdapter } from '../infrastructure/rocket-chat/adapters/User';

Expand All @@ -9,6 +12,7 @@ export abstract class FederationService {
constructor(
protected bridge: IFederationBridge,
protected internalUserAdapter: RocketChatUserAdapter,
protected internalFileAdapter: RocketChatFileAdapter,
protected internalSettingsAdapter: RocketChatSettingsAdapter,
) {
this.internalHomeServerDomain = this.internalSettingsAdapter.getHomeServerDomain();
Expand All @@ -34,6 +38,26 @@ export abstract class FederationService {
});
}
await this.internalUserAdapter.createFederatedUser(federatedUser);
const insertedUser = await this.internalUserAdapter.getFederatedUserByExternalId(externalUserId);
if (!insertedUser) {
return;
}
await this.updateUserAvatarInternally(insertedUser);
}

protected async updateUserAvatarInternally(federatedUser: FederatedUser): Promise<void> {
const externalUserProfileInformation = await this.bridge.getUserProfileInformation(federatedUser.getExternalId());
if (!externalUserProfileInformation?.avatarUrl) {
return;
}
if (!federatedUser.isRemote() || !federatedUser.shouldUpdateFederationAvatar(externalUserProfileInformation.avatarUrl)) {
return;
}
await this.internalUserAdapter.setAvatar(
federatedUser,
this.bridge.convertMatrixUrlToHttp(federatedUser.getExternalId(), externalUserProfileInformation.avatarUrl),
);
await this.internalUserAdapter.updateFederationAvatar(federatedUser.getInternalId(), externalUserProfileInformation.avatarUrl);
}

protected async createFederatedUserForInviterUsingLocalInformation(internalInviterId: string): Promise<string> {
Expand All @@ -45,7 +69,34 @@ export abstract class FederationService {
const externalInviterId = await this.bridge.createUser(internalUser.username, name, this.internalHomeServerDomain);
const existsOnlyOnProxyServer = true;
await this.createFederatedUser(externalInviterId, internalUser.username, existsOnlyOnProxyServer, name);
await this.updateUserAvatarExternally(
internalUser,
(await this.internalUserAdapter.getFederatedUserByExternalId(externalInviterId)) as FederatedUser,
);

return externalInviterId;
}

protected async updateUserAvatarExternally(internalUser: IUser, externalInviter: FederatedUser): Promise<void> {
if (!internalUser.username) {
return;
}
const buffer = await this.internalFileAdapter.getBufferForAvatarFile(internalUser.username);
if (!buffer) {
return;
}
const avatarFileRecord = await this.internalFileAdapter.getFileMetadataForAvatarFile(internalUser.username);
if (!avatarFileRecord?.type || !avatarFileRecord?.name) {
return;
}
const externalFileUri = await this.bridge.uploadContent(externalInviter.getExternalId(), buffer, {
type: avatarFileRecord.type,
name: avatarFileRecord.name,
});
if (!externalFileUri) {
return;
}
await this.internalUserAdapter.updateFederationAvatar(internalUser._id, externalFileUri);
await this.bridge.setUserAvatar(externalInviter.getExternalId(), externalFileUri);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { isMessageFromMatrixFederation } from '@rocket.chat/core-typings';

import type { IFederationBridge } from '../domain/IFederationBridge';
import type { RocketChatFileAdapter } from '../infrastructure/rocket-chat/adapters/File';
import type { RocketChatMessageAdapter } from '../infrastructure/rocket-chat/adapters/Message';
import type { RocketChatRoomAdapter } from '../infrastructure/rocket-chat/adapters/Room';
import type { RocketChatSettingsAdapter } from '../infrastructure/rocket-chat/adapters/Settings';
Expand All @@ -13,10 +14,11 @@ export class FederationMessageServiceListener extends FederationService {
protected internalRoomAdapter: RocketChatRoomAdapter,
protected internalUserAdapter: RocketChatUserAdapter,
protected internalMessageAdapter: RocketChatMessageAdapter,
protected internalFileAdapter: RocketChatFileAdapter,
protected internalSettingsAdapter: RocketChatSettingsAdapter,
protected bridge: IFederationBridge,
) {
super(bridge, internalUserAdapter, internalSettingsAdapter);
super(bridge, internalUserAdapter, internalFileAdapter, internalSettingsAdapter);
}

public async onMessageReaction(messageReactionEventInput: FederationMessageReactionEventDto): Promise<void> {
Expand Down
Loading