Updating the channel collapsed state after channel move

canary
WolverinDEV 2020-12-04 13:43:53 +01:00
parent 92191b259b
commit 3ec0f32634
3 changed files with 25 additions and 3 deletions

View File

@ -1,6 +1,7 @@
# Changelog: # Changelog:
* **04.12.20** * **04.12.20**
- Properly logging channel creations, deletions, shows and hides - Properly logging channel creations, deletions, shows and hides
- Fixed missing collapsed arrow update after channel move
* **03.12.20** * **03.12.20**
- Fixed server connection tab move handler - Fixed server connection tab move handler

View File

@ -40,7 +40,12 @@ export interface ChannelTreeEvents {
/* channel tree events */ /* channel tree events */
notify_channel_created: { channel: ChannelEntry }, 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_deleted: { channel: ChannelEntry },
notify_channel_client_order_changed: { channel: ChannelEntry }, notify_channel_client_order_changed: { channel: ChannelEntry },
@ -302,6 +307,9 @@ export class ChannelTree {
return; return;
} }
const previousParent = channel.parent_channel();
const previousOrder = channel.channel_previous;
this.unregisterChannelFromTree(channel); this.unregisterChannelFromTree(channel);
channel.channel_previous = channelPrevious; channel.channel_previous = channelPrevious;
channel.channel_next = undefined; channel.channel_next = undefined;
@ -349,7 +357,11 @@ export class ChannelTree {
} }
if(triggerMoveEvent) { if(triggerMoveEvent) {
this.events.fire("notify_channel_moved", { channel: channel }); this.events.fire("notify_channel_moved", {
channel: channel,
previousOrder: previousOrder,
previousParent: previousParent
});
} }
} }

View File

@ -207,9 +207,18 @@ class ChannelTreeController {
} }
@EventHandler<ChannelTreeEvents>("notify_channel_moved") @EventHandler<ChannelTreeEvents>("notify_channel_moved")
private handleChannelMoved(_event: ChannelTreeEvents["notify_channel_moved"]) { private handleChannelMoved(event: ChannelTreeEvents["notify_channel_moved"]) {
if(!this.channelTreeInitialized) { return; } if(!this.channelTreeInitialized) { return; }
this.sendChannelTreeEntries(); 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<ChannelTreeEvents>("notify_channel_deleted") @EventHandler<ChannelTreeEvents>("notify_channel_deleted")