feat: implement channel membership management and ensure default channels are public

This commit is contained in:
HueByte
2026-02-19 19:21:27 +01:00
parent 246eb2b0bb
commit 38b60e5626
11 changed files with 446 additions and 7 deletions
+12 -5
View File
@@ -712,12 +712,10 @@ public sealed class AppOrchestrator : IDisposable
_joinedChannels.Add(channel.Name);
var history = await _connection!.JoinChannelAsync(channel.Name);
// Refresh the channel list and ensure private channels show up
var channels = await _apiClient.GetChannelsAsync();
InvokeUI(() =>
{
_mainWindow.SetChannels(channels);
_mainWindow.EnsureChannelInList(channel.Name);
_mainWindow.SetChannelTopic(channel.Name, channel.Topic);
_mainWindow.SwitchToChannel(channel.Name);
if (history.Count > 0)
_mainWindow.LoadHistory(channel.Name, history);
@@ -756,10 +754,9 @@ public sealed class AppOrchestrator : IDisposable
await _apiClient!.DeleteChannelAsync(channel);
_joinedChannels.Remove(channel);
var channels = await _apiClient.GetChannelsAsync();
InvokeUI(() =>
{
_mainWindow.SetChannels(channels);
_mainWindow.RemoveChannel(channel);
_mainWindow.SwitchToChannel(HubConstants.DefaultChannel);
_mainWindow.AddSystemMessage(HubConstants.DefaultChannel, $"Channel #{channel} has been deleted.");
});
@@ -844,6 +841,16 @@ public sealed class AppOrchestrator : IDisposable
});
};
connection.OnChannelUpdated += channel =>
{
InvokeUI(() =>
{
if (channel.IsPublic)
_mainWindow.EnsureChannelInList(channel.Name);
_mainWindow.SetChannelTopic(channel.Name, channel.Topic);
});
};
connection.OnError += errorMessage =>
InvokeUI(() => _mainWindow.ShowError(errorMessage));