Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.
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 docs/assets/search.js

Large diffs are not rendered by default.

44 changes: 37 additions & 7 deletions docs/interfaces/accessors_ILivechatRead.ILivechatRead.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rocket.chat/apps-engine",
"version": "1.41.1",
"version": "1.42.0-alpha",
"description": "The engine code for the Rocket.Chat Apps which manages, runs, translates, coordinates and all of that.",
"main": "index",
"typings": "index",
Expand Down
2 changes: 2 additions & 0 deletions src/definition/accessors/ILivechatRead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface ILivechatRead {
isOnlineAsync(departmentId?: string): Promise<boolean>;
getDepartmentsEnabledWithAgents(): Promise<Array<IDepartment>>;
getLivechatRooms(visitor: IVisitor, departmentId?: string): Promise<Array<ILivechatRoom>>;
getLivechatOpenRoomsByAgentId(agentId: string): Promise<Array<ILivechatRoom>>;
getLivechatTotalOpenRoomsByAgentId(agentId: string): Promise<number>;
/**
* @deprecated This method does not adhere to the conversion practices applied
* elsewhere in the Apps-Engine and will be removed in the next major version.
Expand Down
8 changes: 8 additions & 0 deletions src/server/accessors/LivechatRead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ export class LivechatRead implements ILivechatRead {
return this.livechatBridge.doFindRooms(visitor, departmentId, this.appId);
}

public getLivechatTotalOpenRoomsByAgentId(agentId: string): Promise<number> {
return this.livechatBridge.doCountOpenRoomsByAgentId(agentId, this.appId);
}

public getLivechatOpenRoomsByAgentId(agentId: string): Promise<Array<ILivechatRoom>> {
return this.livechatBridge.doFindOpenRoomsByAgentId(agentId, this.appId);
}

/**
* @deprecated This method does not adhere to the conversion practices applied
* elsewhere in the Apps-Engine and will be removed in the next major version.
Expand Down
16 changes: 16 additions & 0 deletions src/server/bridges/LivechatBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ export abstract class LivechatBridge extends BaseBridge {
}
}

public async doCountOpenRoomsByAgentId(agentId: string, appId: string): Promise<number> {
if (this.hasReadPermission(appId, 'livechat-room')) {
return this.countOpenRoomsByAgentId(agentId, appId);
}
}

public async doFindOpenRoomsByAgentId(agentId: string, appId: string): Promise<Array<ILivechatRoom>> {
if (this.hasReadPermission(appId, 'livechat-room')) {
return this.findOpenRoomsByAgentId(agentId, appId);
}
}

public async doFindRooms(visitor: IVisitor, departmentId: string | null, appId: string): Promise<Array<ILivechatRoom>> {
if (this.hasReadPermission(appId, 'livechat-room')) {
return this.findRooms(visitor, departmentId, appId);
Expand Down Expand Up @@ -171,6 +183,10 @@ export abstract class LivechatBridge extends BaseBridge {

protected abstract closeRoom(room: ILivechatRoom, comment: string, closer: IUser | undefined, appId: string): Promise<boolean>;

protected abstract countOpenRoomsByAgentId(agentId: string, appId: string): Promise<number>;

protected abstract findOpenRoomsByAgentId(agentId: string, appId: string): Promise<Array<ILivechatRoom>>;

protected abstract findRooms(visitor: IVisitor, departmentId: string | null, appId: string): Promise<Array<ILivechatRoom>>;

protected abstract findDepartmentByIdOrName(value: string, appId: string): Promise<IDepartment | undefined>;
Expand Down
8 changes: 8 additions & 0 deletions tests/test-data/bridges/livechatBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ export class TestLivechatBridge extends LivechatBridge {
throw new Error('Method not implemented');
}

public findOpenRoomsByAgentId(agentId: string, appId: string): Promise<ILivechatRoom[]> {
throw new Error('Method not implemented');
}

public countOpenRoomsByAgentId(agentId: string, appId: string): Promise<number> {
throw new Error('Method not implemented');
}

public findDepartmentByIdOrName(value: string, appId: string): Promise<IDepartment | undefined> {
throw new Error('Method not implemented');
}
Expand Down