Skip to content

Commit

Permalink
Merge branch 'develop' into fix/error-exporting-channel
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusbsilva137 authored Oct 20, 2023
2 parents ac0b9f9 + c29f5ff commit 991dc0b
Show file tree
Hide file tree
Showing 264 changed files with 4,078 additions and 3,605 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-zoos-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

fixed threads breaking when sending messages too fast
5 changes: 5 additions & 0 deletions .changeset/cyan-mangos-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

fix: UI issue on marketplace filters
5 changes: 5 additions & 0 deletions .changeset/empty-files-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fix unnecessary username validation on accounts profile form
5 changes: 5 additions & 0 deletions .changeset/long-cars-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixed intermittent errors caused by the removal of subscriptions and inquiries when lacking permissions.
5 changes: 5 additions & 0 deletions .changeset/old-zoos-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

fix: mobile ringing notification missing call id
5 changes: 5 additions & 0 deletions .changeset/perfect-onions-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fix i18n translations using sprintf post processor
5 changes: 5 additions & 0 deletions .changeset/perfect-pianos-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/presence': minor
---

Add peak connections monitoring and methods to get and reset the counter
5 changes: 5 additions & 0 deletions .changeset/rich-dogs-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': minor
---

Fix typing indicator of Apps user
7 changes: 7 additions & 0 deletions .changeset/slow-coats-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@rocket.chat/meteor": minor
---

Add the daily and monthly peaks of concurrent connections to statistics
- Added `dailyPeakConnections` statistic for monitoring the daily peak of concurrent connections in a workspace;
- Added `maxMonthlyPeakConnections` statistic for monitoring the last 30 days peak of concurrent connections in a workspace;
5 changes: 5 additions & 0 deletions .changeset/stale-masks-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/server-fetch': patch
---

Fixed an issue where the payload of an HTTP request made by an app wouldn't be correctly encoded in some cases
5 changes: 5 additions & 0 deletions .changeset/thick-spoons-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': minor
---

Added new Omnichannel setting 'Hide conversation after closing'
5 changes: 5 additions & 0 deletions .changeset/tidy-cows-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

feat: Community users will now be able to customize their Business hour timezone
5 changes: 5 additions & 0 deletions .changeset/tough-apples-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Forward headers when using proxy for file uploads
5 changes: 5 additions & 0 deletions .changeset/weak-cameras-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed issue with message read receipts not being created when accessing a room the first time
8 changes: 4 additions & 4 deletions FEATURES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Features

- Self Host
- Docker
- Multiple Deployment Options (Heroku, Digital Ocean, Sandstorm, etc.)
- Docker
- Multiple Deployment Options (Heroku, Digital Ocean, Sandstorm, etc.)
- Authentication Options
- OAuth
- OAuth
- SAML
- LDAP
- CAS (1.0, 2.0 + attribute sync)
Expand All @@ -19,7 +19,7 @@
- Rich Media
- Audio Calls
- Video Conferencing
- Screensharing
- Screen Sharing
- Notifications
- Desktop and Mobile
- Use your own gateway
Expand Down
9 changes: 5 additions & 4 deletions apps/meteor/app/apps/server/bridges/livechat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class AppLivechatBridge extends LivechatBridge {
throw new Error('Invalid token for livechat message');
}

const msg = await Livechat.sendMessage({
const msg = await LivechatTyped.sendMessage({
guest: this.orch.getConverters()?.get('visitors').convertAppVisitor(message.visitor),
message: await this.orch.getConverters()?.get('messages').convertAppMessage(message),
agent: undefined,
Expand Down Expand Up @@ -74,7 +74,8 @@ export class AppLivechatBridge extends LivechatBridge {
message: await this.orch.getConverters()?.get('messages').convertAppMessage(message),
};

await Livechat.updateMessage(data);
// @ts-expect-error IVisitor vs ILivechatVisitor :(
await LivechatTyped.updateMessage(data);
}

protected async createRoom(visitor: IVisitor, agent: IUser, appId: string, extraParams?: IExtraRoomParams): Promise<ILivechatRoom> {
Expand Down Expand Up @@ -208,7 +209,7 @@ export class AppLivechatBridge extends LivechatBridge {
userId = transferredTo._id;
}

return Livechat.transfer(
return LivechatTyped.transfer(
await this.orch.getConverters()?.get('rooms').convertAppRoom(currentRoom),
this.orch.getConverters()?.get('visitors').convertAppVisitor(visitor),
{ userId, departmentId, transferredBy, transferredTo },
Expand Down Expand Up @@ -288,7 +289,7 @@ export class AppLivechatBridge extends LivechatBridge {
throw new Error('Could not get the message converter to process livechat room messages');
}

const livechatMessages = await Livechat.getRoomMessages({ rid: roomId });
const livechatMessages = await LivechatTyped.getRoomMessages({ rid: roomId });

return Promise.all(livechatMessages.map((message) => messageConverter.convertMessage(message) as Promise<IAppsEngineMesage>));
}
Expand Down
6 changes: 5 additions & 1 deletion apps/meteor/app/apps/server/bridges/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ export class AppMessageBridge extends MessageBridge {
protected async typing({ scope, id, username, isTyping }: ITypingDescriptor): Promise<void> {
switch (scope) {
case 'room':
notifications.notifyRoom(id, 'typing', username!, isTyping);
if (!username) {
throw new Error('Invalid username');
}

notifications.notifyRoom(id, 'user-activity', username, isTyping ? ['user-typing'] : []);
return;
default:
throw new Error('Unrecognized typing scope provided');
Expand Down
7 changes: 4 additions & 3 deletions apps/meteor/app/apps/server/bridges/uiInteraction.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { IUIKitInteraction } from '@rocket.chat/apps-engine/definition/uikit';
import type { IUser } from '@rocket.chat/apps-engine/definition/users';
import { UiInteractionBridge as UiIntBridge } from '@rocket.chat/apps-engine/server/bridges/UiInteractionBridge';
import { UiInteractionBridge as AppsEngineUiInteractionBridge } from '@rocket.chat/apps-engine/server/bridges/UiInteractionBridge';
import { api } from '@rocket.chat/core-services';
import type { UiKit } from '@rocket.chat/core-typings';

import type { AppServerOrchestrator } from '../../../../ee/server/apps/orchestrator';

export class UiInteractionBridge extends UiIntBridge {
export class UiInteractionBridge extends AppsEngineUiInteractionBridge {
constructor(private readonly orch: AppServerOrchestrator) {
super();
}
Expand All @@ -19,6 +20,6 @@ export class UiInteractionBridge extends UiIntBridge {
throw new Error('Invalid app provided');
}

void api.broadcast('notify.uiInteraction', user.id, interaction);
void api.broadcast('notify.uiInteraction', user.id, interaction as UiKit.ServerInteraction);
}
}
2 changes: 1 addition & 1 deletion apps/meteor/app/cas/server/cas_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ Accounts.registerLoginHandler('cas', async (options) => {
if (roomName) {
let room = await Rooms.findOneByNameAndType(roomName, 'c');
if (!room) {
room = await createRoom('c', roomName, user.username);
room = await createRoom('c', roomName, user);
}
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { settings } from '../../../settings/server';

export const getFederationDiscoveryMethod = () => settings.get<string>('FEDERATION_Discovery_Method');
3 changes: 0 additions & 3 deletions apps/meteor/app/federation/server/lib/getFederationDomain.js

This file was deleted.

3 changes: 3 additions & 0 deletions apps/meteor/app/federation/server/lib/getFederationDomain.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { settings } from '../../../settings/server';

export const getFederationDomain = () => settings.get<string>('FEDERATION_Domain').replace('@', '');
3 changes: 0 additions & 3 deletions apps/meteor/app/federation/server/lib/isFederationEnabled.js

This file was deleted.

3 changes: 3 additions & 0 deletions apps/meteor/app/federation/server/lib/isFederationEnabled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { settings } from '../../../settings/server';

export const isFederationEnabled = () => settings.get<boolean>('FEDERATION_Enabled');
27 changes: 26 additions & 1 deletion apps/meteor/app/file-upload/server/lib/FileUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,32 @@ export const FileUpload = {
) {
res.setHeader('Content-Disposition', `${forceDownload ? 'attachment' : 'inline'}; filename="${encodeURI(fileName)}"`);

request.get(fileUrl, (fileRes) => fileRes.pipe(res));
request.get(fileUrl, (fileRes) => {
if (fileRes.statusCode !== 200) {
res.setHeader('x-rc-proxyfile-status', String(fileRes.statusCode));
res.setHeader('content-length', 0);
res.writeHead(500);
res.end();
return;
}

// eslint-disable-next-line prettier/prettier
const headersToProxy = [
'age',
'cache-control',
'content-length',
'content-type',
'date',
'expired',
'last-modified',
];

headersToProxy.forEach((header) => {
fileRes.headers[header] && res.setHeader(header, String(fileRes.headers[header]));
});

fileRes.pipe(res);
});
},

generateJWTToFileUrls({ rid, userId, fileId }: { rid: string; userId: string; fileId: string }) {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/file-upload/ufs/AmazonS3/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class AmazonS3Store extends UploadFS.Store {
ResponseContentDisposition: `${forceDownload ? 'attachment' : 'inline'}; filename="${encodeURI(file.name || '')}"`,
};

return s3.getSignedUrl('getObject', params);
return s3.getSignedUrlPromise('getObject', params);
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default async function handleJoinedChannel(args) {
let room = await Rooms.findOneByName(args.roomName);

if (!room) {
const createdRoom = await createRoom('c', args.roomName, user.username, []);
const createdRoom = await createRoom('c', args.roomName, user, []);
room = await Rooms.findOne({ _id: createdRoom.rid });

this.log(`${user.username} created room ${args.roomName}`);
Expand Down
26 changes: 21 additions & 5 deletions apps/meteor/app/livechat/client/lib/stream/queueManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,34 @@ import { LivechatInquiry } from '../../collections/LivechatInquiry';
const departments = new Set();

const events = {
added: (inquiry: ILivechatInquiryRecord) => {
departments.has(inquiry.department) && LivechatInquiry.insert({ ...inquiry, alert: true, _updatedAt: new Date(inquiry._updatedAt) });
added: async (inquiry: ILivechatInquiryRecord) => {
if (!departments.has(inquiry.department)) {
return;
}

LivechatInquiry.insert({ ...inquiry, alert: true, _updatedAt: new Date(inquiry._updatedAt) });
await invalidateRoomQueries(inquiry.rid);
},
changed: async (inquiry: ILivechatInquiryRecord) => {
if (inquiry.status !== 'queued' || (inquiry.department && !departments.has(inquiry.department))) {
return LivechatInquiry.remove(inquiry._id);
return removeInquiry(inquiry);
}

LivechatInquiry.upsert({ _id: inquiry._id }, { ...inquiry, alert: true, _updatedAt: new Date(inquiry._updatedAt) });
await queryClient.invalidateQueries(['/v1/rooms.info', inquiry.rid]);
await invalidateRoomQueries(inquiry.rid);
},
removed: (inquiry: ILivechatInquiryRecord) => LivechatInquiry.remove(inquiry._id),
removed: (inquiry: ILivechatInquiryRecord) => removeInquiry(inquiry),
};

const invalidateRoomQueries = async (rid: string) => {
await queryClient.invalidateQueries(['rooms', { reference: rid, type: 'l' }]);
await queryClient.removeQueries(['rooms', rid]);
await queryClient.removeQueries(['/v1/rooms.info', rid]);
};

const removeInquiry = async (inquiry: ILivechatInquiryRecord) => {
await LivechatInquiry.remove(inquiry._id);
return queryClient.invalidateQueries(['rooms', { reference: inquiry.rid, type: 'l' }]);
};

const getInquiriesFromAPI = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class BusinessHoursManager {
showBackButton(): boolean {
return this.behavior.showBackButton();
}

showTimezoneTemplate(): boolean {
return this.behavior.showTimezoneTemplate();
}
}

export const businessHourManager = new BusinessHoursManager(new SingleBusinessHourBehavior());
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export interface IBusinessHourBehavior {
getView(): string;
showCustomTemplate(businessHourData: ILivechatBusinessHour): boolean;
showBackButton(): boolean;
showTimezoneTemplate(): boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,4 @@ export class SingleBusinessHourBehavior implements IBusinessHourBehavior {
showBackButton(): boolean {
return false;
}

showTimezoneTemplate(): boolean {
return false;
}
}
10 changes: 4 additions & 6 deletions apps/meteor/app/livechat/imports/server/rest/departments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from '../../../server/api/lib/departments';
import { DepartmentHelper } from '../../../server/lib/Departments';
import { Livechat } from '../../../server/lib/Livechat';
import { Livechat as LivechatTs } from '../../../server/lib/LivechatTyped';

API.v1.addRoute(
'livechat/department',
Expand Down Expand Up @@ -192,7 +193,7 @@ API.v1.addRoute(
},
{
async post() {
await Livechat.archiveDepartment(this.urlParams._id);
await LivechatTs.archiveDepartment(this.urlParams._id);

return API.v1.success();
},
Expand All @@ -207,11 +208,8 @@ API.v1.addRoute(
},
{
async post() {
if (await Livechat.unarchiveDepartment(this.urlParams._id)) {
return API.v1.success();
}

return API.v1.failure();
await LivechatTs.unarchiveDepartment(this.urlParams._id);
return API.v1.success();
},
},
);
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/livechat/imports/server/rest/sms.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ API.v1.addRoute('livechat/sms-incoming/:service', {
};

try {
const msg = SMSService.response.call(this, await Livechat.sendMessage(sendMessage));
const msg = SMSService.response.call(this, await LivechatTyped.sendMessage(sendMessage));
setImmediate(async () => {
if (sms.extra) {
if (sms.extra.fromCountry) {
Expand Down
3 changes: 1 addition & 2 deletions apps/meteor/app/livechat/server/api/lib/livechat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { Meteor } from 'meteor/meteor';
import { callbacks } from '../../../../../lib/callbacks';
import { i18n } from '../../../../../server/lib/i18n';
import { normalizeAgent } from '../../lib/Helper';
import { Livechat } from '../../lib/Livechat';
import { Livechat as LivechatTyped } from '../../lib/LivechatTyped';

export function online(department: string, skipSettingCheck = false, skipFallbackCheck = false): Promise<boolean> {
Expand Down Expand Up @@ -139,7 +138,7 @@ export function normalizeHttpHeaderData(headers: Record<string, string | string[

export async function settings({ businessUnit = '' }: { businessUnit?: string } = {}): Promise<Record<string, string | number | any>> {
// Putting this ugly conversion while we type the livechat service
const initSettings = (await Livechat.getInitSettings()) as unknown as Record<string, string | number | any>;
const initSettings = await LivechatTyped.getInitSettings();
const triggers = await findTriggers();
const departments = await findDepartments(businessUnit);
const sound = `${Meteor.absoluteUrl()}sounds/chime.mp3`;
Expand Down
Loading

0 comments on commit 991dc0b

Please sign in to comment.