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
8 changes: 4 additions & 4 deletions apps/meteor/app/authorization/client/hasPermission.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IUser, IPermission } from '@rocket.chat/core-typings';
import { Meteor } from 'meteor/meteor';

import { hasRole } from './hasRole';
import { PermissionsCachedStore } from '../../../client/cachedStores';
import { watchUserId } from '../../../client/meteor/user';
import { watch } from '../../../client/meteor/watch';
import { Permissions, Users } from '../../../client/stores';
import { AuthorizationUtils } from '../lib/AuthorizationUtils';
Expand Down Expand Up @@ -47,10 +47,10 @@ const validatePermissions = (
userId: IUser['_id'],
scopedRoles?: IPermission['_id'][],
) => boolean,
userId?: IUser['_id'] | null,
userId?: IUser['_id'],
scopedRoles?: IPermission['_id'][],
): boolean => {
userId = userId ?? Meteor.userId();
userId = userId ?? watchUserId() ?? undefined;

if (!userId) {
return false;
Expand All @@ -75,7 +75,7 @@ export const hasAtLeastOnePermission = (permissions: IPermission['_id'] | IPermi
export const userHasAllPermission = (
permissions: IPermission['_id'] | IPermission['_id'][],
scope?: string,
userId?: IUser['_id'] | null,
userId?: IUser['_id'],
): boolean => validatePermissions(permissions, scope, all, userId);

export const hasPermission = hasAllPermission;
22 changes: 8 additions & 14 deletions apps/meteor/app/autotranslate/client/lib/autotranslate.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import type {
IRoom,
ISubscription,
ISupportedLanguage,
ITranslatedMessage,
IUser,
MessageAttachmentDefault,
} from '@rocket.chat/core-typings';
import type { IRoom, ISubscription, ISupportedLanguage, ITranslatedMessage, MessageAttachmentDefault } from '@rocket.chat/core-typings';
import { isTranslatedMessageAttachment } from '@rocket.chat/core-typings';
import mem from 'mem';
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';

import { settings } from '../../../../client/lib/settings';
import { getUserId } from '../../../../client/lib/user';
import { watchUser, watchUserId } from '../../../../client/meteor/user';
import { Messages, Subscriptions } from '../../../../client/stores';
import {
hasTranslationLanguageInAttachments,
Expand All @@ -25,10 +20,9 @@ let username = '';

Meteor.startup(() => {
Tracker.autorun(() => {
const user: Pick<IUser, 'language' | 'username'> | null = Meteor.user();
if (!user) {
return;
}
const user = watchUser();
if (!user) return;

userLanguage = user.language || 'en';
username = user.username || '';
});
Comment on lines +23 to 28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Reset user-dependent globals on logout to avoid stale language/username.

When watchUser() becomes undefined (logout), userLanguage and username keep the last values, affecting translations until reload.

Apply this diff:

-		const user = watchUser();
-		if (!user) return;
-
-		userLanguage = user.language || 'en';
-		username = user.username || '';
+		const user = watchUser();
+		if (!user) {
+			userLanguage = 'en';
+			username = '';
+			return;
+		}
+		userLanguage = user.language || 'en';
+		username = user.username || '';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const user = watchUser();
if (!user) return;
userLanguage = user.language || 'en';
username = user.username || '';
});
const user = watchUser();
if (!user) {
userLanguage = 'en';
username = '';
return;
}
userLanguage = user.language || 'en';
username = user.username || '';
});
🤖 Prompt for AI Agents
In apps/meteor/app/autotranslate/client/lib/autotranslate.ts around lines 23-28,
when watchUser() becomes undefined on logout the code currently returns early
and leaves userLanguage and username set to previous values; update the handler
so that if user is falsy (logout) you explicitly reset userLanguage = 'en' and
username = '' before returning, otherwise set them from
user.language/user.username as before.

Expand Down Expand Up @@ -102,7 +96,7 @@ export const AutoTranslate = {
}

Tracker.autorun(async (c) => {
const uid = Meteor.userId();
const uid = watchUserId();
if (!settings.watch('AutoTranslate_Enabled') || !uid || !hasPermission('auto-translate')) {
return;
}
Expand Down Expand Up @@ -132,7 +126,7 @@ export const createAutoTranslateMessageStreamHandler = (): ((message: ITranslate
AutoTranslate.init();

return (message: ITranslatedMessage): void => {
if (message.u && message.u._id !== Meteor.userId()) {
if (message.u && message.u._id !== getUserId()) {
const subscription = AutoTranslate.findSubscriptionByRid(message.rid);
const language = AutoTranslate.getLanguage(message.rid);
if (
Expand Down
7 changes: 4 additions & 3 deletions apps/meteor/app/lib/client/methods/sendMessage.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import type { IMessage, IUser } from '@rocket.chat/core-typings';
import type { IMessage } from '@rocket.chat/core-typings';
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { Meteor } from 'meteor/meteor';

import { onClientMessageReceived } from '../../../../client/lib/onClientMessageReceived';
import { settings } from '../../../../client/lib/settings';
import { dispatchToastMessage } from '../../../../client/lib/toast';
import { getUser, getUserId } from '../../../../client/lib/user';
import { Messages, Rooms } from '../../../../client/stores';
import { callbacks } from '../../../../lib/callbacks';
import { trim } from '../../../../lib/utils/stringUtils';
import { t } from '../../../utils/lib/i18n';

Meteor.methods<ServerMethods>({
async sendMessage(message) {
const uid = Meteor.userId();
const uid = getUserId();
if (!uid || trim(message.msg) === '') {
return false;
}
const messageAlreadyExists = message._id && Messages.state.get(message._id);
if (messageAlreadyExists) {
return dispatchToastMessage({ type: 'error', message: t('Message_Already_Sent') });
}
const user = Meteor.user() as IUser | null;
const user = getUser();
if (!user?.username) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'sendMessage' });
}
Expand Down
8 changes: 4 additions & 4 deletions apps/meteor/app/otr/client/OTRRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Tracker } from 'meteor/tracker';

import { Presence } from '../../../client/lib/presence';
import { dispatchToastMessage } from '../../../client/lib/toast';
import { getUser } from '../../../client/lib/user';
import { getUidDirectMessage } from '../../../client/lib/utils/getUidDirectMessage';
import { goToRoomById } from '../../../client/lib/utils/goToRoomById';
import { Messages } from '../../../client/stores';
Expand Down Expand Up @@ -102,10 +103,9 @@ export class OTRRoom implements IOTRRoom {
]);

if (refresh) {
const user = Meteor.user();
if (!user) {
return;
}
const user = getUser();
if (!user) return;

await sdk.rest.post('/v1/chat.otr', {
roomId: this._roomId,
type: otrSystemMessages.USER_REQUESTED_OTR_KEY_REFRESH,
Expand Down
5 changes: 3 additions & 2 deletions apps/meteor/app/reactions/client/methods/setReaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ import type { ServerMethods } from '@rocket.chat/ddp-client';
import { Meteor } from 'meteor/meteor';

import { roomCoordinator } from '../../../../client/lib/rooms/roomCoordinator';
import { getUser, getUserId } from '../../../../client/lib/user';
import { Rooms, Subscriptions, Messages } from '../../../../client/stores';
import { emoji } from '../../../emoji/client';

Meteor.methods<ServerMethods>({
async setReaction(reaction, messageId) {
if (!Meteor.userId()) {
if (!getUserId()) {
throw new Meteor.Error(203, 'User_logged_out');
}

const user = Meteor.user();
const user = getUser();

if (!user?.username) {
return false;
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/app/ui-utils/client/lib/RoomHistoryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { MutableRefObject } from 'react';
import { v4 as uuidv4 } from 'uuid';

import { onClientMessageReceived } from '../../../../client/lib/onClientMessageReceived';
import { getUserId } from '../../../../client/lib/user';
import { callWithErrorHandling } from '../../../../client/lib/utils/callWithErrorHandling';
import { getConfig } from '../../../../client/lib/utils/getConfig';
import { waitForElement } from '../../../../client/lib/utils/waitForElement';
Expand Down Expand Up @@ -138,7 +139,7 @@ class RoomHistoryManagerClass extends Emitter {
({ ls } = subscription);
}

const showThreadsInMainChannel = getUserPreference(Meteor.userId(), 'showThreadsInMainChannel', false);
const showThreadsInMainChannel = getUserPreference(getUserId(), 'showThreadsInMainChannel', false);
const result = await callWithErrorHandling(
'loadHistory',
rid,
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/ui/client/lib/ChatMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type DeepWritable<T> = T extends (...args: any) => any
};

export class ChatMessages implements ChatAPI {
public uid: string | null;
public uid: string | undefined;

public tmid?: IMessage['_id'];

Expand Down Expand Up @@ -142,7 +142,7 @@ export class ChatMessages implements ChatAPI {

public flows: DeepWritable<ChatAPI['flows']>;

public constructor(params: { rid: IRoom['_id']; tmid?: IMessage['_id']; uid: IUser['_id'] | null; actionManager: IActionManager }) {
public constructor(params: { rid: IRoom['_id']; tmid?: IMessage['_id']; uid: IUser['_id'] | undefined; actionManager: IActionManager }) {
const { rid, tmid } = params;
this.tmid = tmid;
this.uid = params.uid;
Expand Down
6 changes: 3 additions & 3 deletions apps/meteor/app/ui/client/lib/UserAction.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { IExtras, IRoomActivity, IUser } from '@rocket.chat/core-typings';
import { Emitter } from '@rocket.chat/emitter';
import { debounce } from 'lodash';
import { Meteor } from 'meteor/meteor';

import { settings } from '../../../../client/lib/settings';
import { getUser, getUserId } from '../../../../client/lib/user';
import { Users } from '../../../../client/stores';
import { sdk } from '../../../utils/client/lib/SDKClient';

Expand Down Expand Up @@ -40,7 +40,7 @@ const shownName = function (user: IUser | null | undefined): string | undefined

const emitActivities = debounce(async (rid: string, extras: IExtras): Promise<void> => {
const activities = roomActivities.get(extras?.tmid || rid) || new Set();
sdk.publish('notify-room', [`${rid}/${USER_ACTIVITY}`, shownName(Meteor.user() as unknown as IUser), [...activities], extras]);
sdk.publish('notify-room', [`${rid}/${USER_ACTIVITY}`, shownName(getUser()), [...activities], extras]);
}, 500);
Comment on lines 41 to 44
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Guard against undefined username in activity broadcast

shownName(getUser()) can be undefined (e.g., before user record loads). Avoid emitting an event with an undefined username.

-  sdk.publish('notify-room', [`${rid}/${USER_ACTIVITY}`, shownName(getUser()), [...activities], extras]);
+  const username = shownName(getUser());
+  if (!username) return;
+  sdk.publish('notify-room', [`${rid}/${USER_ACTIVITY}`, username, [...activities], extras]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const emitActivities = debounce(async (rid: string, extras: IExtras): Promise<void> => {
const activities = roomActivities.get(extras?.tmid || rid) || new Set();
sdk.publish('notify-room', [`${rid}/${USER_ACTIVITY}`, shownName(Meteor.user() as unknown as IUser), [...activities], extras]);
sdk.publish('notify-room', [`${rid}/${USER_ACTIVITY}`, shownName(getUser()), [...activities], extras]);
}, 500);
const emitActivities = debounce(async (rid: string, extras: IExtras): Promise<void> => {
const activities = roomActivities.get(extras?.tmid || rid) || new Set();
const username = shownName(getUser());
if (!username) return;
sdk.publish('notify-room', [`${rid}/${USER_ACTIVITY}`, username, [...activities], extras]);
}, 500);
🤖 Prompt for AI Agents
In apps/meteor/app/ui/client/lib/UserAction.ts around lines 41 to 44, the
broadcast uses shownName(getUser()) which can be undefined; compute a safe
username first (e.g., const username = shownName(getUser()) || '' or use a
fallback like 'Unknown') and use that variable in the sdk.publish call so the
emitted event never contains undefined for the username; update the payload to
use the safe username variable (or skip emitting if you prefer only when a real
username exists).


function handleStreamAction(rid: string, username: string, activityTypes: string[], extras?: IExtras): void {
Expand Down Expand Up @@ -74,7 +74,7 @@ export const UserAction = new (class {
}

const handler = function (username: string, activityType: string[], extras?: object): void {
const uid = Meteor.userId();
const uid = getUserId();
const user = uid ? Users.state.get(uid) : undefined;

if (username === shownName(user)) {
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/app/utils/client/lib/getUserPreference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Users } from '../../../../client/stores';
* @param key The preference name
* @returns The preference value
*/
export function getUserPreference<TValue>(user: IUser['_id'] | null | undefined, key: string): TValue | undefined;
export function getUserPreference<TValue>(user: IUser['_id'] | undefined, key: string): TValue | undefined;
/**
* Get a user preference
* @param user The user
Expand All @@ -24,7 +24,7 @@ export function getUserPreference<TValue>(user: Pick<IUser, '_id' | 'settings'>
* @param defaultValue The default value
* @returns The preference value or the default value
*/
export function getUserPreference<TValue>(user: IUser['_id'] | null | undefined, key: string, defaultValue: TValue): TValue;
export function getUserPreference<TValue>(user: IUser['_id'] | undefined, key: string, defaultValue: TValue): TValue;
/**
* Get a user preference
* @param user The user
Expand Down
23 changes: 10 additions & 13 deletions apps/meteor/app/webrtc/client/WebRTCClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import type { IRoom } from '@rocket.chat/core-typings';
import type { StreamKeys, StreamNames, StreamerCallbackArgs } from '@rocket.chat/ddp-client';
import { Emitter } from '@rocket.chat/emitter';
import { GenericModal, imperativeModal } from '@rocket.chat/ui-client';
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';

import { ChromeScreenShare } from './screenShare';
import { settings } from '../../../client/lib/settings';
import { getUserId } from '../../../client/lib/user';
import { goToRoomById } from '../../../client/lib/utils/goToRoomById';
import { Subscriptions, Users } from '../../../client/stores';
import { sdk } from '../../utils/client/lib/SDKClient';
Expand Down Expand Up @@ -1035,31 +1035,28 @@ const WebRTC = new (class {
}
switch (subscription.t) {
case 'd':
enabled = settings.watch('WebRTC_Enable_Direct') ?? false;
enabled = settings.peek('WebRTC_Enable_Direct') ?? false;
break;
case 'p':
enabled = settings.watch('WebRTC_Enable_Private') ?? false;
enabled = settings.peek('WebRTC_Enable_Private') ?? false;
break;
case 'c':
enabled = settings.watch('WebRTC_Enable_Channel') ?? false;
enabled = settings.peek('WebRTC_Enable_Channel') ?? false;
break;
case 'l':
enabled = settings.watch<string>('Omnichannel_call_provider') === 'WebRTC';
enabled = settings.peek<string>('Omnichannel_call_provider') === 'WebRTC';
}
} else {
enabled = settings.watch<string>('Omnichannel_call_provider') === 'WebRTC';
enabled = settings.peek<string>('Omnichannel_call_provider') === 'WebRTC';
}
enabled = enabled && (settings.watch('WebRTC_Enabled') ?? false);
enabled = enabled && (settings.peek('WebRTC_Enabled') ?? false);
if (enabled === false) {
return;
}
if (this.instancesByRoomId[rid] == null) {
let uid = Meteor.userId()!;
let autoAccept = false;
if (visitorId) {
uid = visitorId;
autoAccept = true;
}
const uid = visitorId ?? getUserId();
if (!uid) return undefined;
const autoAccept = !!visitorId;
this.instancesByRoomId[rid] = new WebRTCClass(uid, rid, autoAccept);
}
return this.instancesByRoomId[rid];
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/client/apps/RealAppsEngineUIHost.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { AppsEngineUIHost } from '@rocket.chat/apps-engine/client/AppsEngineUIHost';
import type { IExternalComponentRoomInfo, IExternalComponentUserInfo } from '@rocket.chat/apps-engine/client/definition';
import { Meteor } from 'meteor/meteor';

import { getUserAvatarURL } from '../../app/utils/client/getUserAvatarURL';
import { sdk } from '../../app/utils/client/lib/SDKClient';
import { RoomManager } from '../lib/RoomManager';
import { baseURI } from '../lib/baseURI';
import { getUser } from '../lib/user';
import { Rooms } from '../stores';

// FIXME: replace non-null assertions with proper error handling
Expand Down Expand Up @@ -59,7 +59,7 @@ export class RealAppsEngineUIHost extends AppsEngineUIHost {
}

async getClientUserInfo(): Promise<IExternalComponentUserInfo> {
const { username, _id } = Meteor.user()!;
const { username, _id } = getUser()!;

return {
id: _id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { IPermission } from '@rocket.chat/core-typings';

import { PrivateCachedStore } from '../lib/cachedStores';
import { PrivateCachedStore } from '../lib/cachedStores/CachedStore';
import { Permissions } from '../stores';

export const PermissionsCachedStore = new PrivateCachedStore<IPermission>({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ISetting } from '@rocket.chat/core-typings';

import { sdk } from '../../app/utils/client/lib/SDKClient';
import { PrivateCachedStore } from '../lib/cachedStores';
import { PrivateCachedStore } from '../lib/cachedStores/CachedStore';
import { PrivateSettings } from '../stores';

class PrivateSettingsCachedStore extends PrivateCachedStore<ISetting> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ISetting } from '@rocket.chat/core-typings';

import { PublicCachedStore } from '../lib/cachedStores';
import { PublicCachedStore } from '../lib/cachedStores/CachedStore';
import { PublicSettings } from '../stores';

class PublicSettingsCachedStore extends PublicCachedStore<ISetting> {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/client/cachedStores/RoomsCachedStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { IOmnichannelRoom, IRoom, IRoomWithRetentionPolicy } from '@rocket.
import { DEFAULT_SLA_CONFIG, isRoomNativeFederated, LivechatPriorityWeight } from '@rocket.chat/core-typings';
import type { SubscriptionWithRoom } from '@rocket.chat/ui-contexts';

import { PrivateCachedStore } from '../lib/cachedStores';
import { PrivateCachedStore } from '../lib/cachedStores/CachedStore';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

🧩 Analysis chain

Import path migration looks correct; verify consistent exports/usages repo-wide.

Directly importing from the concrete module reduces barrel coupling and potential cycles. Please confirm the symbol is a named export at the new path and that no files still import from the old barrel.

Run:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "1) Confirm PrivateCachedStore is exported from CachedStore.ts"
rg -nP '\bexport\b[^{\n]*\bPrivateCachedStore\b|\bexport\s*{\s*[^}]*\bPrivateCachedStore\b' -g '**/CachedStore.ts'

echo "2) Find lingering barrel imports from ../lib/cachedStores"
rg -nP --type ts --type tsx -n -C1 "from ['\"]\.\.\/lib\/cachedStores['\"]"

echo "3) Detect default imports of PrivateCachedStore (should be named)"
rg -nP --type ts --type tsx -n "import\s+PrivateCachedStore\s+from"

echo "4) Confirm consistent direct imports to CachedStore"
rg -nP --type ts --type tsx -n -C1 "from ['\"][^\"]*lib\/cachedStores\/CachedStore['\"]"

Length of output: 298


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "1) Confirm PrivateCachedStore is exported (show surrounding lines)"
rg -nP -C2 "export\s+class\s+PrivateCachedStore\b" apps/meteor/client/lib/cachedStores/CachedStore.ts || true

echo
echo "2) Find imports that reference 'lib/cachedStores' but NOT '/CachedStore' (possible barrel/index imports)"
rg -nP -C1 "from\s+['\"][^'\"]*lib\/cachedStores(?!\/CachedStore)[^'\"]*['\"]" || true

echo
echo "3) Find direct imports from 'lib/cachedStores/CachedStore'"
rg -nP -C1 "from\s+['\"][^'\"]*lib\/cachedStores\/CachedStore['\"]" || true

echo
echo "4) Detect default imports of PrivateCachedStore"
rg -nP -n "import\s+PrivateCachedStore\s+from\s+['\"][^'\"]+['\"]" || true

echo
echo "5) List any occurrences of 'lib/cachedStores' for manual inspection"
rg -nP -n -C1 "lib\/cachedStores" || true

Length of output: 8527


PrivateCachedStore is a named export; update remaining barrel imports

  • Verified: export class PrivateCachedStore exists at apps/meteor/client/lib/cachedStores/CachedStore.ts:382.
  • No default-import usages detected.
  • Action: replace barrel imports from '../cachedStores' with direct named imports from '../lib/cachedStores/CachedStore' where present — e.g. apps/meteor/client/providers/SettingsProvider.tsx:9 (import { PublicSettingsCachedStore, PrivateSettingsCachedStore } from '../cachedStores';).
🤖 Prompt for AI Agents
In apps/meteor/client/cachedStores/RoomsCachedStore.ts around line 5, the file
imports PrivateCachedStore via a barrel path; PrivateCachedStore is a named
export declared in apps/meteor/client/lib/cachedStores/CachedStore.ts so update
the import to import { PrivateCachedStore } from
'../lib/cachedStores/CachedStore'; and replace any other usages that import from
'../cachedStores' with direct named imports from
'../lib/cachedStores/CachedStore' (e.g., change imports in providers like
SettingsProvider.tsx) so they reference the concrete module where the class is
exported.

import { Rooms, Subscriptions } from '../stores';

class RoomsCachedStore extends PrivateCachedStore<IRoom> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { IOmnichannelRoom, IRoomWithRetentionPolicy, ISubscription } from '
import { DEFAULT_SLA_CONFIG, isRoomNativeFederated, LivechatPriorityWeight } from '@rocket.chat/core-typings';
import type { SubscriptionWithRoom } from '@rocket.chat/ui-contexts';

import { PrivateCachedStore } from '../lib/cachedStores';
import { PrivateCachedStore } from '../lib/cachedStores/CachedStore';
import { Rooms, Subscriptions } from '../stores';

class SubscriptionsCachedStore extends PrivateCachedStore<SubscriptionWithRoom, ISubscription> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const createDeleteCriteria = (params: NotifyRoomRidDeleteBulkEvent): ((message:
return createPredicateFromFilter(query);
};

export const useStreamUpdatesForMessageList = (messageList: MessageList, uid: IUser['_id'] | null, rid: IRoom['_id'] | null): void => {
export const useStreamUpdatesForMessageList = (messageList: MessageList, uid: IUser['_id'] | undefined, rid: IRoom['_id'] | null): void => {
const subscribeToRoomMessages = useStream('room-messages');
const subscribeToNotifyRoom = useStream('notify-room');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useRoom, useRoomSubscription } from '../../views/room/contexts/RoomCont
import type { RoomToolboxActionConfig } from '../../views/room/contexts/RoomToolboxContext';
import { useUserInfoQuery } from '../useUserInfoQuery';

const getPeerId = (uids: string[], ownUserId: string | null) => {
const getPeerId = (uids: string[], ownUserId: string | undefined) => {
if (!ownUserId) {
return undefined;
}
Expand Down
3 changes: 2 additions & 1 deletion apps/meteor/client/hooks/useIdleConnection.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { IUser } from '@rocket.chat/core-typings';
import { useEffectEvent } from '@rocket.chat/fuselage-hooks';
import { useConnectionStatus, useSetting } from '@rocket.chat/ui-contexts';

import { useIdleActiveEvents } from './useIdleActiveEvents';

export const useIdleConnection = (uid: string | null) => {
export const useIdleConnection = (uid: IUser['_id'] | undefined) => {
const { status } = useConnectionStatus();
const allowAnonymousRead = useSetting('Accounts_AllowAnonymousRead');
const { disconnect: disconnectServer, reconnect: reconnectServer } = useConnectionStatus();
Expand Down
Loading
Loading