Skip to content

Commit

Permalink
Merge branch 'develop' into SUP-630
Browse files Browse the repository at this point in the history
  • Loading branch information
casalsgh authored Dec 17, 2024
2 parents 3a4c017 + f750e21 commit 94c2e04
Show file tree
Hide file tree
Showing 147 changed files with 2,957 additions and 1,684 deletions.
6 changes: 6 additions & 0 deletions .changeset/blue-rats-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": patch
"@rocket.chat/model-typings": patch
---

Fixes Unit's `numDepartments` property not being updated after a department is removed
5 changes: 5 additions & 0 deletions .changeset/chilled-seas-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/apps-engine': patch
---

Fixes the subprocess restarting routine failing to correctly restart apps in some cases
6 changes: 6 additions & 0 deletions .changeset/fair-carrots-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": patch
"@rocket.chat/model-typings": patch
---

Fixes "Average first response time" and "Best first response time" metrics being associated with the last agent who served the room (instead of the first one)
5 changes: 5 additions & 0 deletions .changeset/four-cows-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes an issue where room members menu doesn't display properly without enough space
5 changes: 5 additions & 0 deletions .changeset/giant-nails-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/apps-engine': patch
---

Adds simple app subprocess metrics report
5 changes: 5 additions & 0 deletions .changeset/green-queens-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes an issue with Federation startup where the bridge would intermittently fail to start causing error being shown "Matrix Bridge isn't running yet".
5 changes: 5 additions & 0 deletions .changeset/honest-kings-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/apps-engine': patch
---

Attempts to restart an app subprocess if the spawn command fails
13 changes: 13 additions & 0 deletions .changeset/lemon-singers-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@rocket.chat/i18n": patch
---

Changes the wording for voice call permissions, improving consistency and clarity.

- `Manage Voip Extension` -> `Manage Voice Calls`
> Permission to manage voice calls and assign extensions to users
- `View VoIP extension details` -> `View Voice Call Extensions`
> Permission to view which user is calling and their extension info
- `View User VoIP extension` -> `Allow Voice Calls`
> Permission to allow users to use the voice call feature
5 changes: 5 additions & 0 deletions .changeset/nervous-fireants-wash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Allows default avatars to be generated with more than one inital (limited to first 3) when setting `Use Full Name Initials to Generate Default Avatar` is true.
5 changes: 5 additions & 0 deletions .changeset/quiet-radios-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/apps-engine': patch
---

Fixes an issue while collecting the error message from a failed restart attempt of an app subprocess
5 changes: 5 additions & 0 deletions .changeset/six-snails-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes a behavior of the mentions parser that identified mentions inside markdown links text. Now, these components will be removed from the text before trying to parse mentions.
5 changes: 5 additions & 0 deletions .changeset/tidy-boxes-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes special characters not being escaped on sidepanel extended view
5 changes: 5 additions & 0 deletions .changeset/young-dots-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/apps-engine': patch
---

Prevents app:getStatus requests from timing out in some cases
16 changes: 16 additions & 0 deletions apps/meteor/app/api/server/v1/rooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import {
isRoomsExportProps,
isRoomsIsMemberProps,
isRoomsCleanHistoryProps,
isRoomsOpenProps,
} from '@rocket.chat/rest-typings';
import { Meteor } from 'meteor/meteor';

import { isTruthy } from '../../../../lib/isTruthy';
import { omit } from '../../../../lib/utils/omit';
import * as dataExport from '../../../../server/lib/dataExport';
import { eraseRoom } from '../../../../server/lib/eraseRoom';
import { openRoom } from '../../../../server/lib/openRoom';
import { muteUserInRoom } from '../../../../server/methods/muteUserInRoom';
import { unmuteUserInRoom } from '../../../../server/methods/unmuteUserInRoom';
import { canAccessRoomAsync, canAccessRoomIdAsync } from '../../../authorization/server/functions/canAccessRoom';
Expand Down Expand Up @@ -893,3 +895,17 @@ API.v1.addRoute(
},
},
);

API.v1.addRoute(
'rooms.open',
{ authRequired: true, validateParams: isRoomsOpenProps },
{
async post() {
const { roomId } = this.bodyParams;

await openRoom(this.userId, roomId);

return API.v1.success();
},
},
);
89 changes: 0 additions & 89 deletions apps/meteor/app/autotranslate/client/lib/actionButton.ts
Original file line number Diff line number Diff line change
@@ -1,96 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';

import { AutoTranslate } from './autotranslate';
import { roomCoordinator } from '../../../../client/lib/rooms/roomCoordinator';
import {
hasTranslationLanguageInAttachments,
hasTranslationLanguageInMessage,
} from '../../../../client/views/room/MessageList/lib/autoTranslate';
import { hasAtLeastOnePermission } from '../../../authorization/client';
import { Messages } from '../../../models/client';
import { settings } from '../../../settings/client';
import { MessageAction } from '../../../ui-utils/client/lib/MessageAction';
import { sdk } from '../../../utils/client/lib/SDKClient';

Meteor.startup(() => {
AutoTranslate.init();

Tracker.autorun(() => {
if (settings.get('AutoTranslate_Enabled') && hasAtLeastOnePermission(['auto-translate'])) {
MessageAction.addButton({
id: 'translate',
icon: 'language',
label: 'Translate',
context: ['message', 'message-mobile', 'threads'],
type: 'interaction',
action(_, { message }) {
const language = AutoTranslate.getLanguage(message.rid);
if (!hasTranslationLanguageInMessage(message, language) && !hasTranslationLanguageInAttachments(message.attachments, language)) {
(AutoTranslate.messageIdsToWait as any)[message._id] = true;
Messages.update({ _id: message._id }, { $set: { autoTranslateFetching: true } });
void sdk.call('autoTranslate.translateMessage', message, language);
}
const action = 'autoTranslateShowInverse' in message ? '$unset' : '$set';
Messages.update({ _id: message._id }, { [action]: { autoTranslateShowInverse: true } });
},
condition({ message, subscription, user, room }) {
if (!user) {
return false;
}
const language = subscription?.autoTranslateLanguage || AutoTranslate.getLanguage(message.rid) || '';
const isLivechatRoom = roomCoordinator.isLivechatRoom(room?.t);
const isDifferentUser = message?.u && message.u._id !== user._id;
const autoTranslateEnabled = subscription?.autoTranslate || isLivechatRoom;
const hasLanguage =
hasTranslationLanguageInMessage(message, language) || hasTranslationLanguageInAttachments(message.attachments, language);

return Boolean(
(message as { autoTranslateShowInverse?: boolean }).autoTranslateShowInverse ||
(isDifferentUser && autoTranslateEnabled && !hasLanguage),
);
},
order: 90,
});
MessageAction.addButton({
id: 'view-original',
icon: 'language',
label: 'View_original',
context: ['message', 'message-mobile', 'threads'],
type: 'interaction',
action(_, props) {
const { message } = props;
const language = AutoTranslate.getLanguage(message.rid);
if (!hasTranslationLanguageInMessage(message, language) && !hasTranslationLanguageInAttachments(message.attachments, language)) {
(AutoTranslate.messageIdsToWait as any)[message._id] = true;
Messages.update({ _id: message._id }, { $set: { autoTranslateFetching: true } });
void sdk.call('autoTranslate.translateMessage', message, language);
}
const action = 'autoTranslateShowInverse' in message ? '$unset' : '$set';
Messages.update({ _id: message._id }, { [action]: { autoTranslateShowInverse: true } });
},
condition({ message, subscription, user, room }) {
const language = subscription?.autoTranslateLanguage || AutoTranslate.getLanguage(message.rid) || '';
const isLivechatRoom = roomCoordinator.isLivechatRoom(room?.t);
if (!user) {
return false;
}
const isDifferentUser = message?.u && message.u._id !== user._id;
const autoTranslateEnabled = subscription?.autoTranslate || isLivechatRoom;
const hasLanguage =
hasTranslationLanguageInMessage(message, language) || hasTranslationLanguageInAttachments(message.attachments, language);

return Boolean(
!(message as { autoTranslateShowInverse?: boolean }).autoTranslateShowInverse &&
isDifferentUser &&
autoTranslateEnabled &&
hasLanguage,
);
},
order: 90,
});
} else {
MessageAction.removeButton('toggle-language');
}
});
});
2 changes: 1 addition & 1 deletion apps/meteor/app/autotranslate/client/lib/autotranslate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Meteor.startup(() => {
export const AutoTranslate = {
initialized: false,
providersMetadata: {} as { [providerNamer: string]: { name: string; displayName: string } },
messageIdsToWait: {} as { [messageId: string]: string },
messageIdsToWait: {} as { [messageId: string]: boolean },
supportedLanguages: [] as ISupportedLanguage[] | undefined,

findSubscriptionByRid: mem((rid) => Subscriptions.findOne({ rid })),
Expand Down
6 changes: 4 additions & 2 deletions apps/meteor/app/lib/server/functions/addUserToRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ export const addUserToRoom = async function (
{
skipSystemMessage,
skipAlertSound,
createAsHidden = false,
}: {
skipSystemMessage?: boolean;
skipAlertSound?: boolean;
createAsHidden?: boolean;
} = {},
): Promise<boolean | undefined> {
const now = new Date();
Expand Down Expand Up @@ -84,8 +86,8 @@ export const addUserToRoom = async function (

const { insertedId } = await Subscriptions.createWithRoomAndUser(room, userToBeAdded as IUser, {
ts: now,
open: true,
alert: !skipAlertSound,
open: !createAsHidden,
alert: createAsHidden ? false : !skipAlertSound,
unread: 1,
userMentions: 1,
groupMentions: 0,
Expand Down
4 changes: 1 addition & 3 deletions apps/meteor/app/lib/server/functions/createRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ async function createUsersSubscriptions({

memberIds.push(member._id);

const extra: Partial<ISubscriptionExtraData> = options?.subscriptionExtra || {};

extra.open = true;
const extra: Partial<ISubscriptionExtraData> = { open: true, ...options?.subscriptionExtra };

if (room.prid) {
extra.prid = room.prid;
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/livechat/server/lib/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const createLivechatRoom = async (
const source = extraRoomInfo.source || roomInfo.source;

if (settings.get<string>('Livechat_Require_Contact_Verification') === 'always') {
await LivechatContacts.updateContactChannel({ visitorId: _id, source }, { verified: false });
await LivechatContacts.setChannelVerifiedStatus({ visitorId: _id, source }, false);
}

const contactId = await migrateVisitorIfMissingContact(_id, source);
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/livechat/server/lib/departmentsLib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ export async function setDepartmentForGuest({ token, department }: { token: stri
export async function removeDepartment(departmentId: string) {
livechatLogger.debug(`Removing department: ${departmentId}`);

const department = await LivechatDepartment.findOneById<Pick<ILivechatDepartment, '_id' | 'businessHourId'>>(departmentId, {
projection: { _id: 1, businessHourId: 1 },
const department = await LivechatDepartment.findOneById<Pick<ILivechatDepartment, '_id' | 'businessHourId' | 'parentId'>>(departmentId, {
projection: { _id: 1, businessHourId: 1, parentId: 1 },
});
if (!department) {
throw new Error('error-department-not-found');
Expand Down
10 changes: 8 additions & 2 deletions apps/meteor/app/mentions/lib/MentionsParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,17 @@ export class MentionsParser {
return this.roomTemplate({ prefix, reference, channel, mention });
});

getUserMentions(str: string) {
getUserMentions(msg: string) {
// First remove the text inside md links
const str = msg.replace(/\[[^\]]*\]\([^)]+\)/g, '');
// Then do the match
return (str.match(this.userMentionRegex) || []).map((match) => match.trim());
}

getChannelMentions(str: string) {
getChannelMentions(msg: string) {
// First remove the text inside md links
const str = msg.replace(/\[[^\]]*\]\([^)]+\)/g, '');
// Then do the match
return (str.match(this.channelMentionRegex) || []).map((match) => match.trim());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class NotificationClass {
return true;
}

return this.worker(counter++);
return this.worker(++counter);
}

getNextNotification(): Promise<INotification | null> {
Expand Down
3 changes: 0 additions & 3 deletions apps/meteor/app/ui-utils/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import './lib/messageActionDefault';

export { MessageAction } from './lib/MessageAction';
export { messageBox } from './lib/messageBox';
export { LegacyRoomManager } from './lib/LegacyRoomManager';
export { upsertMessage, RoomHistoryManager } from './lib/RoomHistoryManager';
Expand Down
Loading

0 comments on commit 94c2e04

Please sign in to comment.