Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 8a3c928
Author: Aaron Ogle <geekgonecrazy@users.noreply.github.com>
Date:   Fri May 20 08:35:44 2022 -0500

    [FIX] Initial User not added to default channel (#25544)

commit b893ffd
Author: Leonardo Ostjen Couto <leonardoostjen@gmail.com>
Date:   Thu May 19 20:39:38 2022 -0300

    [NEW] New stats rewrite (#25078)

    Co-authored-by: matheusbsilva137 <matheus_barbosa137@hotmail.com>
    Co-authored-by: Diego Sampaio <chinello@gmail.com>

commit 42442d2
Author: Júlia Jaeger Foresti <60678893+juliajforesti@users.noreply.github.com>
Date:   Thu May 19 18:42:27 2022 -0300

    Chore: Convert apps/meteor/client/views/admin/settings (#25565)

commit 59c52e3
Author: Cauê Felchar <11652381+cauefcr@users.noreply.github.com>
Date:   Thu May 19 16:32:06 2022 -0300

    [FIX] User abandonment setting is working again (#25520)

commit e851297
Author: souzaramon <ramon.souza@objective.com.br>
Date:   Thu May 19 01:04:54 2022 -0300

    Test: Migrate 13-permissions from cypress to playwright (#25558)

commit 0830814
Author: Filipe Marins <filipe.marins@rocket.chat>
Date:   Wed May 18 20:06:13 2022 -0300

    [FIX] Add open user card to user avatar (#25445)

commit e80d88f
Author: Guilherme Gazzo <guilhermegazzo@gmail.com>
Date:   Wed May 18 19:28:37 2022 -0300

    [FIX] Dynamic load matrix is enabled and handle failure (#25495)

    Co-authored-by: Aaron Ogle <aaron@geekgonecrazy.com>

commit 71d57bd
Author: Martin Schoeler <martin.schoeler@rocket.chat>
Date:   Wed May 18 17:45:58 2022 -0300

    [FIX] One of the triggers was not working correctly (#25409)

    * [FIX] One of the triggers was not working correctly

    * fix html iteration

    * eslint fix

    Co-authored-by: Tiago Evangelista Pinto <tiago.evangelista@rocket.chat>

commit bbd534a
Author: Guilherme Gazzo <guilhermegazzo@gmail.com>
Date:   Wed May 18 14:42:44 2022 -0300

    Regression: CI services build (#25555)

commit 45b46da
Author: Fábio Albuquerque <albuquerquefabio@icloud.com>
Date:   Wed May 18 09:42:43 2022 -0300

    Chore: User set UTC offset (#25381)

    Co-authored-by: Guilherme Gazzo <guilhermegazzo@gmail.com>

commit d170c48
Author: Guilherme Jun Grillo <48109548+guijun13@users.noreply.github.com>
Date:   Wed May 18 09:11:44 2022 -0300

    [FIX] Rooms' names turn lower case on CSV import (#24612)

    * feat: change channel name 'rule' when importing

    * feat: add maintainCase in limax

    * fix: update special characters rule

    * fix: regression of settings use for import rules

commit 3ab9d8a
Author: Weslley Campos <30299972+weslley543@users.noreply.github.com>
Date:   Tue May 17 21:34:38 2022 -0300

    Chore: migrate-to-pw-adjust-in-intermitences (#25542)

commit f975b2c
Author: Matheus Barbosa Silva <36537004+matheusbsilva137@users.noreply.github.com>
Date:   Tue May 17 18:38:44 2022 -0300

    Add support to map a LDAP group to multiple roles (#23849)

    Co-authored-by: Pierre Lehnen <pierre.lehnen@rocket.chat>

commit 86c0131
Author: Guilherme Gazzo <guilhermegazzo@gmail.com>
Date:   Tue May 17 17:05:44 2022 -0300

    Chore: Livechat change output level (#25522)

commit 93575bf
Author: Allan RIbeiro <35040806+AllanPazRibeiro@users.noreply.github.com>
Date:   Tue May 17 16:11:51 2022 -0300

    [NEW] Adding app button on user dropdown (#25326)

    * feat: adding app button on user dropdown

    * chore: changing some implementations and adding comments

    * chore: fixing lint issues

    * Update apps/meteor/client/sidebar/header/UserDropdown.tsx

    * chore: change some method location

    * chore: fixing lint issues

    * fix: using local method

    * Refactor AccountBox to singleton

    Co-authored-by: Douglas Gubert <douglas.gubert@gmail.com>

commit fd40e3e
Author: Weslley Campos <30299972+weslley543@users.noreply.github.com>
Date:   Tue May 17 13:33:19 2022 -0300

    Chore: migrate from cypress to pw 14-setting-permission (#25523)

commit 88710b2
Author: souzaramon <ramon.souza@objective.com.br>
Date:   Tue May 17 10:59:56 2022 -0300

    Chore: Tests with Playwright (task: ROC-31, 12-settings) (#25253)

commit 72db7a2
Author: souzaramon <ramon.souza@objective.com.br>
Date:   Tue May 17 09:35:07 2022 -0300

    Chore: Migrate 15-message-popup from cypress to playwright (#25462)

commit 99a3651
Author: Júlia Jaeger Foresti <60678893+juliajforesti@users.noreply.github.com>
Date:   Mon May 16 16:56:01 2022 -0300

    Chore: Convert apps/meteor/client/views/admin/settings/inputs folder (#25427)

commit 75c7f4d
Author: Martin Schoeler <martin.schoeler@rocket.chat>
Date:   Mon May 16 16:10:42 2022 -0300

    [FIX] UI/UX issues on Live Chat widget (#25407)

    * [FIX] UI/UX issues on Live Chat widget

    * Use @rocketchat/logo

    * READ THE ERRORS MARTIN

    * Remove old logo

    * Fix Reviews

    * chore: remove unnecessary class prop

    Co-authored-by: dougfabris <devfabris@gmail.com>

commit bdeb54a
Author: Yash Rajpal <58601732+yash-rajpal@users.noreply.github.com>
Date:   Tue May 17 00:12:55 2022 +0530

    Chore: Convert Admin -> Rooms to TS (#25348)

    Co-authored-by: Guilherme Gazzo <guilhermegazzo@gmail.com>

commit 394b4aa
Author: Hugo Costa <hugocarreiracosta@gmail.com>
Date:   Mon May 16 12:52:15 2022 -0300

    Chore: Migrate NotFoundPage to TS (#25509)

commit de7cd66
Author: Hugo Costa <hugocarreiracosta@gmail.com>
Date:   Mon May 16 12:10:48 2022 -0300

    [FIX] Unable to see channel member list by authorized channel roles (#25412)

commit 2d59aa9
Author: Guilherme Gazzo <guilhermegazzo@gmail.com>
Date:   Mon May 16 11:08:28 2022 -0300

    Regression: Fix services-image-build-check (#25519)

    Co-authored-by: Diego Sampaio <chinello@gmail.com>

commit 3b9254e
Author: Kevin Aleman <kaleman960@gmail.com>
Date:   Mon May 16 05:55:35 2022 -0600

    Chore: Migrate spotify to ts (#25507)
  • Loading branch information
albuquerquefabio committed May 20, 2022
1 parent a1eb536 commit 752737a
Show file tree
Hide file tree
Showing 152 changed files with 2,437 additions and 902 deletions.
73 changes: 47 additions & 26 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
release:
types: [published]
pull_request:
branches: "**"
branches: '**'
push:
branches:
- develop
Expand Down Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Use Node.js 14.18.3
uses: actions/setup-node@v3
with:
node-version: "14.18.3"
node-version: '14.18.3'

- uses: actions/checkout@v3

Expand Down Expand Up @@ -175,8 +175,8 @@ jobs:

strategy:
matrix:
node-version: ["14.18.3"]
mongodb-version: ["3.6", "4.0", "4.2", "4.4", "5.0"]
node-version: ['14.18.3']
mongodb-version: ['3.6', '4.0', '4.2', '4.4', '5.0']

steps:
- name: Launch MongoDB
Expand Down Expand Up @@ -247,7 +247,7 @@ jobs:
- name: E2E Test API
env:
TEST_MODE: "true"
TEST_MODE: 'true'
MONGO_URL: mongodb://localhost:27017/rocketchat
MONGO_OPLOG_URL: mongodb://localhost:27017/local
run: |
Expand All @@ -258,7 +258,7 @@ jobs:
- name: E2E Test UI (Legacy - Cypress)
env:
TEST_MODE: "true"
TEST_MODE: 'true'
MONGO_URL: mongodb://localhost:27017/rocketchat
MONGO_OPLOG_URL: mongodb://localhost:27017/local
run: |
Expand All @@ -269,7 +269,7 @@ jobs:
- name: E2E Test UI
env:
TEST_MODE: "true"
TEST_MODE: 'true'
MONGO_URL: mongodb://localhost:27017/rocketchat
MONGO_OPLOG_URL: mongodb://localhost:27017/local
run: |
Expand Down Expand Up @@ -305,8 +305,8 @@ jobs:

strategy:
matrix:
node-version: ["14.18.3"]
mongodb-version: ["4.4"]
node-version: ['14.18.3']
mongodb-version: ['4.4']

steps:
- name: Launch MongoDB
Expand Down Expand Up @@ -372,12 +372,12 @@ jobs:

- name: E2E Test API
env:
TEST_MODE: "true"
TEST_MODE: 'true'
MONGO_URL: mongodb://localhost:27017/rocketchat
MONGO_OPLOG_URL: mongodb://localhost:27017/local
ENTERPRISE_LICENSE: ${{ secrets.ENTERPRISE_LICENSE }}
TRANSPORTER: nats://localhost:4222
SKIP_PROCESS_EVENT_REGISTRATION: "true"
SKIP_PROCESS_EVENT_REGISTRATION: 'true'
run: |
echo -e 'pcm.!default {\n type hw\n card 0\n}\n\nctl.!default {\n type hw\n card 0\n}' > ~/.asoundrc
Xvfb -screen 0 1024x768x24 :99 &
Expand All @@ -388,15 +388,15 @@ jobs:
- name: E2E Test UI (Legacy - Cypress)
env:
TEST_MODE: "true"
TEST_MODE: 'true'
MONGO_URL: mongodb://localhost:27017/rocketchat
MONGO_OPLOG_URL: mongodb://localhost:27017/local
ENTERPRISE_LICENSE: ${{ secrets.ENTERPRISE_LICENSE }}
TRANSPORTER: nats://localhost:4222
CYPRESS_BASE_URL: http://localhost:4000
CYPRESS_TEST_API_URL: http://localhost:4000
OVERWRITE_SETTING_Site_Url: http://localhost:4000
SKIP_PROCESS_EVENT_REGISTRATION: "true"
SKIP_PROCESS_EVENT_REGISTRATION: 'true'
run: |
echo -e 'pcm.!default {\n type hw\n card 0\n}\n\nctl.!default {\n type hw\n card 0\n}' > ~/.asoundrc
Xvfb -screen 0 1024x768x24 :99 &
Expand All @@ -412,15 +412,15 @@ jobs:
- name: E2E Test UI
env:
TEST_MODE: "true"
TEST_MODE: 'true'
MONGO_URL: mongodb://localhost:27017/rocketchat
MONGO_OPLOG_URL: mongodb://localhost:27017/local
ENTERPRISE_LICENSE: ${{ secrets.ENTERPRISE_LICENSE }}
TRANSPORTER: nats://localhost:4222
CYPRESS_BASE_URL: http://localhost:4000
CYPRESS_TEST_API_URL: http://localhost:4000
OVERWRITE_SETTING_Site_Url: http://localhost:4000
SKIP_PROCESS_EVENT_REGISTRATION: "true"
SKIP_PROCESS_EVENT_REGISTRATION: 'true'
run: |
echo -e 'pcm.!default {\n type hw\n card 0\n}\n\nctl.!default {\n type hw\n card 0\n}' > ~/.asoundrc
Xvfb -screen 0 1024x768x24 :99 &
Expand Down Expand Up @@ -469,7 +469,7 @@ jobs:

strategy:
matrix:
release: ["official", "preview"]
release: ['official', 'preview']

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -519,7 +519,7 @@ jobs:
- name: Use Node.js 14.18.3
uses: actions/setup-node@v3
with:
node-version: "14.18.3"
node-version: '14.18.3'

- name: Install Meteor
run: |
Expand Down Expand Up @@ -601,16 +601,27 @@ jobs:

strategy:
matrix:
service:
["ddp-streamer"]
service: ['ddp-streamer']

steps:
- uses: actions/checkout@v3

- name: Use Node.js 14.18.3
uses: actions/setup-node@v3
with:
node-version: "14.18.3"
node-version: '14.18.3'

- uses: c-hive/gha-yarn-cache@v2
- name: Cache turbo
id: cache-turbo
uses: actions/cache@v2
with:
path: |
./node_modules/.turbo
key: ${{ runner.OS }}-turbo-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-turbo-
${{ runner.os }}-
- name: Build Docker images
env:
Expand Down Expand Up @@ -670,7 +681,7 @@ jobs:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: "us-east-1"
AWS_DEFAULT_REGION: 'us-east-1'
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
REDHAT_REGISTRY_PID: ${{ secrets.REDHAT_REGISTRY_PID }}
REDHAT_REGISTRY_KEY: ${{ secrets.REDHAT_REGISTRY_KEY }}
Expand Down Expand Up @@ -738,10 +749,10 @@ jobs:
strategy:
matrix:
# this is current a mix of variants and different images
release: ["official", "preview", "alpine"]
release: ['official', 'preview', 'alpine']

env:
IMAGE_NAME: "rocketchat/rocket.chat"
IMAGE_NAME: 'rocketchat/rocket.chat'

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -844,16 +855,26 @@ jobs:

strategy:
matrix:
service:
["account", "authorization", "ddp-streamer", "presence", "stream-hub"]
service: ['account', 'authorization', 'ddp-streamer', 'presence', 'stream-hub']

steps:
- uses: actions/checkout@v3

- name: Use Node.js 14.18.3
uses: actions/setup-node@v3
with:
node-version: "14.18.3"
node-version: '14.18.3'
- uses: c-hive/gha-yarn-cache@v2
- name: Cache turbo
id: cache-turbo
uses: actions/cache@v2
with:
path: |
./node_modules/.turbo
key: ${{ runner.OS }}-turbo-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-turbo-
${{ runner.os }}-
- name: Login to DockerHub
uses: docker/login-action@v1
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/api/server/v1/channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ API.v1.addRoute(
checkedArchived: false,
});

if (findResult.broadcast && !hasPermission(this.userId, 'view-broadcast-member-list')) {
if (findResult.broadcast && !hasPermission(this.userId, 'view-broadcast-member-list', findResult._id)) {
return API.v1.unauthorized();
}

Expand Down
8 changes: 4 additions & 4 deletions apps/meteor/app/authorization/client/hasRole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import type { IUser, IRole, IRoom } from '@rocket.chat/core-typings';

import { Roles } from '../../models/client';

export const hasRole = (userId: IUser['_id'], roleId: IRole['_id'], scope?: IRoom['_id']): boolean => {
export const hasRole = (userId: IUser['_id'], roleId: IRole['_id'], scope?: IRoom['_id'], ignoreSubscriptions = false): boolean => {
if (Array.isArray(roleId)) {
throw new Error('error-invalid-arguments');
}

return Roles.isUserInRoles(userId, [roleId], scope);
return Roles.isUserInRoles(userId, [roleId], scope, ignoreSubscriptions);
};

export const hasAnyRole = (userId: IUser['_id'], roleIds: IRole['_id'][], scope?: IRoom['_id']): boolean => {
export const hasAnyRole = (userId: IUser['_id'], roleIds: IRole['_id'][], scope?: IRoom['_id'], ignoreSubscriptions = false): boolean => {
if (!Array.isArray(roleIds)) {
throw new Error('error-invalid-arguments');
}

return Roles.isUserInRoles(userId, roleIds, scope);
return Roles.isUserInRoles(userId, roleIds, scope, ignoreSubscriptions);
};
26 changes: 19 additions & 7 deletions apps/meteor/app/federation-v2/server/bridge.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Bridge as MatrixBridge, AppServiceRegistration } from '@rocket.chat/forked-matrix-appservice-bridge';
import type { Bridge as MatrixBridge } from '@rocket.chat/forked-matrix-appservice-bridge';

import { settings } from '../../settings/server';
import { IMatrixEvent } from './definitions/IMatrixEvent';
import { MatrixEventType } from './definitions/MatrixEventType';
import { Settings } from '../../models/server/raw';
import type { IMatrixEvent } from './definitions/IMatrixEvent';
import type { MatrixEventType } from './definitions/MatrixEventType';
import { addToQueue } from './queue';
import { getRegistrationInfo } from './config';
import { bridgeLogger } from './logger';

class Bridge {
private bridgeInstance: MatrixBridge;
Expand All @@ -14,12 +16,17 @@ class Bridge {
public async start(): Promise<void> {
try {
await this.stop();
} finally {
this.createInstance();
await this.createInstance();

if (!this.isRunning) {
await this.bridgeInstance.run(this.getBridgePort());
this.isRunning = true;
}
} catch (e) {
bridgeLogger.error('Failed to initialize the matrix-appservice-bridge.', e);

bridgeLogger.error('Disabling Matrix Bridge. Please resolve error and try again');
Settings.updateValueById('Federation_Matrix_enabled', false);
}
}

Expand All @@ -28,15 +35,20 @@ class Bridge {
return;
}
// the http server can take some minutes to shutdown and this promise to be resolved
await this.bridgeInstance.close();
await this.bridgeInstance?.close();
this.isRunning = false;
}

public getInstance(): MatrixBridge {
return this.bridgeInstance;
}

private createInstance(): void {
private async createInstance(): Promise<void> {
bridgeLogger.info('Performing Dynamic Import of matrix-appservice-bridge');

// Dynamic import to prevent Rocket.Chat from loading the module until needed and then handle if that fails
const { Bridge: MatrixBridge, AppServiceRegistration } = await import('@rocket.chat/forked-matrix-appservice-bridge');

this.bridgeInstance = new MatrixBridge({
homeserverUrl: settings.get('Federation_Matrix_homeserver_url'),
domain: settings.get('Federation_Matrix_homeserver_domain'),
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/federation-v2/server/matrix-client/user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MatrixProfileInfo } from '@rocket.chat/forked-matrix-bot-sdk';
import type { MatrixProfileInfo } from '@rocket.chat/forked-matrix-bot-sdk';
import { IUser } from '@rocket.chat/core-typings';

import { matrixBridge } from '../bridge';
Expand Down
5 changes: 3 additions & 2 deletions apps/meteor/app/importer-csv/server/importer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Random } from 'meteor/random';

import { Base, ProgressStep, ImporterWebsocket } from '../../importer/server';
import { Users } from '../../models/server';
import { Users, Settings as SettingsRaw } from '../../models/server';

export class CsvImporter extends Base {
constructor(info, importRecord) {
Expand Down Expand Up @@ -119,7 +119,8 @@ export class CsvImporter extends Base {
});
}

super.updateRecord({ 'count.users': parsedUsers.length });
SettingsRaw.incrementValueById('CSV_Importer_Count', usersCount);
super.updateRecord({ 'count.users': usersCount });
return increaseProgressCount();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import fs from 'fs';
import { Meteor } from 'meteor/meteor';

import { Base, ProgressStep } from '../../importer/server';
import { Settings as SettingsRaw } from '../../models/server';

export class HipChatEnterpriseImporter extends Base {
constructor(info, importRecord) {
Expand Down Expand Up @@ -52,6 +53,7 @@ export class HipChatEnterpriseImporter extends Base {
this.converter.addUser(newUser);
}

SettingsRaw.incrementValueById('Hipchat_Enterprise_Importer_Count', count);
super.updateRecord({ 'count.users': count });
super.addCountToTotal(count);
}
Expand Down
2 changes: 2 additions & 0 deletions apps/meteor/app/importer-slack-users/server/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Random } from 'meteor/random';
import { RawImports, Base, ProgressStep, Selection, SelectionUser } from '../../importer/server';
import { RocketChatFile } from '../../file';
import { Users } from '../../models';
import { Settings as SettingsRaw } from '../../models/server';

export class SlackUsersImporter extends Base {
constructor(info, importRecord) {
Expand Down Expand Up @@ -164,6 +165,7 @@ export class SlackUsersImporter extends Base {
});
}

SettingsRaw.incrementValueById('Slack_Users_Importer_Count', this.users.users.length);
super.updateProgress(ProgressStep.FINISHING);
super.updateProgress(ProgressStep.DONE);
} catch (e) {
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/app/importer-slack/server/importer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'underscore';

import { Base, ProgressStep, ImporterWebsocket } from '../../importer/server';
import { Messages, ImportData } from '../../models/server';
import { Messages, ImportData, Settings as SettingsRaw } from '../../models/server';
import { settings } from '../../settings/server';
import { MentionsParser } from '../../mentions/lib/MentionsParser';
import { getUserAvatarURL } from '../../utils/lib/getUserAvatarURL';
Expand Down Expand Up @@ -155,6 +155,7 @@ export class SlackImporter extends Base {
}

this.converter.addUser(newUser);
SettingsRaw.incrementValueById('Slack_Importer_Count');
}
}

Expand Down
Loading

0 comments on commit 752737a

Please sign in to comment.