Fixed missing channel tree update on talk power change

canary
WolverinDEV 2020-04-25 17:42:18 +02:00
parent 5b83bd9b51
commit 9dfa948105
4 changed files with 29 additions and 4 deletions

View File

@ -1,4 +1,7 @@
# Changelog:
* **25.04.20**
- Fixed missing channel tree update on talk power change
* **21.04.20**
- Clicking on the music bot does not longer results in the insufficient permission sound when the client has no permissions
- Fixed permission editor overflow

View File

@ -55,7 +55,7 @@ export class ChannelProperties {
channel_maxclients: number = -1;
channel_maxfamilyclients: number = -1;
channel_needed_talk_power: number = 1;
channel_needed_talk_power: number = 0;
channel_flag_permanent: boolean = false;
channel_flag_semi_permanent: boolean = false;

View File

@ -14,7 +14,7 @@ import {ChannelEntryView as ChannelEntryView} from "./Channel";
import {ServerEntry as ServerEntryView} from "./Server";
import {ClientEntry as ClientEntryView} from "./Client";
import {ChannelEntry} from "tc-shared/ui/channel";
import {ChannelEntry, ChannelEvents} from "tc-shared/ui/channel";
import {ServerEntry} from "tc-shared/ui/server";
import {ClientEntry, ClientType} from "tc-shared/ui/client";
@ -54,6 +54,8 @@ export class ChannelTreeView extends ReactComponentBase<ChannelTreeViewPropertie
private listener_client_change;
private listener_channel_change;
private listener_state_collapsed;
private listener_channel_properties;
private update_timeout;
private mouse_move: { x: number, y: number, down: boolean, fired: boolean } = { x: 0, y: 0, down: false, fired: false };
@ -103,6 +105,10 @@ export class ChannelTreeView extends ReactComponentBase<ChannelTreeViewPropertie
this.listener_client_change = () => this.handleTreeUpdate();
this.listener_channel_change = () => this.handleTreeUpdate();
this.listener_state_collapsed = () => this.handleTreeUpdate();
this.listener_channel_properties = (event: ChannelEvents["notify_properties_updated"]) => {
if(typeof event.updated_properties.channel_needed_talk_power !== "undefined") /* talk power flags have changed */
this.handleTreeUpdate();
};
this.document_mouse_listener = (e: MouseEvent) => {
if(e.type !== "mouseleave" && e.button !== 0)
@ -183,6 +189,7 @@ export class ChannelTreeView extends ReactComponentBase<ChannelTreeViewPropertie
entry.events.on("notify_clients_changed", this.listener_client_change);
entry.events.on("notify_children_changed", this.listener_channel_change);
entry.events.on("notify_collapsed_state_changed", this.listener_state_collapsed);
entry.events.on("notify_properties_updated", this.listener_channel_properties);
this.flat_tree.push({
entry: entry,
@ -210,9 +217,10 @@ export class ChannelTreeView extends ReactComponentBase<ChannelTreeViewPropertie
while(index--) {
const entry = this.flat_tree[index].entry;
if(entry instanceof ChannelEntry) {
entry.events.off("notify_properties_updated", this.listener_client_change);
entry.events.off("notify_clients_changed", this.listener_client_change);
entry.events.off("notify_children_changed", this.listener_channel_change);
entry.events.off("notify_collapsed_state_changed", this.listener_state_collapsed);
entry.events.off("notify_properties_updated", this.listener_channel_properties);
}
}
}

View File

@ -640,8 +640,22 @@ export class ChannelTree {
}
});
if (!music_entry) { //Music bots cant be banned or kicked
if (!music_entry) { //Music bots cant be poked, banned or kicked
client_menu.push({
type: contextmenu.MenuEntryType.ENTRY,
icon_class: "client-poke",
name: tr("Poke clients"),
callback: () => {
this.selection.clear_selection();
createInputModal(tr("Poke clients"), tr("Poke message:<br>"), text => true, result => {
if (result) {
const elements = clients.map(e => { return { clid: e.clientId() } as any });
elements[0].msg = result;
this.client.serverConnection.send_command("clientpoke", elements);
}
}, {width: 400, maxLength: 255}).open();
}
}, {
type: contextmenu.MenuEntryType.ENTRY,
icon_class: "client-kick_server",
name: tr("Kick clients fom server"),