diff options
| author | anatawa12 <anatawa12@icloud.com> | 2024-08-09 16:04:41 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-09 16:04:41 +0900 |
| commit | f50941389d8724442ce2d7326afe9fbdadd3b58e (patch) | |
| tree | 852abb54937b8c04a4a8436e07bba2f226616a17 /packages/backend/src/server/api/stream/channels/reversi-game.ts | |
| parent | fix(backend): check visibility of following/followers of remote users / feat:... (diff) | |
| download | sharkey-f50941389d8724442ce2d7326afe9fbdadd3b58e.tar.gz sharkey-f50941389d8724442ce2d7326afe9fbdadd3b58e.tar.bz2 sharkey-f50941389d8724442ce2d7326afe9fbdadd3b58e.zip | |
fix: readAllNotifications message not working (#14374)
* refactor: add and use isJsonObject
* fix: readNotification message without body is not working
* docs(changelog): WSの`readAllNotifications` メッセージが `body` を持たない場合に動作しない問題
* Update CHANGELOG.md
Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com>
---------
Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com>
Diffstat (limited to 'packages/backend/src/server/api/stream/channels/reversi-game.ts')
| -rw-r--r-- | packages/backend/src/server/api/stream/channels/reversi-game.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/backend/src/server/api/stream/channels/reversi-game.ts b/packages/backend/src/server/api/stream/channels/reversi-game.ts index 17823a164a..c6f4a4ae3b 100644 --- a/packages/backend/src/server/api/stream/channels/reversi-game.ts +++ b/packages/backend/src/server/api/stream/channels/reversi-game.ts @@ -9,6 +9,7 @@ import { DI } from '@/di-symbols.js'; import { bindThis } from '@/decorators.js'; import { ReversiService } from '@/core/ReversiService.js'; import { ReversiGameEntityService } from '@/core/entities/ReversiGameEntityService.js'; +import { isJsonObject } from '@/misc/json-value.js'; import type { JsonObject, JsonValue } from '@/misc/json-value.js'; import Channel, { type MiChannelService } from '../channel.js'; @@ -44,16 +45,16 @@ class ReversiGameChannel extends Channel { this.ready(body); break; case 'updateSettings': - if (typeof body !== 'object' || body === null || Array.isArray(body)) return; + if (!isJsonObject(body)) return; if (typeof body.key !== 'string') return; - if (typeof body.value !== 'object' || body.value === null || Array.isArray(body.value)) return; + if (!isJsonObject(body.value)) return; this.updateSettings(body.key, body.value); break; case 'cancel': this.cancelGame(); break; case 'putStone': - if (typeof body !== 'object' || body === null || Array.isArray(body)) return; + if (!isJsonObject(body)) return; if (typeof body.pos !== 'number') return; if (typeof body.id !== 'string') return; this.putStone(body.pos, body.id); |