Skip to content

Commit

Permalink
Merge branch 'release-7.0.0' into chore/integrations-query-param
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored Oct 16, 2024
2 parents acb5132 + b8b8880 commit 1caa8dd
Show file tree
Hide file tree
Showing 529 changed files with 2,899 additions and 3,314 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-clouds-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': major
---

Removes unused Accounts_OAuth_Custom_Button_Label_Color and Accounts_OAuth_Custom_Button_Color settings and translations
5 changes: 5 additions & 0 deletions .changeset/slow-rules-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

This adjustment removes the deprecated `Mailer.sendMail` and `Mailer:unsubscribe` methods. Moving forward, use the `mailer` and `mailer.unsubscribe` endpoints.
6 changes: 6 additions & 0 deletions .changeset/thick-waves-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": major
"@rocket.chat/i18n": patch
---

Removes the ability of changing room's encryption status from the `key` icon placed on the room's header. Icon's purpose is now only informative, showing when a room uses E2EE. Use the kebab menu to enable/disable E2EE.
5 changes: 5 additions & 0 deletions .changeset/three-avocados-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": major
---

No longer shows archived rooms in `rooms.autocomplete.channelAndPrivate` endpoint
6 changes: 6 additions & 0 deletions .changeset/tough-rings-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rocket.chat/meteor": major
"@rocket.chat/i18n": patch
---

Renames the settings group 'Voice Channel' to 'Omnichannel voice channel (VoIP)' to better reflect its responsibility.
848 changes: 472 additions & 376 deletions .github/actions/update-version-durability/package-lock.json

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions .github/actions/update-version-durability/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "scripts",
"version": "1.0.0",
"type": "module",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@actions/core": "^1.10.1",
"@octokit/rest": "^21.0.0",
"axios": "^1.7.2",
"beauty-html": "^1.3.1",
"colors": "^1.4.0",
"diff": "^5.1.0",
"semver": "^7.5.4",
"xmldom": "^0.6.0"
}
"name": "scripts",
"version": "1.0.0",
"type": "module",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@actions/core": "^1.10.1",
"@octokit/rest": "^21.0.0",
"axios": "^1.7.2",
"beauty-html": "^1.3.1",
"colors": "^1.4.0",
"diff": "^5.1.0",
"semver": "^7.5.4",
"@xmldom/xmldom": "^0.8.10"
}
}
21 changes: 0 additions & 21 deletions apps/meteor/.storybook/babel.config.js

This file was deleted.

8 changes: 0 additions & 8 deletions apps/meteor/.storybook/mocks/meteor.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,6 @@ export const Template = Object.assign(
},
);

export const Blaze = {
Template,
registerHelper: () => {},
renderWithData: () => {},
};

window.Blaze = Blaze;

export const check = () => {};

export const FlowRouter = {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/2fa/server/code/EmailCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class EmailCheck implements ICodeCheck {
private async send2FAEmail(address: string, random: string, user: IUser): Promise<void> {
const language = user.language || settings.get('Language') || 'en';

const t = (s: string): string => i18n.t(s, { lng: language });
const t = i18n.getFixedT(language);

await Mailer.send({
to: address,
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/2fa/server/functions/resetTOTP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const sendResetNotification = async function (uid: string): Promise<void> {
return;
}

const t = (s: string): string => i18n.t(s, { lng: language });
const t = i18n.getFixedT(language);
const text = `
${t('Your_TOTP_has_been_reset')}
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/api/server/helpers/parseJsonQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function parseJsonQuery(api: PartialThis): Promise<{
}

// TODO: Remove this once we have all routes migrated to the new API params
const hasSupportedRoutes = ['/api/v1/integrations.list'].includes(route);
const hasSupportedRoutes = ['/api/v1/integrations.list', '/api/v1/custom-user-status.list'].includes(route);
const isUnsafeQueryParamsAllowed = process.env.ALLOW_UNSAFE_QUERY_AND_FIELDS_API_PARAMS?.toUpperCase() === 'TRUE';
const messageGenerator = ({ endpoint, version, parameter }: { endpoint: string; version: string; parameter: string }): string =>
`The usage of the "${parameter}" parameter in endpoint "${endpoint}" breaks the security of the API and can lead to data exposure. It has been deprecated and will be removed in the version ${version}.`;
Expand Down
16 changes: 13 additions & 3 deletions apps/meteor/app/api/server/v1/custom-user-status.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { CustomUserStatus } from '@rocket.chat/models';
import { isCustomUserStatusListProps } from '@rocket.chat/rest-typings';
import { escapeRegExp } from '@rocket.chat/string-helpers';
import { Match, check } from 'meteor/check';
import { Meteor } from 'meteor/meteor';

Expand All @@ -7,13 +9,21 @@ import { getPaginationItems } from '../helpers/getPaginationItems';

API.v1.addRoute(
'custom-user-status.list',
{ authRequired: true },
{ authRequired: true, validateParams: isCustomUserStatusListProps },
{
async get() {
const { offset, count } = await getPaginationItems(this.queryParams);
const { offset, count } = await getPaginationItems(this.queryParams as Record<string, string | number | null | undefined>);
const { sort, query } = await this.parseJsonQuery();

const { cursor, totalCount } = CustomUserStatus.findPaginated(query, {
const { name, _id } = this.queryParams;

const filter = {
...query,
...(name ? { name: { $regex: escapeRegExp(name as string), $options: 'i' } } : {}),
...(_id ? { _id } : {}),
};

const { cursor, totalCount } = CustomUserStatus.findPaginated(filter, {
sort: sort || { name: 1 },
skip: offset,
limit: count,
Expand Down
7 changes: 5 additions & 2 deletions apps/meteor/app/api/server/v1/mailer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { isMailerProps, isMailerUnsubscribeProps } from '@rocket.chat/rest-typings';

import { sendMail } from '../../../mail-messages/server/functions/sendMail';
import { Mailer } from '../../../mail-messages/server/lib/Mailer';
import { API } from '../api';

API.v1.addRoute(
Expand All @@ -13,7 +15,7 @@ API.v1.addRoute(
async post() {
const { from, subject, body, dryrun, query } = this.bodyParams;

const result = await Meteor.callAsync('Mailer.sendMail', from, subject, body, Boolean(dryrun), query);
const result = await sendMail({ from, subject, body, dryrun: Boolean(dryrun), query });

return API.v1.success(result);
},
Expand All @@ -25,12 +27,13 @@ API.v1.addRoute(
{
authRequired: true,
validateParams: isMailerUnsubscribeProps,
rateLimiterOptions: { intervalTimeInMS: 60000, numRequestsAllowed: 1 },
},
{
async post() {
const { _id, createdAt } = this.bodyParams;

await Meteor.callAsync('Mailer:unsubscribe', _id, createdAt);
await Mailer.unsubscribe(_id, createdAt);

return API.v1.success();
},
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/app/api/server/v1/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ API.v1.addRoute(
(service as OAuthConfiguration).clientId ||
(service as TwitterOAuthConfiguration).consumerKey,
buttonLabelText: service.buttonLabelText || '',
buttonColor: service.buttonColor || '',
buttonLabelColor: service.buttonLabelColor || '',
custom: false,
};
}),
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/app/apple/server/appleOauthRegisterService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ settings.watchMultiple(
enabled: settings.get('Accounts_OAuth_Apple'),
loginStyle: 'popup',
clientId: clientId as string,
buttonColor: '#000',
buttonLabelColor: '#FFF',
},
},
);
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/app/dolphin/server/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ Meteor.startup(async () => {
if (settings.get('Accounts_OAuth_Dolphin_URL')) {
const data = {
buttonLabelText: settings.get<string>('Accounts_OAuth_Dolphin_button_label_text'),
buttonColor: settings.get<string>('Accounts_OAuth_Dolphin_button_color'),
buttonLabelColor: settings.get<string>('Accounts_OAuth_Dolphin_button_label_color'),
clientId: settings.get<string>('Accounts_OAuth_Dolphin_id'),
secret: settings.get<string>('Accounts_OAuth_Dolphin_secret'),
serverURL: settings.get<string>('Accounts_OAuth_Dolphin_URL'),
Expand Down
13 changes: 5 additions & 8 deletions apps/meteor/app/lib/server/methods/addUsersToRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,11 @@ export const addUsersToRoomMethod = async (userId: string, data: { rid: string;
return;
}
void api.broadcast('notify.ephemeralMessage', userId, data.rid, {
msg: i18n.t(
'Username_is_already_in_here',
{
postProcess: 'sprintf',
sprintf: [newUser.username],
},
user?.language,
),
msg: i18n.t('Username_is_already_in_here', {
postProcess: 'sprintf',
sprintf: [newUser.username],
lng: user?.language,
}),
});
}
}),
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/app/lib/server/methods/removeOAuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ Meteor.methods<ServerMethods>({
`Accounts_OAuth_Custom-${name}-id`,
`Accounts_OAuth_Custom-${name}-secret`,
`Accounts_OAuth_Custom-${name}-button_label_text`,
`Accounts_OAuth_Custom-${name}-button_label_color`,
`Accounts_OAuth_Custom-${name}-button_color`,
`Accounts_OAuth_Custom-${name}-login_style`,
`Accounts_OAuth_Custom-${name}-key_field`,
`Accounts_OAuth_Custom-${name}-username_field`,
Expand Down
8 changes: 5 additions & 3 deletions apps/meteor/app/lib/server/methods/sendMessage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { api } from '@rocket.chat/core-services';
import type { AtLeast, IMessage, IUser } from '@rocket.chat/core-typings';
import type { ServerMethods } from '@rocket.chat/ddp-client';
import type { RocketchatI18nKeys } from '@rocket.chat/i18n';
import { Messages, Users } from '@rocket.chat/models';
import type { TOptions } from 'i18next';
import { check } from 'meteor/check';
import { Meteor } from 'meteor/meteor';
import moment from 'moment';
Expand Down Expand Up @@ -97,10 +99,10 @@ export async function executeSendMessage(uid: IUser['_id'], message: AtLeast<IMe
} catch (err: any) {
SystemLogger.error({ msg: 'Error sending message:', err });

const errorMessage = typeof err === 'string' ? err : err.error || err.message;
const errorContext = err.details ?? {};
const errorMessage: RocketchatI18nKeys = typeof err === 'string' ? err : err.error || err.message;
const errorContext: TOptions = err.details ?? {};
void api.broadcast('notify.ephemeralMessage', uid, message.rid, {
msg: i18n.t(errorMessage, errorContext, user.language),
msg: i18n.t(errorMessage, { ...errorContext, lng: user.language }),
});

if (typeof err === 'string') {
Expand Down
8 changes: 4 additions & 4 deletions apps/meteor/app/lib/server/startup/mentionUserNotInChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const getBlocks = (mentions: IMessage['mentions'], messageId: string, lng: strin
actionId: 'add-users',
text: {
type: 'plain_text',
text: i18n.t('Add_them', undefined, lng),
text: i18n.t('Add_them', { lng }),
},
},
dismissBlock: {
Expand All @@ -35,7 +35,7 @@ const getBlocks = (mentions: IMessage['mentions'], messageId: string, lng: strin
actionId: 'dismiss',
text: {
type: 'plain_text',
text: i18n.t('Do_nothing', undefined, lng),
text: i18n.t('Do_nothing', { lng }),
},
},
dmBlock: {
Expand All @@ -46,7 +46,7 @@ const getBlocks = (mentions: IMessage['mentions'], messageId: string, lng: strin
actionId: 'share-message',
text: {
type: 'plain_text',
text: i18n.t('Let_them_know', undefined, lng),
text: i18n.t('Let_them_know', { lng }),
},
},
} as const;
Expand Down Expand Up @@ -121,7 +121,7 @@ callbacks.add(
type: 'section',
text: {
type: 'mrkdwn',
text: i18n.t(messageLabel, { mentions: mentionsText }, language),
text: i18n.t(messageLabel, { mentions: mentionsText, lng: language }),
},
} as const,
Boolean(elements.length) &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button, Modal } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import React from 'react';
import { useTranslation } from 'react-i18next';

type PlaceChatOnHoldModalProps = {
onOnHoldChat: () => void;
Expand All @@ -9,7 +9,7 @@ type PlaceChatOnHoldModalProps = {
};

const PlaceChatOnHoldModal = ({ onCancel, onOnHoldChat, confirm = onOnHoldChat, ...props }: PlaceChatOnHoldModalProps) => {
const t = useTranslation();
const { t } = useTranslation();

return (
<Modal {...props} data-qa-id='on-hold-modal'>
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/livechat/server/api/v1/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ API.v1.addRoute(
const visitorEmail = visitor.visitorEmails?.[0]?.address;

const language = servingAgent.language || rcSettings.get<string>('Language') || 'en';
const t = (s: string): string => i18n.t(s, { lng: language });
const t = i18n.getFixedT(language);
const subject = t('Transcript_of_your_livechat_conversation');

options.emailTranscript = {
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/livechat/server/lib/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,8 @@ export const dispatchInquiryQueued = async (inquiry: ILivechatInquiryRecord, age
hasMentionToHere: false,
message: { _id: '', u: v, msg: '' },
// we should use server's language for this type of messages instead of user's
notificationMessage: i18n.t('User_started_a_new_conversation', { username: notificationUserName }, language),
room: Object.assign(room, { name: i18n.t('New_chat_in_queue', {}, language) }),
notificationMessage: i18n.t('User_started_a_new_conversation', { username: notificationUserName, lng: language }),
room: Object.assign(room, { name: i18n.t('New_chat_in_queue', { lng: language }) }),
mentionIds: [],
});
}
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/livechat/server/lib/QueueManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ export class QueueManager {
hasMentionToHere: false,
message: { _id: '', u: v, msg: '' },
// we should use server's language for this type of messages instead of user's
notificationMessage: i18n.t('User_started_a_new_conversation', { username: notificationUserName }, language),
room: { ...room, name: i18n.t('New_chat_in_queue', {}, language) },
notificationMessage: i18n.t('User_started_a_new_conversation', { username: notificationUserName, lng: language }),
room: { ...room, name: i18n.t('New_chat_in_queue', { lng: language }) },
mentionIds: [],
});
}
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/app/mail-messages/server/index.ts

This file was deleted.

Loading

0 comments on commit 1caa8dd

Please sign in to comment.