Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/meteor/.scripts/run-ha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async function runMain(config: IConfig): Promise<void> {

async function runInstance(config: IConfig): Promise<void> {
// Desctructuring the unused variables allows us to omit them in the `mainConfig`
// eslint-disable-next-line @typescript-eslint/no-unused-vars

const { customEnv, parentEnv, ...mainConfig } = config;

const env = {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/.scripts/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
let pkgJson = {};

try {
// eslint-disable-next-line import/no-dynamic-require
// eslint-disable-next-line import-x/no-dynamic-require
pkgJson = require(path.resolve(process.cwd(), './package.json'));
} catch (err) {
console.error('no root package.json found');
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/utils/client/getURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getURLWithoutSettings } from '../lib/getURL';
import { Info } from '../rocketchat.info';

export const getURL = function (
path: string, // eslint-disable-next-line @typescript-eslint/naming-convention
path: string,
params: {
cdn?: boolean;
full?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/utils/lib/getURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function getCloudUrl(

export const _getURL = (
path: string,
// eslint-disable-next-line @typescript-eslint/naming-convention

{ cdn, full, cloud, cloud_route, cloud_params, _cdn_prefix, _root_url_path_prefix, _site_url }: Record<string, any>,
deeplinkUrl?: string,
): string => {
Expand Down Expand Up @@ -76,7 +76,7 @@ export const _getURL = (

export const getURLWithoutSettings = (
path: string,
// eslint-disable-next-line @typescript-eslint/naming-convention

{
cdn = true,
full = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { mockAppRoot } from '@rocket.chat/mock-providers';
import { composeStories } from '@storybook/react';
import { render, screen } from '@testing-library/react';
Expand Down
2 changes: 0 additions & 2 deletions apps/meteor/client/definitions/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { IRocketChatDesktop } from '@rocket.chat/desktop-api';

declare global {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface Window {
RocketChatDesktop?: IRocketChatDesktop;

Expand Down Expand Up @@ -70,7 +69,6 @@ declare global {
addStream(stream: MediaStream): void;
}

// eslint-disable-next-line @typescript-eslint/naming-convention
interface MediaTrackConstraints {
/** @deprecated */
mozMediaSource?: string;
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/client/meteor/login/facebook.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { FacebookOAuthConfiguration } from '@rocket.chat/core-typings';
import { Random } from '@rocket.chat/random';
// eslint-disable-next-line import/no-duplicates
// eslint-disable-next-line import-x/no-duplicates
import { Facebook } from 'meteor/facebook-oauth';
import { Meteor } from 'meteor/meteor';
// eslint-disable-next-line import/no-duplicates
// eslint-disable-next-line import-x/no-duplicates
import { OAuth } from 'meteor/oauth';

import { createOAuthTotpLoginMethod } from './oauth';
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/client/meteor/login/google.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Random } from '@rocket.chat/random';
import { Accounts } from 'meteor/accounts-base';
// eslint-disable-next-line import/no-duplicates
// eslint-disable-next-line import-x/no-duplicates
import { Google } from 'meteor/google-oauth';
import { Meteor } from 'meteor/meteor';
// eslint-disable-next-line import/no-duplicates
// eslint-disable-next-line import-x/no-duplicates
import { OAuth } from 'meteor/oauth';

import { createOAuthTotpLoginMethod } from './oauth';
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/client/meteor/login/meteorDeveloperAccount.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Meteor } from 'meteor/meteor';
// eslint-disable-next-line import/no-duplicates
// eslint-disable-next-line import-x/no-duplicates
import { MeteorDeveloperAccounts } from 'meteor/meteor-developer-oauth';
// eslint-disable-next-line import/no-duplicates
// eslint-disable-next-line import-x/no-duplicates
import { OAuth } from 'meteor/oauth';
import { Random } from 'meteor/random';

Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/client/meteor/login/twitter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { TwitterOAuthConfiguration } from '@rocket.chat/core-typings';
import { Random } from '@rocket.chat/random';
import { Meteor } from 'meteor/meteor';
// eslint-disable-next-line import/no-duplicates
// eslint-disable-next-line import-x/no-duplicates
import { OAuth } from 'meteor/oauth';
// eslint-disable-next-line import/no-duplicates
// eslint-disable-next-line import-x/no-duplicates
import { Twitter } from 'meteor/twitter-oauth';

import { createOAuthTotpLoginMethod } from './oauth';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { mockAppRoot } from '@rocket.chat/mock-providers';
import { composeStories } from '@storybook/react';
import { render, screen, waitFor } from '@testing-library/react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ type UseChannelsListOptions = {
count: number;
};

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const useChannelsList = ({ period, offset, count }: UseChannelsListOptions) => {
const getChannelsList = useEndpoint('GET', '/v1/engagement-dashboard/channels/list');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { getPeriodRange } from '../../../../components/dashboards/periods';

type UseMessageOriginsOptions = { period: Period['key'] };

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const useMessageOrigins = ({ period }: UseMessageOriginsOptions) => {
const getMessageOrigins = useEndpoint('GET', '/v1/engagement-dashboard/messages/origin');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { getPeriodRange } from '../../../../components/dashboards/periods';

type UseMessagesSentOptions = { period: Period['key']; utc: boolean };

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const useMessagesSent = ({ period, utc }: UseMessagesSentOptions) => {
const getMessagesSent = useEndpoint('GET', '/v1/engagement-dashboard/messages/messages-sent');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { getPeriodRange } from '../../../../components/dashboards/periods';

type UseTopFivePopularChannelsOptions = { period: Period['key'] };

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const useTopFivePopularChannels = ({ period }: UseTopFivePopularChannelsOptions) => {
const getTopFivePopularChannels = useEndpoint('GET', '/v1/engagement-dashboard/messages/top-five-popular-channels');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { getPeriodRange } from '../../../../components/dashboards/periods';

type UseActiveUsersOptions = { utc: boolean };

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const useActiveUsers = ({ utc }: UseActiveUsersOptions) => {
const getActiveUsers = useEndpoint('GET', '/v1/engagement-dashboard/users/active-users');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { getPeriodRange } from '../../../../components/dashboards/periods';

type UseUsersByTimeOfTheDayOptions = { period: Period['key']; utc: boolean };

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const useUsersByTimeOfTheDay = ({ period, utc }: UseUsersByTimeOfTheDayOptions) => {
const getUsersByTimeOfTheDay = useEndpoint('GET', '/v1/engagement-dashboard/users/users-by-time-of-the-day-in-a-week');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jest.mock('codemirror', () => ({
default: { fromTextArea: (...args: unknown[]) => fromTextArea(...(args as [])) },
}));

jest.mock('codemirror/addon/edit/matchbrackets', () => ({}), { virtual: true });
jest.mock('codemirror/addon/edit/closebrackets', () => ({}), { virtual: true });
jest.mock('codemirror/addon/edit/matchtags', () => ({}), { virtual: true });
jest.mock('codemirror/addon/edit/trailingspace', () => ({}), { virtual: true });
jest.mock('codemirror/addon/search/match-highlighter', () => ({}), { virtual: true });
jest.mock('codemirror/lib/codemirror.css', () => ({}), { virtual: true });
jest.mock('../../../../../../../app/ui/client/lib/codeMirror/codeMirror', () => ({}), { virtual: true });
jest.mock('codemirror/addon/edit/matchbrackets', () => ({}));
jest.mock('codemirror/addon/edit/closebrackets', () => ({}));
jest.mock('codemirror/addon/edit/matchtags', () => ({}));
jest.mock('codemirror/addon/edit/trailingspace', () => ({}));
jest.mock('codemirror/addon/search/match-highlighter', () => ({}));
jest.mock('codemirror/lib/codemirror.css', () => ({}));
jest.mock('../../../../../../../app/ui/client/lib/codeMirror/codeMirror', () => ({}));

const flushAsync = () => act(() => Promise.resolve());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { mockAppRoot } from '@rocket.chat/mock-providers';
import { composeStories } from '@storybook/react';
import { render, screen } from '@testing-library/react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ function safeDateNotEqualCheck(a: Date | string | undefined, b: Date | string |

const keys: (keyof RoomListRowProps)[] = ['id', 'style', 't', 'videoConfActions'];

// eslint-disable-next-line react/no-multi-comp
export default memo(SidebarItemWithData, (prevProps, nextProps) => {
if (keys.some((key) => prevProps[key] !== nextProps[key])) {
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { mockAppRoot } from '@rocket.chat/mock-providers';
import { WizardContext, StepsLinkedList } from '@rocket.chat/ui-client';
import { composeStories } from '@storybook/react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { mockAppRoot } from '@rocket.chat/mock-providers';
import { WizardContext, StepsLinkedList } from '@rocket.chat/ui-client';
import { composeStories } from '@storybook/react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { mockAppRoot } from '@rocket.chat/mock-providers';
import { WizardContext, StepsLinkedList } from '@rocket.chat/ui-client';
import { composeStories } from '@storybook/react';
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/ee/server/api/ldap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ API.v1.post(
throw new Error('error-invalid-user');
}

if (!(await hasPermissionAsync(this.userId, 'sync-auth-services-users'))) {
if (!(await hasPermissionAsync(this.user, 'sync-auth-services-users'))) {
throw new Error('error-not-authorized');
}

Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/ee/server/api/licenses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ API.v1.addRoute(
{ authRequired: true, validateParams: isLicensesInfoProps },
{
async get() {
const unrestrictedAccess = await hasPermissionAsync(this.userId, 'view-privileged-setting');
const unrestrictedAccess = await hasPermissionAsync(this.user, 'view-privileged-setting');
const loadCurrentValues = unrestrictedAccess && Boolean(this.queryParams.loadValues);

const license = await License.getInfo({
Expand All @@ -26,7 +26,7 @@ API.v1.addRoute(
try {
// TODO: Remove this logic after setting type object is implemented.
const cloudSyncAnnouncement = JSON.parse(settings.get('Cloud_Sync_Announcement_Payload') ?? null);
const canManageCloud = await hasPermissionAsync(this.userId, 'manage-cloud');
const canManageCloud = await hasPermissionAsync(this.user, 'manage-cloud');
return API.v1.success({
license,
...(canManageCloud && cloudSyncAnnouncement && { cloudSyncAnnouncement }),
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/ee/server/api/roles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ API.v1.addRoute(
throw new Meteor.Error('error-invalid-role-properties', 'The role properties are invalid.');
}

if (!(await hasPermissionAsync(this.userId, 'access-permissions'))) {
if (!(await hasPermissionAsync(this.user, 'access-permissions'))) {
throw new Meteor.Error('error-action-not-allowed', 'Accessing permissions is not allowed');
}

Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/ee/server/api/v1/omnichannel/rooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ API.v1.addRoute(
}

const subscription = await Subscriptions.findOneByRoomIdAndUserId(roomId, this.userId, { projection: { _id: 1 } });
if (!subscription && !(await hasPermissionAsync(this.userId, 'on-hold-others-livechat-room'))) {
if (!subscription && !(await hasPermissionAsync(this.user, 'on-hold-others-livechat-room'))) {
throw new Error('Not_authorized');
}

Expand Down Expand Up @@ -71,7 +71,7 @@ API.v1.addRoute(
}

const subscription = await Subscriptions.findOneByRoomIdAndUserId(roomId, this.userId, { projection: { _id: 1 } });
if (!subscription && !(await hasPermissionAsync(this.userId, 'on-hold-others-livechat-room'))) {
if (!subscription && !(await hasPermissionAsync(this.user, 'on-hold-others-livechat-room'))) {
throw new Error('Not_authorized');
}

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/ee/server/api/v1/omnichannel/units.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ API.v1.addRoute(
const { sort } = await this.parseJsonQuery();
const { text } = this.queryParams;

if (!(await hasPermissionAsync(this.userId, 'manage-livechat-units'))) {
if (!(await hasPermissionAsync(this.user, 'manage-livechat-units'))) {
return API.v1.success(await findUnitsOfUser({ text, userId: this.userId, pagination: { offset, count, sort } }));
}

Expand Down
10 changes: 4 additions & 6 deletions apps/meteor/ee/server/cron/readReceiptsArchive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ export async function archiveOldReadReceipts(): Promise<void> {
let batchNumber = 0;
let hasMore = true;

// eslint-disable-next-line no-await-in-loop
while (hasMore) {
batchNumber++;
logger.info({ msg: 'Processing batch', batchNumber });

// Find receipts older than the retention period, limited by batch size
// eslint-disable-next-line no-await-in-loop

const oldReceipts = await ReadReceipts.findOlderThan(cutoffDate).limit(batchSize).toArray();

if (oldReceipts.length === 0) {
Expand All @@ -43,7 +42,6 @@ export async function archiveOldReadReceipts(): Promise<void> {
try {
// Insert receipts into archive collection (using insertMany with ordered: false to continue on duplicate key errors)
try {
// eslint-disable-next-line no-await-in-loop
await ReadReceiptsArchive.insertMany(oldReceipts, { ordered: false });
logger.info({ msg: 'Successfully archived read receipts', count: oldReceipts.length, batchNumber });
} catch (error: unknown) {
Expand Down Expand Up @@ -71,13 +69,13 @@ export async function archiveOldReadReceipts(): Promise<void> {
}

// Mark messages as having archived receipts
// eslint-disable-next-line no-await-in-loop

const updateResult = await Messages.setReceiptsArchivedById(messageIds, true);
logger.info({ msg: 'Marked messages as having archived receipts', modifiedCount: updateResult.modifiedCount, batchNumber });

// Delete old receipts from hot storage for this batch
const receiptIds = oldReceipts.map((receipt) => receipt._id);
// eslint-disable-next-line no-await-in-loop

const deleteResult = await ReadReceipts.removeByIds(receiptIds);
logger.info({ msg: 'Deleted old receipts from hot storage', deletedCount: deleteResult.deletedCount, batchNumber });

Expand All @@ -86,7 +84,7 @@ export async function archiveOldReadReceipts(): Promise<void> {
// If we processed a full batch, there might be more, so wait and continue
if (oldReceipts.length === batchSize) {
logger.info({ msg: 'Batch complete, waiting before next batch', batchNumber, delayMs: BATCH_DELAY_MS });
// eslint-disable-next-line no-await-in-loop

await sleep(BATCH_DELAY_MS);
} else {
// This was the last batch (partial batch)
Expand Down
5 changes: 1 addition & 4 deletions apps/meteor/ee/server/lib/omnichannel/debounceByParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ interface IMemoizeDebouncedFunction<F extends (...args: any[]) => any> {
// Debounce `func` based on passed parameters
// ref: https://github.com/lodash/lodash/issues/2403#issuecomment-816137402
export function memoizeDebounce<F extends (...args: any[]) => any>(func: F, wait = 0, options: any = {}): IMemoizeDebouncedFunction<F> {
const debounceMemo = mem(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
(..._args: Parameters<F>) => debounce(func, wait, options),
);
const debounceMemo = mem((..._args: Parameters<F>) => debounce(func, wait, options));

function wrappedFunction(this: IMemoizeDebouncedFunction<F>, ...args: Parameters<F>): ReturnType<F> | undefined {
return debounceMemo(...args)(...args);
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/server/api/ApiClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { wrapExceptions } from '@rocket.chat/tools';
import type { ValidateFunction } from 'ajv';
import { Accounts } from 'meteor/accounts-base';
import { DDP } from 'meteor/ddp';
// eslint-disable-next-line import/no-duplicates
// eslint-disable-next-line import-x/no-duplicates
import { DDPCommon } from 'meteor/ddp-common';
import { Meteor } from 'meteor/meteor';
import type { RateLimiterOptionsToCheck } from 'meteor/rate-limit';
// eslint-disable-next-line import/no-duplicates
// eslint-disable-next-line import-x/no-duplicates
import { RateLimiter } from 'meteor/rate-limit';
import _ from 'underscore';

Expand Down
1 change: 0 additions & 1 deletion apps/meteor/server/api/lib/isValidQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const isValidQuery: {
throw new Error('query must be an object');
}

// eslint-disable-next-line @typescript-eslint/no-use-before-define
return verifyQuery(query, allowedAttributes, allowedOperations);
},
{
Expand Down
Loading
Loading