Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.
Draft
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
7 changes: 7 additions & 0 deletions src/definition/messages/IDiscussionMessage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { IMessage } from '.';

export interface IDiscussionMessage extends IMessage {
drid: string;
dlm?: Date;
dcount: number;
}
35 changes: 35 additions & 0 deletions src/server/bridges/RoomBridge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { IMessage, IMessageRaw } from '../../definition/messages';
import { IDiscussionMessage } from '../../definition/messages/IDiscussionMessage';
import type { IRoom } from '../../definition/rooms';
import type { IUser } from '../../definition/users';
import { PermissionDeniedError } from '../errors/PermissionDeniedError';
Expand Down Expand Up @@ -67,6 +68,25 @@ export abstract class RoomBridge extends BaseBridge {
}
}

public async doGetDiscussions(
roomId: string,
options: {
limit: number;
skip?: number;
sort?: Record<string, 1 | -1>;
},
appId: string,
): Promise<{
messages: IDiscussionMessage[];
count: number;
offset: number;
total: number;
}> {
if (this.hasReadPermission(appId)) {
return this.getDiscussions(roomId, options, appId);
}
}

public async doDelete(room: string, appId: string): Promise<void> {
if (this.hasWritePermission(appId)) {
return this.delete(room, appId);
Expand Down Expand Up @@ -129,6 +149,21 @@ export abstract class RoomBridge extends BaseBridge {
appId: string,
): Promise<string>;

protected abstract getDiscussions(
rid: string,
options: {
limit: number;
offset?: number;
sort?: Record<string, 1 | -1>;
},
_appId: string,
): Promise<{
messages: IDiscussionMessage[];
count: number;
offset: number;
total: number;
}>;

protected abstract delete(room: string, appId: string): Promise<void>;

protected abstract getModerators(roomId: string, appId: string): Promise<Array<IUser>>;
Expand Down