Skip to content

Commit 5cc644a

Browse files
authored
Merge branch 'develop' into fix/apps-prevent-whole-update
2 parents e31f110 + ed3f483 commit 5cc644a

File tree

57 files changed

+2636
-278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2636
-278
lines changed

.changeset/chilly-sheep-cover.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@rocket.chat/rest-typings': minor
3+
'@rocket.chat/models': minor
4+
'@rocket.chat/i18n': minor
5+
'@rocket.chat/meteor': minor
6+
---
7+
8+
Adds a new endpoint `rooms.hide` to hide rooms of any type when provided with the room's ID

.changeset/cool-coins-agree.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@rocket.chat/meteor": patch
3+
"@rocket.chat/model-typings": patch
4+
"@rocket.chat/models": patch
5+
---
6+
7+
Fixes a bug that caused routing algorithms to ignore the `Livechat_enabled_when_agent_idle` setting, effectively ignoring idle users from being assigned to inquiries.

.changeset/happy-nails-fry.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@rocket.chat/meteor": minor
3+
"@rocket.chat/apps-engine": minor
4+
"@rocket.chat/apps": minor
5+
---
6+
7+
Adds a new IPostSystemMessageSent event, that is triggered whenever a new System Message is sent

.changeset/light-yaks-drive.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@rocket.chat/i18n': minor
3+
'@rocket.chat/meteor': minor
4+
---
5+
6+
Implements a modal to let users know about VoIP calls in direct messages and missing configurations.

apps/meteor/app/api/server/v1/channels.ts

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Team, Room } from '@rocket.chat/core-services';
2-
import type { IRoom, ISubscription, IUser, RoomType } from '@rocket.chat/core-typings';
2+
import { TEAM_TYPE, type IRoom, type ISubscription, type IUser, type RoomType } from '@rocket.chat/core-typings';
33
import { Integrations, Messages, Rooms, Subscriptions, Uploads, Users } from '@rocket.chat/models';
44
import {
55
isChannelsAddAllProps,
@@ -302,6 +302,10 @@ API.v1.addRoute(
302302
...(pinned && pinned.toLowerCase() === 'true' ? { pinned: true } : {}),
303303
};
304304

305+
if (!(await canAccessRoomAsync(findResult, { _id: this.userId }))) {
306+
return API.v1.forbidden();
307+
}
308+
305309
// Special check for the permissions
306310
if (
307311
(await hasPermissionAsync(this.userId, 'view-joined-room')) &&
@@ -453,6 +457,10 @@ API.v1.addRoute(
453457

454458
const findResult = await findChannelByIdOrName({ params });
455459

460+
if (!(await canAccessRoomAsync(findResult, { _id: this.userId }))) {
461+
return API.v1.forbidden();
462+
}
463+
456464
const moderators = (
457465
await Subscriptions.findByRoomIdAndRoles(findResult._id, ['moderator'], {
458466
projection: { u: 1 },
@@ -859,6 +867,10 @@ API.v1.addRoute(
859867
checkedArchived: false,
860868
});
861869

870+
if (!(await canAccessRoomAsync(findResult, { _id: this.userId }))) {
871+
return API.v1.forbidden();
872+
}
873+
862874
let includeAllPublicChannels = true;
863875
if (typeof this.queryParams.includeAllPublicChannels !== 'undefined') {
864876
includeAllPublicChannels = this.queryParams.includeAllPublicChannels === 'true';
@@ -904,12 +916,18 @@ API.v1.addRoute(
904916
{ authRequired: true },
905917
{
906918
async get() {
919+
const findResult = await findChannelByIdOrName({
920+
params: this.queryParams,
921+
checkedArchived: false,
922+
userId: this.userId,
923+
});
924+
925+
if (!(await canAccessRoomAsync(findResult, { _id: this.userId }))) {
926+
return API.v1.forbidden();
927+
}
928+
907929
return API.v1.success({
908-
channel: await findChannelByIdOrName({
909-
params: this.queryParams,
910-
checkedArchived: false,
911-
userId: this.userId,
912-
}),
930+
channel: findResult,
913931
});
914932
},
915933
},
@@ -1058,6 +1076,10 @@ API.v1.addRoute(
10581076
checkedArchived: false,
10591077
});
10601078

1079+
if (!(await canAccessRoomAsync(findResult, { _id: this.userId }))) {
1080+
return API.v1.forbidden();
1081+
}
1082+
10611083
if (findResult.broadcast && !(await hasPermissionAsync(this.userId, 'view-broadcast-member-list', findResult._id))) {
10621084
return API.v1.forbidden();
10631085
}
@@ -1416,7 +1438,7 @@ API.v1.addRoute(
14161438

14171439
API.v1.addRoute(
14181440
'channels.anonymousread',
1419-
{ authRequired: false },
1441+
{ authOrAnonRequired: true },
14201442
{
14211443
async get() {
14221444
const findResult = await findChannelByIdOrName({
@@ -1434,6 +1456,16 @@ API.v1.addRoute(
14341456
});
14351457
}
14361458

1459+
// Public rooms of private teams should be accessible only by team members
1460+
if (findResult.teamId) {
1461+
const team = await Team.getOneById(findResult.teamId);
1462+
if (team?.type === TEAM_TYPE.PRIVATE) {
1463+
if (!this.userId || !(await canAccessRoomAsync(findResult, { _id: this.userId }))) {
1464+
return API.v1.notFound('Room not found');
1465+
}
1466+
}
1467+
}
1468+
14371469
const { cursor, totalCount } = await Messages.findPaginated(ourQuery, {
14381470
sort: sort || { ts: -1 },
14391471
skip: offset,

apps/meteor/app/api/server/v1/rooms.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
isRoomsCleanHistoryProps,
1313
isRoomsOpenProps,
1414
isRoomsMembersOrderedByRoleProps,
15+
isRoomsHideProps,
1516
} from '@rocket.chat/rest-typings';
1617
import { Meteor } from 'meteor/meteor';
1718

@@ -21,6 +22,7 @@ import * as dataExport from '../../../../server/lib/dataExport';
2122
import { eraseRoom } from '../../../../server/lib/eraseRoom';
2223
import { findUsersOfRoomOrderedByRole } from '../../../../server/lib/findUsersOfRoomOrderedByRole';
2324
import { openRoom } from '../../../../server/lib/openRoom';
25+
import { hideRoomMethod } from '../../../../server/methods/hideRoom';
2426
import { muteUserInRoom } from '../../../../server/methods/muteUserInRoom';
2527
import { unmuteUserInRoom } from '../../../../server/methods/unmuteUserInRoom';
2628
import { canAccessRoomAsync, canAccessRoomIdAsync } from '../../../authorization/server/functions/canAccessRoom';
@@ -962,3 +964,31 @@ API.v1.addRoute(
962964
},
963965
},
964966
);
967+
968+
API.v1.addRoute(
969+
'rooms.hide',
970+
{ authRequired: true, validateParams: isRoomsHideProps },
971+
{
972+
async post() {
973+
const { roomId } = this.bodyParams;
974+
975+
if (!(await canAccessRoomIdAsync(roomId, this.userId))) {
976+
return API.v1.unauthorized();
977+
}
978+
979+
const user = await Users.findOneById(this.userId, { projections: { _id: 1 } });
980+
981+
if (!user) {
982+
return API.v1.failure('error-invalid-user');
983+
}
984+
985+
const modCount = await hideRoomMethod(this.userId, roomId);
986+
987+
if (!modCount) {
988+
return API.v1.failure('error-room-already-hidden');
989+
}
990+
991+
return API.v1.success();
992+
},
993+
},
994+
);

apps/meteor/app/apps/server/bridges/listeners.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export class AppListenerBridge {
1010
// eslint-disable-next-line complexity
1111
const method = (() => {
1212
switch (event) {
13+
case AppInterface.IPostSystemMessageSent:
1314
case AppInterface.IPreMessageSentPrevent:
1415
case AppInterface.IPreMessageSentExtend:
1516
case AppInterface.IPreMessageSentModify:

apps/meteor/app/apps/server/converters/messages.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export class AppMessagesConverter {
4848
attachments: getAttachments,
4949
sender: 'u',
5050
threadMsgCount: 'tcount',
51+
type: 't',
5152
};
5253

5354
return transformMappedData(message, map);
@@ -91,6 +92,7 @@ export class AppMessagesConverter {
9192
groupable: 'groupable',
9293
token: 'token',
9394
blocks: 'blocks',
95+
type: 't',
9496
room: async (message) => {
9597
const result = await cache.get('room')(message.rid);
9698
delete message.rid;
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { useSetting } from '@rocket.chat/ui-contexts';
2+
import { useEffect } from 'react';
3+
4+
import { CustomOAuth } from '../../../custom-oauth/client/CustomOAuth';
5+
6+
const config = {
7+
serverURL: '',
8+
authorizePath: '/m/oauth2/auth/',
9+
tokenPath: '/m/oauth2/token/',
10+
identityPath: '/m/oauth2/api/me/',
11+
scope: 'basic',
12+
addAutopublishFields: {
13+
forLoggedInUser: ['services.dolphin'],
14+
forOtherUsers: ['services.dolphin.name'],
15+
},
16+
accessTokenParam: 'access_token',
17+
};
18+
19+
const Dolphin = new CustomOAuth('dolphin', config);
20+
21+
export const useDolphin = () => {
22+
const enabled = useSetting('Accounts_OAuth_Dolphin');
23+
const url = useSetting('Accounts_OAuth_Dolphin_URL') as string;
24+
25+
useEffect(() => {
26+
if (enabled) {
27+
config.serverURL = url;
28+
Dolphin.configure(config);
29+
}
30+
}, [enabled, url]);
31+
};

apps/meteor/app/dolphin/client/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)