Skip to content

Commit

Permalink
Merge branch 'develop' into fix/join-code-editing-user
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Apr 26, 2024
2 parents 84fcdaa + 105a1eb commit bb3c5e9
Show file tree
Hide file tree
Showing 264 changed files with 4,793 additions and 1,263 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-starfishes-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes error `audio.pause() is not a function` and makes the continuous new room notification (livechat) respect the volume set in user preferences.
13 changes: 13 additions & 0 deletions .changeset/chilly-walls-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@rocket.chat/meteor': patch
---

Fixed an issue while creating tokens via the special `users.createToken` API was not respecting the maximum login tokens allowed for a user.

The following endpoint was deprecated and will be removed on version `8.0.0`:

- `/api/v1/users.createToken`

The following Meteor method (realtime API) was deprecated and will be removed on version `8.0.0`:

- `createToken`
5 changes: 5 additions & 0 deletions .changeset/eighty-pans-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Force logout the clients which are actively online, whenever a user resets E2EE keys.
5 changes: 5 additions & 0 deletions .changeset/eleven-news-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed issue with login via SAML not redirecting to invite link
6 changes: 6 additions & 0 deletions .changeset/fifty-cups-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": minor
"@rocket.chat/rest-typings": minor
---

Created a new endpoint to get a filtered and paginated list of users.
5 changes: 5 additions & 0 deletions .changeset/fifty-planets-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Deprecate muteUserInRoom and unmuteUserInRoom meteor methods
5 changes: 5 additions & 0 deletions .changeset/flat-socks-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed wrong `Business hours` validations between different weeks
7 changes: 7 additions & 0 deletions .changeset/four-eyes-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@rocket.chat/meteor": minor
"@rocket.chat/core-typings": minor
"@rocket.chat/i18n": minor
---

Allow Custom Fields in Messages. API-only feature. It can be enabled and configured in Workspace Settings.
5 changes: 5 additions & 0 deletions .changeset/great-moles-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': minor
---

Encrypt file descriptions in E2EE rooms
5 changes: 5 additions & 0 deletions .changeset/heavy-singers-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes an issue where the last threads list item wasn't displaying properly
6 changes: 6 additions & 0 deletions .changeset/lovely-trainers-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/rest-typings': minor
'@rocket.chat/meteor': minor
---

Convert mute/unmute meteor methods to endpoints
7 changes: 7 additions & 0 deletions .changeset/nervous-elephants-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@rocket.chat/model-typings': minor
'@rocket.chat/i18n': minor
'@rocket.chat/meteor': minor
---

Added a new setting to automatically disable users from LDAP that can no longer be found by the background sync
5 changes: 5 additions & 0 deletions .changeset/old-geckos-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': minor
---

Added the ability to serve .well-known paths directly from Rocket.Chat, if using federation, removing the need for special reverse proxy configuration or another component layer for specific types of reverse proxies / loadbalancers.
6 changes: 6 additions & 0 deletions .changeset/pink-parrots-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": minor
"@rocket.chat/rest-typings": minor
---

Created a new endpoint to resend the welcome email to a given user
8 changes: 8 additions & 0 deletions .changeset/popular-fishes-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@rocket.chat/meteor": patch
---

**Fixed settings-related statistics not being updated according to the license.**

We've identified an issue where certain statistics were not reflecting recent license changes. This resulted in outdated information being reported for workspaces.
This change ensures that all reported statistics are current and consider the workspace license.
5 changes: 5 additions & 0 deletions .changeset/proud-experts-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed a language priority issue. It should now respect the following order: User Preference -> Browser Language -> Server Language
5 changes: 5 additions & 0 deletions .changeset/silent-dodos-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": minor
---

Added a new notification provider in light of the old FCM API deprecation, now you can choose to use the new provider or the old via the `Push_UseLegacy` setting
5 changes: 5 additions & 0 deletions .changeset/strange-comics-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed an issue where an endpoint was called before checking configuration that enables automatic translation when launching the application
6 changes: 6 additions & 0 deletions .changeset/strange-countries-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": patch
"@rocket.chat/core-services": patch
---

Fixed a problem that caused OTR Session messages' to not being transmitted from one peer to another when running Rocket.Chat as microservices. This was caused by a legacy streamer that tried to use the websocket directly, which works on monolith but doesn't on microservices, cause these events are routed through DDP Streamer service.
5 changes: 5 additions & 0 deletions .changeset/tame-ducks-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed a problem that caused `afterCreateUser` callback to be called without new user's roles inside. This caused Omnichannel Business Hour manager to ignore these users from assigning open business hours until the manager restarted or the business hour restarted.
5 changes: 5 additions & 0 deletions .changeset/thirty-hotels-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': minor
---

Redesign Save E2EE password modal
5 changes: 5 additions & 0 deletions .changeset/tough-boats-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": minor
---

Support Message Custom Fields on upload API via field `customField` and JSON value
5 changes: 5 additions & 0 deletions .changeset/yellow-lies-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

fixed Engagement Dashboard and Device Management admin pages loading indefinitely
6 changes: 6 additions & 0 deletions .changeset/young-candles-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/ui-contexts': minor
'@rocket.chat/meteor': minor
---

Fixed an issue affecting the update modal/contextual bar by apps when it comes to error handling and regular surface update
2 changes: 1 addition & 1 deletion .github/workflows/ci-test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
mongodb-version: ${{ fromJSON(inputs.mongodb-version) }}
shard: ${{ fromJSON(inputs.shard) }}

name: MongoDB ${{ matrix.mongodb-version }} (${{ matrix.shard }}/${{ inputs.total-shard }})
name: MongoDB ${{ matrix.mongodb-version }} (${{ matrix.shard }}/${{ inputs.total-shard }})${{ matrix.mongodb-version == '6.0' && ' - Alpine' || '' }}

steps:
- name: Login to GitHub Container Registry
Expand Down
5 changes: 5 additions & 0 deletions apps/meteor/.meteorMocks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sinon from 'sinon';

export const Meteor = {
loginWithSamlToken: sinon.stub(),
};
46 changes: 46 additions & 0 deletions apps/meteor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# @rocket.chat/meteor

## 6.7.1

### Patch Changes

- Bump @rocket.chat/meteor version.

- Bump @rocket.chat/meteor version.

- ([#32253](https://github.com/RocketChat/Rocket.Chat/pull/32253)) Increased the timeout between calls for the three remaining Omnichannel Agenda Jobs. This should make them happen less often and reduce the load on MongoDB

- ([#32252](https://github.com/RocketChat/Rocket.Chat/pull/32252)) Fixes an issue that forces the focus on the last message when interacting by mouse on message list

- ([#32256](https://github.com/RocketChat/Rocket.Chat/pull/32256)) Fixed open expanded view (galery mode) for image attachments sent by livechat widget

- ([#32254](https://github.com/RocketChat/Rocket.Chat/pull/32254)) Fixed an issue where Rocket.Chat would ask admins to confirm fingerprint change (new workspace vs configuration update), even when `AUTO_ACCEPT_FINGERPRINT` environment variable set to `"true"`.

- ([#32265](https://github.com/RocketChat/Rocket.Chat/pull/32265)) Fixed supported versions not being updated in airgapped environments

- ([#32251](https://github.com/RocketChat/Rocket.Chat/pull/32251)) Fixes an issue where message reactions are vertically misaligned when zooming out

- <details><summary>Updated dependencies []:</summary>

- @rocket.chat/core-typings@6.7.1
- @rocket.chat/rest-typings@6.7.1
- @rocket.chat/api-client@0.1.30
- @rocket.chat/license@0.1.12
- @rocket.chat/omnichannel-services@0.1.12
- @rocket.chat/pdf-worker@0.0.36
- @rocket.chat/presence@0.1.12
- @rocket.chat/apps@0.0.3
- @rocket.chat/core-services@0.3.12
- @rocket.chat/cron@0.0.32
- @rocket.chat/gazzodown@5.0.1
- @rocket.chat/model-typings@0.3.8
- @rocket.chat/ui-contexts@5.0.1
- @rocket.chat/server-cloud-communication@0.0.2
- @rocket.chat/fuselage-ui-kit@5.0.1
- @rocket.chat/models@0.0.36
- @rocket.chat/ui-theming@0.1.2
- @rocket.chat/ui-avatar@1.0.1
- @rocket.chat/ui-client@5.0.1
- @rocket.chat/ui-video-conf@5.0.1
- @rocket.chat/web-ui-registration@5.0.1
- @rocket.chat/instance-status@0.0.36
</details>

## 6.7.0

### Minor Changes
Expand Down
6 changes: 6 additions & 0 deletions apps/meteor/app/api/server/api.helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { IUser } from '@rocket.chat/core-typings';

import { hasAllPermissionAsync, hasAtLeastOnePermissionAsync } from '../../authorization/server/functions/hasPermission';
import { apiDeprecationLogger } from '../../lib/server/lib/deprecationWarningLogger';

type RequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | '*';
export type PermissionsPayload = {
Expand Down Expand Up @@ -101,3 +102,8 @@ export function checkPermissions(options: { permissionsRequired?: PermissionsReq
// If reached here, options.permissionsRequired contained an invalid payload
return false;
}

export function parseDeprecation(methodThis: any, { alternatives, version }: { version: string; alternatives?: string[] }): void {
const infoMessage = alternatives?.length ? ` Please use the alternative(s): ${alternatives.join(',')}` : '';
apiDeprecationLogger.endpoint(methodThis.request.route, version, methodThis.response, infoMessage);
}
7 changes: 3 additions & 4 deletions apps/meteor/app/api/server/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ import { isObject } from '../../../lib/utils/isObject';
import { getRestPayload } from '../../../server/lib/logger/logPayloads';
import { checkCodeForUser } from '../../2fa/server/code';
import { hasPermissionAsync } from '../../authorization/server/functions/hasPermission';
import { apiDeprecationLogger } from '../../lib/server/lib/deprecationWarningLogger';
import { metrics } from '../../metrics/server';
import { settings } from '../../settings/server';
import { getDefaultUserFields } from '../../utils/server/functions/getDefaultUserFields';
import type { PermissionsPayload } from './api.helpers';
import { checkPermissionsForInvocation, checkPermissions } from './api.helpers';
import { checkPermissionsForInvocation, checkPermissions, parseDeprecation } from './api.helpers';
import type {
FailureResult,
InternalError,
Expand Down Expand Up @@ -588,8 +587,8 @@ export class APIClass<TBasePath extends string = ''> extends Restivus {
const connection = { ...generateConnection(this.requestIp, this.request.headers), token: this.token };

try {
if (options.deprecationVersion) {
apiDeprecationLogger.endpoint(this.request.route, options.deprecationVersion, this.response, options.deprecationInfo || '');
if (options.deprecation) {
parseDeprecation(this, options.deprecation);
}

await api.enforceRateLimit(objectForRateLimitMatch, this.request, this.response, this.userId);
Expand Down
6 changes: 4 additions & 2 deletions apps/meteor/app/api/server/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ export type Options = (
) & {
validateParams?: ValidateFunction | { [key in Method]?: ValidateFunction };
authOrAnonRequired?: true;
deprecationVersion?: string;
deprecationInfo?: string;
deprecation?: {
version: string;
alternatives?: string[];
};
};

export type PartialThis = {
Expand Down
97 changes: 96 additions & 1 deletion apps/meteor/app/api/server/lib/users.ts
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 { Users, Subscriptions } from '@rocket.chat/models';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import type { Mongo } from 'meteor/mongo';
import type { Filter } from 'mongodb';
import type { Filter, RootFilterOperators } from 'mongodb';

import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { settings } from '../../../settings/server';
Expand Down Expand Up @@ -119,3 +119,98 @@ export function getNonEmptyQuery<T extends IUser>(query: Mongo.Query<T> | undefi

return { ...defaultQuery, ...query };
}

type FindPaginatedUsersByStatusProps = {
uid: string;
offset: number;
count: number;
sort: Record<string, 1 | -1>;
status: 'active' | 'deactivated';
roles: string[] | null;
searchTerm: string;
hasLoggedIn: boolean;
type: string;
};

export async function findPaginatedUsersByStatus({
uid,
offset,
count,
sort,
status,
roles,
searchTerm,
hasLoggedIn,
type,
}: FindPaginatedUsersByStatusProps) {
const projection = {
name: 1,
username: 1,
emails: 1,
roles: 1,
status: 1,
active: 1,
avatarETag: 1,
lastLogin: 1,
type: 1,
reason: 1,
};

const actualSort: Record<string, 1 | -1> = sort || { username: 1 };
if (sort?.status) {
actualSort.active = sort.status;
}
if (sort?.name) {
actualSort.nameInsensitive = sort.name;
}
const match: Filter<IUser & RootFilterOperators<IUser>> = {};
switch (status) {
case 'active':
match.active = true;
break;
case 'deactivated':
match.active = false;
break;
}

if (hasLoggedIn !== undefined) {
match.lastLogin = { $exists: hasLoggedIn };
}

if (type) {
match.type = type;
}

const canSeeAllUserInfo = await hasPermissionAsync(uid, 'view-full-other-user-info');

match.$or = [
...(canSeeAllUserInfo ? [{ 'emails.address': { $regex: escapeRegExp(searchTerm || ''), $options: 'i' } }] : []),
{
username: { $regex: escapeRegExp(searchTerm || ''), $options: 'i' },
},
{
name: { $regex: escapeRegExp(searchTerm || ''), $options: 'i' },
},
];
if (roles?.length && !roles.includes('all')) {
match.roles = { $in: roles };
}
const { cursor, totalCount } = await Users.findPaginated(
{
...match,
},
{
sort: actualSort,
skip: offset,
limit: count,
projection,
},
);
const [users, total] = await Promise.all([cursor.toArray(), totalCount]);
return {
users,
count: users.length,
offset,
total,
};
}
Loading

0 comments on commit bb3c5e9

Please sign in to comment.