The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/apps/server/bridges/internal.ts

38 lines
1.1 KiB

import { InternalBridge } from '@rocket.chat/apps-engine/server/bridges/InternalBridge';
import { ISetting } from '@rocket.chat/apps-engine/definition/settings';
import { AppServerOrchestrator } from '../orchestrator';
import { Subscriptions } from '../../../models/server';
import { ISubscription } from '../../../../definition/ISubscription';
import { Settings } from '../../../models/server/raw';
export class AppInternalBridge extends InternalBridge {
// eslint-disable-next-line no-empty-function
constructor(private readonly orch: AppServerOrchestrator) {
super();
}
protected getUsernamesOfRoomById(roomId: string): Array<string> {
if (!roomId) {
return [];
}
const records = Subscriptions.findByRoomIdWhenUsernameExists(roomId, {
fields: {
'u.username': 1,
},
}).fetch();
if (!records || records.length === 0) {
return [];
}
return records.map((s: ISubscription) => s.u.username);
}
protected async getWorkspacePublicKey(): Promise<ISetting> {
const publicKeySetting = await Settings.findOneById('Cloud_Workspace_PublicKey');
return this.orch.getConverters()?.get('settings').convertToApp(publicKeySetting);
}
}