Make force-loaded channels stay open when all participants leave

This commit is contained in:
Hri7566 2024-01-22 16:53:42 -05:00
parent b6e9ccd441
commit 00ec1f5640
1 changed files with 5 additions and 5 deletions

View File

@ -53,14 +53,14 @@ export class Channel extends EventEmitter {
public logger: Logger;
public chatHistory = new Array<ClientEvents["a"]>();
// TODO Add the crown
public crown?: Crown;
constructor(
private _id: string,
set?: Partial<IChannelSettings>,
creator?: Socket,
owner_id?: string
owner_id?: string,
public stays: boolean = false
) {
super();
@ -120,7 +120,7 @@ export class Channel extends EventEmitter {
}
}
if (this.ppl.length == 0) {
if (this.ppl.length == 0 && !this.stays) {
this.destroy();
}
});
@ -562,10 +562,10 @@ export default Channel;
let hasFullChannel = false;
for (const id of config.forceLoad) {
new Channel(id);
new Channel(id, undefined, undefined, undefined, true);
if (id == config.fullChannel) hasFullChannel = true;
}
if (!hasFullChannel) {
new Channel(config.fullChannel);
new Channel(config.fullChannel, undefined, undefined, undefined, true);
}