the browser-facing portion of osu!

Merge pull request #11475 from nanaya/chat-response-empty

Fix chat update response when empty

authored by

bakaneko and committed by
GitHub
9586cde7 d481361f

+2 -5
+1 -3
app/Http/Controllers/Chat/ChatController.php
··· 272 $response['messages'] = []; 273 } 274 275 - $hasAny = array_first($response, fn ($val) => count($val) > 0) !== null; 276 - 277 - return $hasAny ? $response : response()->noContent(); 278 } 279 280 private function getSilences(?int $lastHistoryId, ?int $since)
··· 272 $response['messages'] = []; 273 } 274 275 + return $response; 276 } 277 278 private function getSilences(?int $lastHistoryId, ?int $since)
+1 -1
resources/js/chat/chat-api.ts
··· 78 includes: ['presence', 'silences'], 79 since, 80 }, 81 - ) as JQuery.jqXHR<ChatUpdatesJson | null>; 82 } 83 84 export function joinChannel(channelId: number, userId: number) {
··· 78 includes: ['presence', 'silences'], 79 since, 80 }, 81 + ) as JQuery.jqXHR<ChatUpdatesJson>; 82 } 83 84 export function joinChannel(channelId: number, userId: number) {
-1
resources/js/chat/chat-state-store.ts
··· 295 @action 296 private async updateChannelList() { 297 const json = await getUpdates(this.channelStore.lastReceivedMessageId, this.lastHistoryId); 298 - if (!json) return; // FIXME: fix response 299 300 runInAction(() => { 301 const newHistoryId = maxBy(json.silences, 'id')?.id;
··· 295 @action 296 private async updateChannelList() { 297 const json = await getUpdates(this.channelStore.lastReceivedMessageId, this.lastHistoryId); 298 299 runInAction(() => { 300 const newHistoryId = maxBy(json.silences, 'id')?.id;