Skip to content

Receiving messages in non-public channels can cause error notifications #36650

@bdach

Description

@bdach

Reported by a GMT. If a user is joined to a non-public channel like #lounge, incoming new messages in that channel will trigger "Failed to join channel" notifications.

This is because the notification about the messages is coming via the websocket. lazer responds to incoming messages from channel it's not joined to by attempting to join it:

case @"chat.message.new":
Debug.Assert(message.Data != null);
NewChatMessageData? messageData = JsonConvert.DeserializeObject<NewChatMessageData>(message.Data.ToString());
Debug.Assert(messageData != null);
foreach (var msg in messageData.Messages)
postToChannel(msg);
break;
}
}
private void postToChannel(Message message)
{
if (channelsMap.TryGetValue(message.ChannelId, out Channel? channel))
{
joinChannel(channel);
NewMessages?.Invoke(new List<Message> { message });
return;
}
var req = new GetChannelRequest(message.ChannelId);
req.Success += response =>
{
joinChannel(channelsMap[message.ChannelId] = response.Channel);
NewMessages?.Invoke(new List<Message> { message });
};
req.Failure += ex => Logger.Error(ex, "Failed to join channel");
api.Queue(req);
}

which fails because the channel can't be joined from lazer to begin with.

This sort of overlaps with #27597 (reply in thread) / the fact that such channels are currently unjoinable from lazer. Just logging for an indefinite future 🤷

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions