Make force-loaded channels stay open when all participants leave
This commit is contained in:
parent
b6e9ccd441
commit
00ec1f5640
|
@ -53,14 +53,14 @@ export class Channel extends EventEmitter {
|
||||||
public logger: Logger;
|
public logger: Logger;
|
||||||
public chatHistory = new Array<ClientEvents["a"]>();
|
public chatHistory = new Array<ClientEvents["a"]>();
|
||||||
|
|
||||||
// TODO Add the crown
|
|
||||||
public crown?: Crown;
|
public crown?: Crown;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _id: string,
|
private _id: string,
|
||||||
set?: Partial<IChannelSettings>,
|
set?: Partial<IChannelSettings>,
|
||||||
creator?: Socket,
|
creator?: Socket,
|
||||||
owner_id?: string
|
owner_id?: string,
|
||||||
|
public stays: boolean = false
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ export class Channel extends EventEmitter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.ppl.length == 0) {
|
if (this.ppl.length == 0 && !this.stays) {
|
||||||
this.destroy();
|
this.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -562,10 +562,10 @@ export default Channel;
|
||||||
let hasFullChannel = false;
|
let hasFullChannel = false;
|
||||||
|
|
||||||
for (const id of config.forceLoad) {
|
for (const id of config.forceLoad) {
|
||||||
new Channel(id);
|
new Channel(id, undefined, undefined, undefined, true);
|
||||||
if (id == config.fullChannel) hasFullChannel = true;
|
if (id == config.fullChannel) hasFullChannel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasFullChannel) {
|
if (!hasFullChannel) {
|
||||||
new Channel(config.fullChannel);
|
new Channel(config.fullChannel, undefined, undefined, undefined, true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue