@ -217,7 +217,6 @@ export class ChatController {
let channel = (await this.channelService.getChannel(id)) as Channel
channel.password = await this.channelService.hash(data.password)
this.channelService.update(channel)
}
@Get()
@ -46,6 +46,7 @@
res.json().then(async (channels) => {
await formatChannelNames(channels);
const channel = channels.find((c: ChannelsType) => c.name === currentChannelName);
selectedChannel = channel;
if (channel) {
chan.selectChat(channel.id); // disabled as it causes a bug where joining a channel happen twice
} else {
@ -43,6 +43,12 @@
messages = [...messages, msg];
});
socket.on("messages", (msgs: Array<chatMessagesType>) => {
messages = msgs;
console.log("You are joining channel: ", channel.name)
socket.on("failedJoin", (error: string) => {
show_popup(`Failed to join channel: ${error}`, false)
setAppState("/channels")