Skip to content

Commit

Permalink
Merge branch 'develop' into chore/remove-setUserActiveStatus-method
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Oct 29, 2024
2 parents 9efb4ff + 5c428df commit 00c6e6b
Show file tree
Hide file tree
Showing 436 changed files with 4,932 additions and 3,031 deletions.
5 changes: 5 additions & 0 deletions .changeset/bump-patch-1730152400673.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Bump @rocket.chat/meteor version.
13 changes: 13 additions & 0 deletions .changeset/eleven-chefs-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@rocket.chat/meteor': major
---

Remove support of filtering by agent's username on the following endpoint:

- `/v1/livechat/rooms`

The performance of the endpoint was improved when filtering by:

- Agent
- Deparment
- Open chats
6 changes: 6 additions & 0 deletions .changeset/fuzzy-ants-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/rest-typings': major
'@rocket.chat/meteor': major
---

Changes groups messages listing endpoint by moving query params from the 'query' attribute to standard query parameters.
6 changes: 6 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"bump-patch-1729648473274",
"bump-patch-1729717124346",
"bump-patch-1729881407116",
"bump-patch-1730152400673",
"chilled-boats-sip",
"chilled-files-relate",
"chilly-flowers-brake",
Expand All @@ -81,6 +82,7 @@
"dull-singers-move",
"e2ee-composer-freeze",
"e2ee-modal-keys",
"eleven-chefs-grin",
"fair-bees-wash",
"fair-seahorses-laugh",
"fifty-mails-admire",
Expand All @@ -91,6 +93,7 @@
"forty-pants-roll",
"four-experts-compare",
"four-snakes-deny",
"fuzzy-ants-heal",
"fuzzy-cherries-buy",
"gentle-kings-greet",
"giant-spiders-train",
Expand Down Expand Up @@ -129,6 +132,7 @@
"purple-papayas-collect",
"purple-tools-heal",
"quick-moles-jump",
"quiet-jokes-add",
"quiet-kings-rhyme",
"rare-hats-lie",
"real-avocados-sneeze",
Expand All @@ -138,6 +142,7 @@
"selfish-experts-develop",
"selfish-schools-leave",
"seven-hotels-collect",
"shaggy-timers-warn",
"sharp-adults-think",
"sharp-forks-give",
"shiny-falcons-vanish",
Expand Down Expand Up @@ -165,6 +170,7 @@
"three-avocados-search",
"three-crews-allow",
"tidy-suns-move",
"tiny-rabbits-lie",
"tiny-rice-train",
"tough-rings-kneel",
"tricky-horses-swim",
Expand Down
6 changes: 6 additions & 0 deletions .changeset/quiet-jokes-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/rest-typings': major
'@rocket.chat/meteor': major
---

Changes channels messages listing endpoint by moving query params from the 'query' attribute to standard query parameters.
6 changes: 6 additions & 0 deletions .changeset/shaggy-timers-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/rest-typings': major
'@rocket.chat/meteor': major
---

Changes settings public listing endpoint by moving query params from the 'query' attribute to standard query parameters.
6 changes: 6 additions & 0 deletions .changeset/tiny-rabbits-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket.chat/rest-typings': major
'@rocket.chat/meteor': major
---

Changes ims and dms messages listing endpoint by moving query params from the 'query' attribute to standard query parameters.
2 changes: 1 addition & 1 deletion .github/workflows/ci-test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:
path: |
~/.cache/ms-playwright
# This is the version of Playwright that we are using, if you are willing to upgrade, you should update this.
key: playwright-1.40.1
key: playwright-1.48.2

- name: Install Playwright
if: inputs.type == 'ui' && steps.cache-playwright.outputs.cache-hit != 'true'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ yarn turbo run ms

After initialized, you can access the server at http://localhost:4000

> ⚠️ Check more detailed information in the [Rocket.Chat Environment Setup](https://developer.rocket.chat/rocket.chat/rocket-chat-environment-setup) guide
> ⚠️ Check more detailed information in the [Rocket.Chat Environment Setup](https://developer.rocket.chat/docs/server-environment-setup) guide
# 💻 Installation

Expand Down
1 change: 1 addition & 0 deletions apps/meteor/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
!/.storybook/
!/client/.eslintrc.js
!/ee/client/.eslintrc.js
/storybook-static/
1 change: 1 addition & 0 deletions apps/meteor/.stylelintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
app/theme/client/vendor/fontello/css/fontello.css
app/meteor-autocomplete/client/autocomplete.css
app/emoji-emojione/client/*.css
storybook-static
55 changes: 55 additions & 0 deletions apps/meteor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,60 @@
# @rocket.chat/meteor

## 7.0.0-rc.5

### Major Changes

- ([#33038](https://github.com/RocketChat/Rocket.Chat/pull/33038)) Remove support of filtering by agent's username on the following endpoint:

- `/v1/livechat/rooms`

The performance of the endpoint was improved when filtering by:

- Agent
- Deparment
- Open chats

- ([#33802](https://github.com/RocketChat/Rocket.Chat/pull/33802)) Changes groups messages listing endpoint by moving query params from the 'query' attribute to standard query parameters.

- ([#33801](https://github.com/RocketChat/Rocket.Chat/pull/33801)) Changes channels messages listing endpoint by moving query params from the 'query' attribute to standard query parameters.

- ([#33787](https://github.com/RocketChat/Rocket.Chat/pull/33787)) Changes settings public listing endpoint by moving query params from the 'query' attribute to standard query parameters.

- ([#33807](https://github.com/RocketChat/Rocket.Chat/pull/33807)) Changes ims and dms messages listing endpoint by moving query params from the 'query' attribute to standard query parameters.

### Patch Changes

- Bump @rocket.chat/meteor version.

- <details><summary>Updated dependencies [d1e14a0a85, bf05700542, 1bdfd201b1, 2bc9692de0]:</summary>

- @rocket.chat/rest-typings@7.0.0-rc.5
- @rocket.chat/omnichannel-services@0.3.6-rc.5
- @rocket.chat/presence@0.2.9-rc.5
- @rocket.chat/api-client@0.2.9-rc.5
- @rocket.chat/core-services@0.7.1-rc.5
- @rocket.chat/ui-contexts@12.0.0-rc.5
- @rocket.chat/network-broker@0.1.1-rc.5
- @rocket.chat/ui-theming@0.4.0-rc.0
- @rocket.chat/fuselage-ui-kit@12.0.0-rc.5
- @rocket.chat/gazzodown@12.0.0-rc.5
- @rocket.chat/ui-avatar@8.0.0-rc.5
- @rocket.chat/ui-client@12.0.0-rc.5
- @rocket.chat/ui-video-conf@12.0.0-rc.5
- @rocket.chat/ui-voip@2.0.0-rc.5
- @rocket.chat/web-ui-registration@12.0.0-rc.5
- @rocket.chat/core-typings@7.0.0-rc.5
- @rocket.chat/license@1.0.0-rc.5
- @rocket.chat/pdf-worker@0.2.6-rc.5
- @rocket.chat/apps@0.2.0-rc.5
- @rocket.chat/cron@0.1.9-rc.5
- @rocket.chat/freeswitch@1.0.0-rc.5
- @rocket.chat/model-typings@1.0.0-rc.5
- @rocket.chat/server-cloud-communication@0.0.2
- @rocket.chat/models@1.0.0-rc.5
- @rocket.chat/instance-status@0.1.9-rc.5
</details>

## 7.0.0-rc.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/2fa/server/loginHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ OAuth._retrievePendingCredential = async function (key, ...args): Promise<string
const future = new Date();
future.setMinutes(future.getMinutes() + 2);

OAuth._pendingCredentials.update(
await OAuth._pendingCredentials.updateAsync(
{
_id: pendingCredential._id,
},
Expand Down
11 changes: 7 additions & 4 deletions apps/meteor/app/api/server/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,13 @@ export class APIClass<TBasePath extends string = ''> extends Restivus {
}

public setLimitedCustomFields(customFields: string[]): void {
const nonPublicFieds = customFields.reduce((acc, customField) => {
acc[`customFields.${customField}`] = 0;
return acc;
}, {} as Record<string, any>);
const nonPublicFieds = customFields.reduce(
(acc, customField) => {
acc[`customFields.${customField}`] = 0;
return acc;
},
{} as Record<string, any>,
);
this.limitedUserFieldsToExclude = {
...this.defaultLimitedUserFieldsToExclude,
...nonPublicFieds,
Expand Down
40 changes: 20 additions & 20 deletions apps/meteor/app/api/server/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type FailureResult<T, TStack = undefined, TErrorType = undefined, TErrorD
errorType?: TErrorType;
details?: TErrorDetails;
message?: string;
} & (undefined extends TErrorType ? object : { errorType: TErrorType }) &
} & (undefined extends TErrorType ? object : { errorType: TErrorType }) &
(undefined extends TErrorDetails ? object : { details: TErrorDetails extends string ? unknown : TErrorDetails });
};

Expand Down Expand Up @@ -130,20 +130,20 @@ export type ActionThis<TMethod extends Method, TPathPattern extends PathPattern,
? TOptions extends { validateParams: ValidateFunction<infer T> }
? T
: TOptions extends { validateParams: { GET: ValidateFunction<infer T> } }
? T
: Partial<OperationParams<TMethod, TPathPattern>> & { offset?: number; count?: number }
? T
: Partial<OperationParams<TMethod, TPathPattern>> & { offset?: number; count?: number }
: Record<string, string>;
// TODO make it unsafe
readonly bodyParams: TMethod extends 'GET'
? Record<string, unknown>
: TOptions extends { validateParams: ValidateFunction<infer T> }
? T
: TOptions extends { validateParams: infer V }
? V extends { [key in TMethod]: ValidateFunction<infer T> }
? T
: Partial<OperationParams<TMethod, TPathPattern>>
: // TODO remove the extra (optionals) params when all the endpoints that use these are typed correctly
Partial<OperationParams<TMethod, TPathPattern>>;
: TOptions extends { validateParams: infer V }
? V extends { [key in TMethod]: ValidateFunction<infer T> }
? T
: Partial<OperationParams<TMethod, TPathPattern>>
: // TODO remove the extra (optionals) params when all the endpoints that use these are typed correctly
Partial<OperationParams<TMethod, TPathPattern>>;
readonly request: Request;

readonly queryOperations: TOptions extends { queryOperations: infer T } ? T : never;
Expand All @@ -163,18 +163,18 @@ export type ActionThis<TMethod extends Method, TPathPattern extends PathPattern,
user: IUser;
userId: string;
readonly token: string;
}
}
: TOptions extends { authOrAnonRequired: true }
? {
user?: IUser;
userId?: string;
readonly token?: string;
}
: {
user?: IUser | null;
userId?: string | undefined;
readonly token?: string;
});
? {
user?: IUser;
userId?: string;
readonly token?: string;
}
: {
user?: IUser | null;
userId?: string | undefined;
readonly token?: string;
});

export type ResultFor<TMethod extends Method, TPathPattern extends PathPattern> =
| SuccessResult<OperationResult<TMethod, TPathPattern>>
Expand Down
20 changes: 15 additions & 5 deletions apps/meteor/app/api/server/v1/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,25 @@ API.v1.addRoute(
},
{
async get() {
const { roomId } = this.queryParams;
const { roomId, mentionIds, starredIds, pinned } = this.queryParams;
const { offset, count } = await getPaginationItems(this.queryParams);
const { sort, fields, query } = await this.parseJsonQuery();

const findResult = await findChannelByIdOrName({
params: { roomId },
checkedArchived: false,
});
const { offset, count } = await getPaginationItems(this.queryParams);
const { sort, fields, query } = await this.parseJsonQuery();

const ourQuery = { ...query, rid: findResult._id };
const parseIds = (ids: string | undefined, field: string) =>
typeof ids === 'string' && ids ? { [field]: { $in: ids.split(',').map((id) => id.trim()) } } : {};

const ourQuery = {
...query,
rid: findResult._id,
...parseIds(mentionIds, 'mentions._id'),
...parseIds(starredIds, 'starred._id'),
...(pinned && pinned.toLowerCase() === 'true' ? { pinned: true } : {}),
};

// Special check for the permissions
if (
Expand All @@ -297,7 +307,7 @@ API.v1.addRoute(
return API.v1.unauthorized();
}

const { cursor, totalCount } = await Messages.findPaginated(ourQuery, {
const { cursor, totalCount } = Messages.findPaginated(ourQuery, {
sort: sort || { ts: -1 },
skip: offset,
limit: count,
Expand Down
21 changes: 16 additions & 5 deletions apps/meteor/app/api/server/v1/groups.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Team, isMeteorError } from '@rocket.chat/core-services';
import type { IIntegration, IUser, IRoom, RoomType } from '@rocket.chat/core-typings';
import { Integrations, Messages, Rooms, Subscriptions, Uploads, Users } from '@rocket.chat/models';
import { isGroupsOnlineProps } from '@rocket.chat/rest-typings';
import { isGroupsOnlineProps, isGroupsMessagesProps } from '@rocket.chat/rest-typings';
import { check, Match } from 'meteor/check';
import { Meteor } from 'meteor/meteor';
import type { Filter } from 'mongodb';
Expand Down Expand Up @@ -746,19 +746,30 @@ API.v1.addRoute(

API.v1.addRoute(
'groups.messages',
{ authRequired: true },
{ authRequired: true, validateParams: isGroupsMessagesProps },
{
async get() {
const { roomId, mentionIds, starredIds, pinned } = this.queryParams;

const findResult = await findPrivateGroupByIdOrName({
params: this.queryParams,
params: { roomId },
userId: this.userId,
});
const { offset, count } = await getPaginationItems(this.queryParams);
const { sort, fields, query } = await this.parseJsonQuery();

const ourQuery = Object.assign({}, query, { rid: findResult.rid });
const parseIds = (ids: string | undefined, field: string) =>
typeof ids === 'string' && ids ? { [field]: { $in: ids.split(',').map((id) => id.trim()) } } : {};

const ourQuery = {
...query,
rid: findResult.rid,
...parseIds(mentionIds, 'mentions._id'),
...parseIds(starredIds, 'starred._id'),
...(pinned && pinned.toLowerCase() === 'true' ? { pinned: true } : {}),
};

const { cursor, totalCount } = await Messages.findPaginated(ourQuery, {
const { cursor, totalCount } = Messages.findPaginated(ourQuery, {
sort: sort || { ts: -1 },
skip: offset,
limit: count,
Expand Down
15 changes: 13 additions & 2 deletions apps/meteor/app/api/server/v1/im.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,9 @@ API.v1.addRoute(
},
{
async get() {
const { room } = await findDirectMessageRoom(this.queryParams, this.userId);
const { roomId, username, mentionIds, starredIds, pinned } = this.queryParams;

const { room } = await findDirectMessageRoom({ ...(roomId ? { roomId } : { username }) }, this.userId);

const canAccess = await canAccessRoomIdAsync(room._id, this.userId);
if (!canAccess) {
Expand All @@ -388,7 +390,16 @@ API.v1.addRoute(
const { offset, count } = await getPaginationItems(this.queryParams);
const { sort, fields, query } = await this.parseJsonQuery();

const ourQuery = { rid: room._id, ...query };
const parseIds = (ids: string | undefined, field: string) =>
typeof ids === 'string' && ids ? { [field]: { $in: ids.split(',').map((id) => id.trim()) } } : {};

const ourQuery = {
rid: room._id,
...query,
...parseIds(mentionIds, 'mentions._id'),
...parseIds(starredIds, 'starred._id'),
...(pinned && pinned.toLowerCase() === 'true' ? { pinned: true } : {}),
};
const sortObj = { ts: sort?.ts ?? -1 };

const { cursor, totalCount } = Messages.findPaginated(ourQuery, {
Expand Down
Loading

0 comments on commit 00c6e6b

Please sign in to comment.