Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into unse…
Browse files Browse the repository at this point in the history
…tMarkdown

* 'develop' of github.com:RocketChat/Rocket.Chat:
  chore: improve useJumpToMessage (#31907)
  feat: Add `link` action to composer toolbar (#31679)
  chore: replace `PaletteStyleTag` in favor of fuselage component (#31839)
  fix: presence for mobiles with duplicated connections (#31895)
  fix: New users are not automatically inserted in auto-join rooms inside default teams (#31720)
  fix: livechat agent status set to available after reactivation (#31651)
  chore: Deprecate `insertOrUpdateUser` method (#31884)
  chore: update ts version on recently merged package (#31885)
  chore: move utilitary functions out of ee folder (#31207)
  chore: Remove references to EE code from the app bridges (#31757)
  fix: Room import doesn't honor the specified owner (#31803)
  fix: message parser emphasis black hole (#31868)
  chore: remove hardcoded position for message date (#31866)
  feat: show date on message's scroll (#31572)
  chore: `RoomHeader` keyboard navigability (#31837)
  fix: Login page breaking when handling not expected errors (#31804)
  • Loading branch information
gabriellsh committed Mar 6, 2024
2 parents c4cb012 + 85fe51a commit dd15dd5
Show file tree
Hide file tree
Showing 147 changed files with 2,091 additions and 1,343 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-penguins-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Now we are considering channels with auto-join inside teams on user creation
5 changes: 5 additions & 0 deletions .changeset/cuddly-rocks-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": minor
---

Deprecate `insertOrUpdateUser` Meteor method
5 changes: 5 additions & 0 deletions .changeset/funny-cooks-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed room owner specified on room import not being inserted as a room member or owner.
6 changes: 6 additions & 0 deletions .changeset/khaki-oranges-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": minor
"@rocket.chat/i18n": minor
---

Added a new formatter shortcut to add hyperlinks to a message
5 changes: 5 additions & 0 deletions .changeset/nice-ducks-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixed auto-availability of reactivated livechat agents; they now stay 'Not Available' until manually set to 'Available'
5 changes: 5 additions & 0 deletions .changeset/nine-ads-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": minor
---

feat: show date on message's scroll
5 changes: 5 additions & 0 deletions .changeset/quick-cheetahs-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/web-ui-registration": patch
---

fixed the login page crashing when receiving unexpected errors
5 changes: 5 additions & 0 deletions .changeset/wicked-months-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fix users presence stuck as online after connecting using mobile apps
6 changes: 2 additions & 4 deletions apps/meteor/app/apps/server/bridges/activation.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import type { AppStatus } from '@rocket.chat/apps-engine/definition/AppStatus';
import type { IAppServerOrchestrator, AppStatus } from '@rocket.chat/apps';
import type { ProxiedApp } from '@rocket.chat/apps-engine/server/ProxiedApp';
import { AppActivationBridge as ActivationBridge } from '@rocket.chat/apps-engine/server/bridges/AppActivationBridge';
import { Users } from '@rocket.chat/models';

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

export class AppActivationBridge extends ActivationBridge {
// eslint-disable-next-line no-empty-function
constructor(private readonly orch: AppServerOrchestrator) {
constructor(private readonly orch: IAppServerOrchestrator) {
super();
}

Expand Down
5 changes: 2 additions & 3 deletions apps/meteor/app/apps/server/bridges/api.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { IAppServerOrchestrator } from '@rocket.chat/apps';
import type { RequestMethod } from '@rocket.chat/apps-engine/definition/accessors';
import type { IApiRequest, IApiEndpoint, IApi } from '@rocket.chat/apps-engine/definition/api';
import { ApiBridge } from '@rocket.chat/apps-engine/server/bridges/ApiBridge';
Expand All @@ -7,7 +8,6 @@ import express from 'express';
import { Meteor } from 'meteor/meteor';
import { WebApp } from 'meteor/webapp';

import type { AppServerOrchestrator } from '../../../../ee/server/apps/orchestrator';
import { authenticationMiddleware } from '../../../api/server/middlewares/authentication';

const apiServer = express();
Expand All @@ -24,8 +24,7 @@ interface IRequestWithPrivateHash extends Request {
export class AppApisBridge extends ApiBridge {
appRouters: Map<string, IRouter>;

// eslint-disable-next-line no-empty-function
constructor(private readonly orch: AppServerOrchestrator) {
constructor(private readonly orch: IAppServerOrchestrator) {
super();
this.appRouters = new Map();

Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/apps/server/bridges/cloud.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { IAppServerOrchestrator } from '@rocket.chat/apps';
import type { IWorkspaceToken } from '@rocket.chat/apps-engine/definition/cloud/IWorkspaceToken';
import { CloudWorkspaceBridge } from '@rocket.chat/apps-engine/server/bridges/CloudWorkspaceBridge';

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

export class AppCloudBridge extends CloudWorkspaceBridge {
constructor(private readonly orch: AppServerOrchestrator) {
constructor(private readonly orch: IAppServerOrchestrator) {
super();
}

Expand Down
46 changes: 28 additions & 18 deletions apps/meteor/app/apps/server/bridges/commands.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { IAppServerOrchestrator, IAppsRoom, IAppsUser } from '@rocket.chat/apps';
import type { ISlashCommand, ISlashCommandPreview, ISlashCommandPreviewItem } from '@rocket.chat/apps-engine/definition/slashcommands';
import { SlashCommandContext } from '@rocket.chat/apps-engine/definition/slashcommands';
import { CommandBridge } from '@rocket.chat/apps-engine/server/bridges/CommandBridge';
import type { IMessage, RequiredField, SlashCommand, SlashCommandCallbackParams } from '@rocket.chat/core-typings';
import { Meteor } from 'meteor/meteor';

import { Utilities } from '../../../../ee/lib/misc/Utilities';
import type { AppServerOrchestrator } from '../../../../ee/server/apps/orchestrator';
import { parseParameters } from '../../../../lib/utils/parseParameters';
import { slashCommands } from '../../../utils/server/slashCommand';

export class AppCommandsBridge extends CommandBridge {
disabledCommands: Map<string, (typeof slashCommands.commands)[string]>;

constructor(private readonly orch: AppServerOrchestrator) {
constructor(private readonly orch: IAppServerOrchestrator) {
super();
this.disabledCommands = new Map();
}
Expand Down Expand Up @@ -44,7 +44,7 @@ export class AppCommandsBridge extends CommandBridge {
slashCommands.commands[cmd] = this.disabledCommands.get(cmd) as (typeof slashCommands.commands)[string];
this.disabledCommands.delete(cmd);

this.orch.getNotifier().commandUpdated(cmd);
void this.orch.getNotifier().commandUpdated(cmd);
}

protected async disableCommand(command: string, appId: string): Promise<void> {
Expand All @@ -69,7 +69,7 @@ export class AppCommandsBridge extends CommandBridge {
this.disabledCommands.set(cmd, commandObj);
delete slashCommands.commands[cmd];

this.orch.getNotifier().commandDisabled(cmd);
void this.orch.getNotifier().commandDisabled(cmd);
}

// command: { command, paramsExample, i18nDescription, executor: function }
Expand All @@ -95,7 +95,7 @@ export class AppCommandsBridge extends CommandBridge {
) as (typeof slashCommands.commands)[string]['previewCallback'];

slashCommands.commands[cmd] = item;
this.orch.getNotifier().commandUpdated(cmd);
void this.orch.getNotifier().commandUpdated(cmd);
}

protected async registerCommand(command: ISlashCommand, appId: string): Promise<void> {
Expand All @@ -118,7 +118,7 @@ export class AppCommandsBridge extends CommandBridge {
} as SlashCommand;

slashCommands.commands[command.command.toLowerCase()] = item;
this.orch.getNotifier().commandAdded(command.command.toLowerCase());
void this.orch.getNotifier().commandAdded(command.command.toLowerCase());
}

protected async unregisterCommand(command: string, appId: string): Promise<void> {
Expand All @@ -132,7 +132,7 @@ export class AppCommandsBridge extends CommandBridge {
this.disabledCommands.delete(cmd);
delete slashCommands.commands[cmd];

this.orch.getNotifier().commandRemoved(cmd);
void this.orch.getNotifier().commandRemoved(cmd);
}

private _verifyCommand(command: ISlashCommand): void {
Expand Down Expand Up @@ -162,14 +162,15 @@ export class AppCommandsBridge extends CommandBridge {
}

private async _appCommandExecutor({ command, message, params, triggerId, userId }: SlashCommandCallbackParams<string>): Promise<void> {
const user = await this.orch.getConverters()?.get('users').convertById(userId);
const room = await this.orch.getConverters()?.get('rooms').convertById(message.rid);
// #TODO: #AppsEngineTypes - Remove explicit types and typecasts once the apps-engine definition/implementation mismatch is fixed.
const user: IAppsUser | undefined = await this.orch.getConverters()?.get('users').convertById(userId);
const room: IAppsRoom | undefined = await this.orch.getConverters()?.get('rooms').convertById(message.rid);
const threadId = message.tmid;
const parameters = parseParameters(params);

const context = new SlashCommandContext(
Object.freeze(user),
Object.freeze(room),
Object.freeze(user as IAppsUser),
Object.freeze(room as IAppsRoom),
Object.freeze(parameters) as string[],
threadId,
triggerId,
Expand All @@ -183,12 +184,19 @@ export class AppCommandsBridge extends CommandBridge {
parameters: any,
message: RequiredField<Partial<IMessage>, 'rid'>,
): Promise<ISlashCommandPreview | undefined> {
const user = await this.orch.getConverters()?.get('users').convertById(Meteor.userId());
const room = await this.orch.getConverters()?.get('rooms').convertById(message.rid);
// #TODO: #AppsEngineTypes - Remove explicit types and typecasts once the apps-engine definition/implementation mismatch is fixed.
const uid = Meteor.userId() as string;
const user: IAppsUser | undefined = await this.orch.getConverters()?.get('users').convertById(uid);
const room: IAppsRoom | undefined = await this.orch.getConverters()?.get('rooms').convertById(message.rid);
const threadId = message.tmid;
const params = parseParameters(parameters);

const context = new SlashCommandContext(Object.freeze(user), Object.freeze(room), Object.freeze(params) as string[], threadId);
const context = new SlashCommandContext(
Object.freeze(user as IAppsUser),
Object.freeze(room as IAppsRoom),
Object.freeze(params) as string[],
threadId,
);
return this.orch.getManager()?.getCommandManager().getPreviews(command, context);
}

Expand All @@ -199,14 +207,16 @@ export class AppCommandsBridge extends CommandBridge {
preview: ISlashCommandPreviewItem,
triggerId: string,
): Promise<void> {
const user = await this.orch.getConverters()?.get('users').convertById(Meteor.userId());
const room = await this.orch.getConverters()?.get('rooms').convertById(message.rid);
// #TODO: #AppsEngineTypes - Remove explicit types and typecasts once the apps-engine definition/implementation mismatch is fixed.
const uid = Meteor.userId() as string;
const user: IAppsUser | undefined = await this.orch.getConverters()?.get('users').convertById(uid);
const room: IAppsRoom | undefined = await this.orch.getConverters()?.get('rooms').convertById(message.rid);
const threadId = message.tmid;
const params = parseParameters(parameters);

const context = new SlashCommandContext(
Object.freeze(user),
Object.freeze(room),
Object.freeze(user as IAppsUser),
Object.freeze(room as IAppsRoom),
Object.freeze(params) as string[],
threadId,
triggerId,
Expand Down
11 changes: 6 additions & 5 deletions apps/meteor/app/apps/server/bridges/details.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import type { IAppServerOrchestrator } from '@rocket.chat/apps';
import type { ISetting } from '@rocket.chat/apps-engine/definition/settings';
import { AppDetailChangesBridge as DetailChangesBridge } from '@rocket.chat/apps-engine/server/bridges/AppDetailChangesBridge';

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

export class AppDetailChangesBridge extends DetailChangesBridge {
constructor(private readonly orch: AppServerOrchestrator) {
constructor(private readonly orch: IAppServerOrchestrator) {
super();
}

protected onAppSettingsChange(appId: string, setting: ISetting): void {
const logFailure = () => console.warn('failed to notify about the setting change.', appId);

try {
this.orch.getNotifier().appSettingsChange(appId, setting);
this.orch.getNotifier().appSettingsChange(appId, setting).catch(logFailure);
} catch (e) {
console.warn('failed to notify about the setting change.', appId);
logFailure();
}
}
}
5 changes: 2 additions & 3 deletions apps/meteor/app/apps/server/bridges/environmental.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { IAppServerOrchestrator } from '@rocket.chat/apps';
import { EnvironmentalVariableBridge } from '@rocket.chat/apps-engine/server/bridges/EnvironmentalVariableBridge';

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

export class AppEnvironmentalVariableBridge extends EnvironmentalVariableBridge {
allowed: Array<string>;

constructor(private readonly orch: AppServerOrchestrator) {
constructor(private readonly orch: IAppServerOrchestrator) {
super();
this.allowed = ['NODE_ENV', 'ROOT_URL', 'INSTANCE_IP'];
}
Expand Down
5 changes: 2 additions & 3 deletions apps/meteor/app/apps/server/bridges/http.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { IAppServerOrchestrator } from '@rocket.chat/apps';
import type { IHttpResponse } from '@rocket.chat/apps-engine/definition/accessors';
import type { IHttpBridgeRequestInfo } from '@rocket.chat/apps-engine/server/bridges';
import { HttpBridge } from '@rocket.chat/apps-engine/server/bridges/HttpBridge';
import { serverFetch as fetch } from '@rocket.chat/server-fetch';

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

const isGetOrHead = (method: string): boolean => ['GET', 'HEAD'].includes(method.toUpperCase());

// Previously, there was no timeout for HTTP requests.
Expand All @@ -13,7 +12,7 @@ const isGetOrHead = (method: string): boolean => ['GET', 'HEAD'].includes(method
const DEFAULT_TIMEOUT = 3 * 60 * 1000;

export class AppHttpBridge extends HttpBridge {
constructor(private readonly orch: AppServerOrchestrator) {
constructor(private readonly orch: IAppServerOrchestrator) {
super();
}

Expand Down
17 changes: 10 additions & 7 deletions apps/meteor/app/apps/server/bridges/internal.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import type { ISetting } from '@rocket.chat/apps-engine/definition/settings';
import type { IAppServerOrchestrator, IAppsSetting } from '@rocket.chat/apps';
import { InternalBridge } from '@rocket.chat/apps-engine/server/bridges/InternalBridge';
import type { ISubscription } from '@rocket.chat/core-typings';
import type { ISetting, ISubscription } from '@rocket.chat/core-typings';
import { Settings, Subscriptions } from '@rocket.chat/models';

import type { AppServerOrchestrator } from '../../../../ee/server/apps/orchestrator';
import { isTruthy } from '../../../../lib/isTruthy';
import { deasyncPromise } from '../../../../server/deasync/deasync';

export class AppInternalBridge extends InternalBridge {
constructor(private readonly orch: AppServerOrchestrator) {
constructor(private readonly orch: IAppServerOrchestrator) {
super();
}

Expand Down Expand Up @@ -37,9 +36,13 @@ export class AppInternalBridge extends InternalBridge {
return records.map((s: ISubscription) => s.u.username).filter(isTruthy);
}

protected async getWorkspacePublicKey(): Promise<ISetting> {
const publicKeySetting = await Settings.findOneById('Cloud_Workspace_PublicKey');
protected async getWorkspacePublicKey(): Promise<IAppsSetting> {
// #TODO: #AppsEngineTypes - Remove explicit types and typecasts once the apps-engine definition/implementation mismatch is fixed.
const publicKeySetting: ISetting | null = await Settings.findOneById('Cloud_Workspace_PublicKey');

return this.orch.getConverters()?.get('settings').convertToApp(publicKeySetting);
return this.orch
.getConverters()
?.get('settings')
.convertToApp(publicKeySetting as ISetting);
}
}
Loading

0 comments on commit dd15dd5

Please sign in to comment.