Fixed some small stuff
parent
c0d17e8348
commit
df8136acb1
|
@ -31,7 +31,7 @@ export class Registry<Events> {
|
|||
handlers: {[key: string]: ((event) => void)[]}
|
||||
}[] = [];
|
||||
private debug_prefix = undefined;
|
||||
private warn_unhandled_events = true;
|
||||
private warn_unhandled_events = false;
|
||||
|
||||
constructor() {
|
||||
this.registry_uuid = "evreg_data_" + guid();
|
||||
|
@ -139,7 +139,7 @@ export class Registry<Events> {
|
|||
evhandler.fire_event(type, data);
|
||||
invoke_count++;
|
||||
}
|
||||
if(invoke_count === 0) {
|
||||
if(this.warn_unhandled_events && invoke_count === 0) {
|
||||
console.warn(tr("Event handler (%s) triggered event %s which has no consumers."), this.debug_prefix, type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -441,7 +441,7 @@ export class ChannelEntry extends ChannelTreeEntry<ChannelEvents> {
|
|||
name: tr("Edit channel"),
|
||||
invalidPermission: !channelModify,
|
||||
callback: () => {
|
||||
createChannelModal(this.channelTree.client, this, undefined, this.channelTree.client.permissions, (changes?, permissions?) => {
|
||||
createChannelModal(this.channelTree.client, this, this.parent, this.channelTree.client.permissions, (changes?, permissions?) => {
|
||||
if(changes) {
|
||||
changes["cid"] = this.channelId;
|
||||
this.channelTree.client.serverConnection.send_command("channeledit", changes);
|
||||
|
|
|
@ -358,11 +358,15 @@ export class ChannelTree {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
private unregisterChannelFromTree(channel: ChannelEntry) {
|
||||
private unregisterChannelFromTree(channel: ChannelEntry, new_parent?: ChannelEntry) {
|
||||
if(channel.parent) {
|
||||
if(channel.parent.child_channel_head === channel)
|
||||
channel.parent.child_channel_head = channel.channel_next;
|
||||
channel.parent.events.fire("notify_children_changed");
|
||||
|
||||
/* We need only trigger this once.
|
||||
If the new parent is equal to the old one with applying the "new" parent this event will get triggered */
|
||||
if(new_parent !== channel.parent)
|
||||
channel.parent.events.fire("notify_children_changed");
|
||||
}
|
||||
|
||||
if(channel.channel_previous)
|
||||
|
@ -389,7 +393,7 @@ export class ChannelTree {
|
|||
}
|
||||
|
||||
let root_tree_updated = !channel.parent;
|
||||
this.unregisterChannelFromTree(channel);
|
||||
this.unregisterChannelFromTree(channel, parent);
|
||||
channel.channel_previous = channel_previous;
|
||||
channel.channel_next = undefined;
|
||||
channel.parent = parent;
|
||||
|
@ -415,8 +419,6 @@ export class ChannelTree {
|
|||
if(children.length === 0) { //Self should be already in there
|
||||
channel.channel_next = undefined;
|
||||
} else {
|
||||
channel.channel_previous = undefined;
|
||||
|
||||
channel.channel_next = children[0];
|
||||
channel.channel_next.channel_previous = channel;
|
||||
}
|
||||
|
|
|
@ -345,9 +345,11 @@ export class ServerConnection extends AbstractServerConnection {
|
|||
return;
|
||||
}
|
||||
if(json["type"] === "command") {
|
||||
/* devel-block(log-networking-commands) */
|
||||
let group = log.group(log.LogType.DEBUG, LogCategory.NETWORKING, tr("Handling command '%s'"), json["command"]);
|
||||
group.log(tr("Handling command '%s'"), json["command"]);
|
||||
group.group(log.LogType.TRACE, tr("Json:")).collapsed(true).log("%o", json).end();
|
||||
/* devel-block-end */
|
||||
|
||||
this._command_boss.invoke_handle({
|
||||
command: json["command"],
|
||||
|
@ -361,7 +363,9 @@ export class ServerConnection extends AbstractServerConnection {
|
|||
if(this._voice_connection)
|
||||
this._voice_connection.start_rtc_session(); /* FIXME: Move it to a handler boss and not here! */
|
||||
}
|
||||
/* devel-block(log-networking-commands) */
|
||||
group.end();
|
||||
/* devel-block-end */
|
||||
} else if(json["type"] === "WebRTC") {
|
||||
if(this._voice_connection)
|
||||
this._voice_connection.handleControlPacket(json);
|
||||
|
|
|
@ -77,10 +77,7 @@ export namespace codec {
|
|||
this.entries[index].instance.initialise().then((flag) => {
|
||||
//TODO test success flag
|
||||
this.ownCodec(clientId, callback_encoded, false).then(resolve).catch(reject);
|
||||
}).catch(error => {
|
||||
log.error(LogCategory.VOICE, tr("Could not initialize codec!\nError: %o"), error);
|
||||
reject(typeof(error) === 'string' ? error : tr("Could not initialize codec!"));
|
||||
});
|
||||
}).catch(reject);
|
||||
}
|
||||
return;
|
||||
} else if(this.entries[index].owner == 0) {
|
||||
|
|
|
@ -18,6 +18,9 @@ export default function loader(this: LoaderContext, source: string | Buffer, sou
|
|||
|
||||
const pattern = new RegExp("[\\t ]*\\/\\* ?" + start_regex + " ?\\*\\/[\\s\\S]*?\\/\\* ?" + end_regex + " ?\\*\\/[\\t ]*\\n?", "g");
|
||||
source = (source as string).replace(pattern, (value, type) => {
|
||||
if(type === "log-networking-commands")
|
||||
return value;
|
||||
|
||||
return "/* snipped block \"" + type + "\" */";
|
||||
});
|
||||
this.callback(null, source);
|
||||
|
|
Loading…
Reference in New Issue