snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
This commit is contained in:
10
apps/meteor/client/cachedStores/PermissionsCachedStore.ts
Normal file
10
apps/meteor/client/cachedStores/PermissionsCachedStore.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { IPermission } from '@rocket.chat/core-typings';
|
||||
|
||||
import { PrivateCachedStore } from '../lib/cachedStores/CachedStore';
|
||||
import { Permissions } from '../stores';
|
||||
|
||||
export const PermissionsCachedStore = new PrivateCachedStore<IPermission>({
|
||||
name: 'permissions',
|
||||
eventType: 'notify-logged',
|
||||
store: Permissions.use,
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
import type { ISetting } from '@rocket.chat/core-typings';
|
||||
|
||||
import { sdk } from '../lib/SDKClient';
|
||||
import { PrivateCachedStore } from '../lib/cachedStores/CachedStore';
|
||||
import { PrivateSettings } from '../stores';
|
||||
|
||||
class PrivateSettingsCachedStore extends PrivateCachedStore<ISetting> {
|
||||
constructor() {
|
||||
super({
|
||||
name: 'private-settings',
|
||||
eventType: 'notify-logged',
|
||||
store: PrivateSettings.use,
|
||||
});
|
||||
}
|
||||
|
||||
override setupListener() {
|
||||
return sdk.stream('notify-logged', ['private-settings-changed'], async (t, setting) => {
|
||||
this.log('record received', t, setting);
|
||||
const { _id, ...fields } = setting;
|
||||
this.store.getState().update(
|
||||
(record) => record._id === _id,
|
||||
(record) => ({ ...record, ...fields }),
|
||||
);
|
||||
this.sync();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const instance = new PrivateSettingsCachedStore();
|
||||
|
||||
export { instance as PrivateSettingsCachedStore };
|
||||
18
apps/meteor/client/cachedStores/PublicSettingsCachedStore.ts
Normal file
18
apps/meteor/client/cachedStores/PublicSettingsCachedStore.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { ISetting } from '@rocket.chat/core-typings';
|
||||
|
||||
import { PublicCachedStore } from '../lib/cachedStores/CachedStore';
|
||||
import { PublicSettings } from '../stores';
|
||||
|
||||
class PublicSettingsCachedStore extends PublicCachedStore<ISetting> {
|
||||
constructor() {
|
||||
super({
|
||||
name: 'public-settings',
|
||||
eventType: 'notify-all',
|
||||
store: PublicSettings.use,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const instance = new PublicSettingsCachedStore();
|
||||
|
||||
export { instance as PublicSettingsCachedStore };
|
||||
119
apps/meteor/client/cachedStores/RoomsCachedStore.ts
Normal file
119
apps/meteor/client/cachedStores/RoomsCachedStore.ts
Normal file
@@ -0,0 +1,119 @@
|
||||
import type { IOmnichannelRoom, IRoom, IRoomWithRetentionPolicy } from '@rocket.chat/core-typings';
|
||||
import { DEFAULT_SLA_CONFIG, isRoomNativeFederated, LivechatPriorityWeight } from '@rocket.chat/core-typings';
|
||||
import type { SubscriptionWithRoom } from '@rocket.chat/ui-contexts';
|
||||
|
||||
import { PrivateCachedStore } from '../lib/cachedStores/CachedStore';
|
||||
import { Rooms, Subscriptions } from '../stores';
|
||||
|
||||
class RoomsCachedStore extends PrivateCachedStore<IRoom> {
|
||||
constructor() {
|
||||
super({
|
||||
name: 'rooms',
|
||||
eventType: 'notify-user',
|
||||
store: Rooms.use,
|
||||
});
|
||||
}
|
||||
|
||||
private merge(room: IRoom, sub: SubscriptionWithRoom): SubscriptionWithRoom {
|
||||
return {
|
||||
...sub,
|
||||
encrypted: room.encrypted,
|
||||
description: room.description,
|
||||
cl: room.cl,
|
||||
topic: room.topic,
|
||||
announcement: room.announcement,
|
||||
broadcast: room.broadcast || undefined,
|
||||
archived: room.archived,
|
||||
avatarETag: room.avatarETag,
|
||||
retention: (room as IRoomWithRetentionPolicy | undefined)?.retention,
|
||||
uids: room.uids,
|
||||
usernames: room.usernames,
|
||||
usersCount: room.usersCount,
|
||||
lastMessage: room.lastMessage,
|
||||
teamId: room.teamId,
|
||||
teamMain: room.teamMain,
|
||||
v: (room as IOmnichannelRoom | undefined)?.v,
|
||||
transcriptRequest: (room as IOmnichannelRoom | undefined)?.transcriptRequest,
|
||||
servedBy: (room as IOmnichannelRoom | undefined)?.servedBy,
|
||||
onHold: (room as IOmnichannelRoom | undefined)?.onHold,
|
||||
tags: (room as IOmnichannelRoom | undefined)?.tags,
|
||||
closedAt: (room as IOmnichannelRoom | undefined)?.closedAt,
|
||||
metrics: (room as IOmnichannelRoom | undefined)?.metrics,
|
||||
muted: room.muted,
|
||||
waitingResponse: (room as IOmnichannelRoom | undefined)?.waitingResponse,
|
||||
responseBy: (room as IOmnichannelRoom | undefined)?.responseBy,
|
||||
priorityId: (room as IOmnichannelRoom | undefined)?.priorityId,
|
||||
priorityWeight: (room as IOmnichannelRoom | undefined)?.priorityWeight || LivechatPriorityWeight.NOT_SPECIFIED,
|
||||
estimatedWaitingTimeQueue:
|
||||
(room as IOmnichannelRoom | undefined)?.estimatedWaitingTimeQueue || DEFAULT_SLA_CONFIG.ESTIMATED_WAITING_TIME_QUEUE,
|
||||
slaId: (room as IOmnichannelRoom | undefined)?.slaId,
|
||||
livechatData: (room as IOmnichannelRoom | undefined)?.livechatData,
|
||||
departmentId: (room as IOmnichannelRoom | undefined)?.departmentId,
|
||||
ts: room.ts ?? sub.ts,
|
||||
source: (room as IOmnichannelRoom | undefined)?.source,
|
||||
queuedAt: (room as IOmnichannelRoom | undefined)?.queuedAt,
|
||||
federated: room.federated,
|
||||
abacAttributes: room.abacAttributes,
|
||||
...(isRoomNativeFederated(room) && {
|
||||
federation: room.federation,
|
||||
}),
|
||||
...(() => {
|
||||
const name = room.name || sub.name;
|
||||
const fname = room.fname || sub.fname || name;
|
||||
return {
|
||||
lowerCaseName: String(!room.prid ? name : fname).toLowerCase(),
|
||||
lowerCaseFName: String(fname).toLowerCase(),
|
||||
};
|
||||
})(),
|
||||
lm: (sub.lm?.getTime() ?? -1) < (room.lm?.getTime() ?? -1) ? room.lm : sub.lm,
|
||||
};
|
||||
}
|
||||
|
||||
protected override handleLoadedFromServer(rooms: IRoom[]): void {
|
||||
const indexedSubscriptions = Subscriptions.use.getState().indexBy('rid');
|
||||
|
||||
const subscriptionsWithRoom = rooms.flatMap((room) => {
|
||||
const sub = indexedSubscriptions.get(room._id);
|
||||
|
||||
if (!sub) return [];
|
||||
|
||||
return this.merge(room, sub);
|
||||
});
|
||||
|
||||
Subscriptions.use.getState().storeMany(subscriptionsWithRoom);
|
||||
}
|
||||
|
||||
protected override async handleRecordEvent(action: 'removed' | 'changed', room: IRoom) {
|
||||
await super.handleRecordEvent(action, room);
|
||||
|
||||
if (action === 'removed') return;
|
||||
|
||||
Subscriptions.use.getState().update(
|
||||
(record) => record.rid === room._id,
|
||||
(sub) => this.merge(room, sub),
|
||||
);
|
||||
}
|
||||
|
||||
protected override handleSyncEvent(action: 'removed' | 'changed', room: IRoom): void {
|
||||
if (action === 'removed') return;
|
||||
|
||||
Subscriptions.use.getState().update(
|
||||
(record) => record.rid === room._id,
|
||||
(sub) => this.merge(room, sub),
|
||||
);
|
||||
}
|
||||
|
||||
protected override deserializeFromCache(record: unknown) {
|
||||
const deserialized = super.deserializeFromCache(record);
|
||||
|
||||
if (deserialized?.lastMessage?._updatedAt) {
|
||||
deserialized.lastMessage._updatedAt = new Date(deserialized.lastMessage._updatedAt);
|
||||
}
|
||||
|
||||
return deserialized;
|
||||
}
|
||||
}
|
||||
|
||||
const instance = new RoomsCachedStore();
|
||||
|
||||
export { instance as RoomsCachedStore };
|
||||
95
apps/meteor/client/cachedStores/SubscriptionsCachedStore.ts
Normal file
95
apps/meteor/client/cachedStores/SubscriptionsCachedStore.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import type { IOmnichannelRoom, IRoomWithRetentionPolicy, ISubscription } from '@rocket.chat/core-typings';
|
||||
import { DEFAULT_SLA_CONFIG, isRoomNativeFederated, LivechatPriorityWeight } from '@rocket.chat/core-typings';
|
||||
import type { SubscriptionWithRoom } from '@rocket.chat/ui-contexts';
|
||||
|
||||
import { PrivateCachedStore } from '../lib/cachedStores/CachedStore';
|
||||
import { Rooms, Subscriptions } from '../stores';
|
||||
|
||||
class SubscriptionsCachedStore extends PrivateCachedStore<SubscriptionWithRoom, ISubscription> {
|
||||
constructor() {
|
||||
super({
|
||||
name: 'subscriptions',
|
||||
eventType: 'notify-user',
|
||||
store: Subscriptions.use,
|
||||
});
|
||||
}
|
||||
|
||||
protected override mapRecord(subscription: ISubscription): SubscriptionWithRoom {
|
||||
const room = Rooms.use.getState().find((r) => r._id === subscription.rid);
|
||||
|
||||
const lastRoomUpdate = room?.lm || subscription.ts || room?.ts;
|
||||
|
||||
return {
|
||||
...subscription,
|
||||
...(() => {
|
||||
const { name } = subscription;
|
||||
const fname = subscription.fname || name;
|
||||
return {
|
||||
lowerCaseName: String(!subscription.prid ? name : fname).toLowerCase(),
|
||||
lowerCaseFName: String(fname).toLowerCase(),
|
||||
};
|
||||
})(),
|
||||
encrypted: room?.encrypted,
|
||||
description: room?.description,
|
||||
cl: room?.cl,
|
||||
topic: room?.topic,
|
||||
announcement: room?.announcement,
|
||||
broadcast: room?.broadcast || undefined,
|
||||
archived: room?.archived,
|
||||
avatarETag: room?.avatarETag,
|
||||
retention: (room as IRoomWithRetentionPolicy | undefined)?.retention,
|
||||
lastMessage: room?.lastMessage,
|
||||
teamId: room?.teamId,
|
||||
teamMain: room?.teamMain,
|
||||
uids: room?.uids,
|
||||
usernames: room?.usernames,
|
||||
usersCount: room?.usersCount ?? 0,
|
||||
v: (room as IOmnichannelRoom | undefined)?.v,
|
||||
transcriptRequest: (room as IOmnichannelRoom | undefined)?.transcriptRequest,
|
||||
servedBy: (room as IOmnichannelRoom | undefined)?.servedBy,
|
||||
onHold: (room as IOmnichannelRoom | undefined)?.onHold,
|
||||
tags: (room as IOmnichannelRoom | undefined)?.tags,
|
||||
closedAt: (room as IOmnichannelRoom | undefined)?.closedAt,
|
||||
metrics: (room as IOmnichannelRoom | undefined)?.metrics,
|
||||
muted: room?.muted,
|
||||
waitingResponse: (room as IOmnichannelRoom | undefined)?.waitingResponse,
|
||||
responseBy: (room as IOmnichannelRoom | undefined)?.responseBy,
|
||||
priorityId: (room as IOmnichannelRoom | undefined)?.priorityId,
|
||||
slaId: (room as IOmnichannelRoom | undefined)?.slaId,
|
||||
priorityWeight: (room as IOmnichannelRoom | undefined)?.priorityWeight || LivechatPriorityWeight.NOT_SPECIFIED,
|
||||
estimatedWaitingTimeQueue:
|
||||
(room as IOmnichannelRoom | undefined)?.estimatedWaitingTimeQueue || DEFAULT_SLA_CONFIG.ESTIMATED_WAITING_TIME_QUEUE,
|
||||
livechatData: (room as IOmnichannelRoom | undefined)?.livechatData,
|
||||
departmentId: (room as IOmnichannelRoom | undefined)?.departmentId,
|
||||
ts: room?.ts ?? subscription.ts,
|
||||
source: (room as IOmnichannelRoom | undefined)?.source,
|
||||
queuedAt: (room as IOmnichannelRoom | undefined)?.queuedAt,
|
||||
federated: room?.federated,
|
||||
|
||||
...(room &&
|
||||
isRoomNativeFederated(room) && {
|
||||
federation: room.federation,
|
||||
}),
|
||||
|
||||
lm: subscription.lr ? new Date(Math.max(subscription.lr.getTime(), lastRoomUpdate?.getTime() || 0)) : lastRoomUpdate,
|
||||
};
|
||||
}
|
||||
|
||||
async upsertSubscription(record: ISubscription): Promise<void> {
|
||||
return this.handleRecordEvent('changed', record);
|
||||
}
|
||||
|
||||
protected override deserializeFromCache(record: unknown) {
|
||||
const deserialized = super.deserializeFromCache(record);
|
||||
|
||||
if (deserialized?.lastMessage?._updatedAt) {
|
||||
deserialized.lastMessage._updatedAt = new Date(deserialized.lastMessage._updatedAt);
|
||||
}
|
||||
|
||||
return deserialized;
|
||||
}
|
||||
}
|
||||
|
||||
const instance = new SubscriptionsCachedStore();
|
||||
|
||||
export { instance as SubscriptionsCachedStore };
|
||||
5
apps/meteor/client/cachedStores/index.ts
Normal file
5
apps/meteor/client/cachedStores/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export { PermissionsCachedStore } from './PermissionsCachedStore';
|
||||
export { PrivateSettingsCachedStore } from './PrivateSettingsCachedStore';
|
||||
export { PublicSettingsCachedStore } from './PublicSettingsCachedStore';
|
||||
export { RoomsCachedStore } from './RoomsCachedStore';
|
||||
export { SubscriptionsCachedStore } from './SubscriptionsCachedStore';
|
||||
Reference in New Issue
Block a user