frontend: prevent loading messages for channels with -1 as the id

This commit is contained in:
hippoz 2022-05-08 22:02:16 +03:00
parent 261e041792
commit 200f1005b9
No known key found for this signature in database
GPG key ID: 7C52899193467641

View file

@ -224,6 +224,9 @@ class MessageStore extends Store {
} }
async loadOlderMessages(beforeCommitToStore=null) { async loadOlderMessages(beforeCommitToStore=null) {
if (this.channelId === -1)
return;
const oldestMessage = this.value[0]; const oldestMessage = this.value[0];
const endpoint = oldestMessage ? `channels/${this.channelId}/messages/?before=${oldestMessage.id}` : `channels/${this.channelId}/messages`; const endpoint = oldestMessage ? `channels/${this.channelId}/messages/?before=${oldestMessage.id}` : `channels/${this.channelId}/messages`;
const res = await request("GET", apiRoute(endpoint), true, null); const res = await request("GET", apiRoute(endpoint), true, null);