diff --git a/ChangeLog.md b/ChangeLog.md index d6b6b23b..d4fb6524 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,7 @@ # Changelog: * **04.12.20** - Properly logging channel creations, deletions, shows and hides + - Fixed missing collapsed arrow update after channel move * **03.12.20** - Fixed server connection tab move handler diff --git a/shared/js/tree/ChannelTree.tsx b/shared/js/tree/ChannelTree.tsx index a4c992cf..c310aa5e 100644 --- a/shared/js/tree/ChannelTree.tsx +++ b/shared/js/tree/ChannelTree.tsx @@ -40,7 +40,12 @@ export interface ChannelTreeEvents { /* channel tree events */ notify_channel_created: { channel: ChannelEntry }, - notify_channel_moved: { channel: ChannelEntry }, + notify_channel_moved: { + channel: ChannelEntry, + + previousParent: ChannelEntry | undefined, + previousOrder: ChannelEntry | undefined, + }, notify_channel_deleted: { channel: ChannelEntry }, notify_channel_client_order_changed: { channel: ChannelEntry }, @@ -302,6 +307,9 @@ export class ChannelTree { return; } + const previousParent = channel.parent_channel(); + const previousOrder = channel.channel_previous; + this.unregisterChannelFromTree(channel); channel.channel_previous = channelPrevious; channel.channel_next = undefined; @@ -349,7 +357,11 @@ export class ChannelTree { } if(triggerMoveEvent) { - this.events.fire("notify_channel_moved", { channel: channel }); + this.events.fire("notify_channel_moved", { + channel: channel, + previousOrder: previousOrder, + previousParent: previousParent + }); } } diff --git a/shared/js/ui/tree/Controller.tsx b/shared/js/ui/tree/Controller.tsx index 50c634bf..e6627d8b 100644 --- a/shared/js/ui/tree/Controller.tsx +++ b/shared/js/ui/tree/Controller.tsx @@ -207,9 +207,18 @@ class ChannelTreeController { } @EventHandler("notify_channel_moved") - private handleChannelMoved(_event: ChannelTreeEvents["notify_channel_moved"]) { + private handleChannelMoved(event: ChannelTreeEvents["notify_channel_moved"]) { if(!this.channelTreeInitialized) { return; } this.sendChannelTreeEntries(); + + if(event.previousParent && !event.previousParent.child_channel_head) { + /* the collapsed state arrow changed */ + this.sendChannelInfo(event.previousParent); + } + if(event.channel.parent_channel()) { + /* the collapsed state arrow may changed */ + this.sendChannelInfo(event.channel.parent_channel()); + } } @EventHandler("notify_channel_deleted")