1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-09-20 06:08:46 +00:00

Can be automatically be notified of comments creation

This commit is contained in:
2020-04-01 17:51:33 +02:00
parent 21ba8eff25
commit 53d121708d
7 changed files with 89 additions and 8 deletions

View File

@@ -15,8 +15,9 @@ import { PostAccessLevel } from "./Post";
import { CommentsHelper } from "../helpers/CommentsHelper";
import { checkVirtualDirectory } from "../utils/VirtualDirsUtils";
import { ConversationsHelper } from "../helpers/ConversationsHelper";
import { AbstractUserConnectionContainer } from "./UserConnectionContainer";
export abstract class BaseRequestsHandler {
export abstract class BaseRequestsHandler implements AbstractUserConnectionContainer {
protected abstract get userID() : number;

View File

@@ -0,0 +1,29 @@
/**
* Simple user connection container
*
* @author Pierre Hubert
*/
export abstract class AbstractUserConnectionContainer {
public abstract getUserId() : number;
public abstract get signedIn() : boolean;
}
/**
* Fake user connnection checker used for notifications in WebSockets
*/
export class AbritraryUserConnection implements AbstractUserConnectionContainer {
constructor(private userID: number) {}
public getUserId(): number {
if(!this.signedIn)
throw new Error("User is not signed in!");
return this.userID;
}
public get signedIn(): boolean {
return this.userID > 0;
}
}