Update chat message visibility for moderation (#524)

* update message viz in db

* create admin endpoint to update message visibility

* convert UpdateMessageVisibility api to take in an array of IDs to change visibility on instead

* Support requesting filtered or unfiltered chat messages

* Handle UPDATE chat events on front and backend for toggling messages

* Return entire message with UPDATE events

* Remove the UPDATE message type

* Revert "Remove the UPDATE message type"

This reverts commit 3a83df3d492f7ecf2bab65e845aa2b0365d3a7f6.

* update -> visibility update

* completely remove messages when they turn hidden on VISIBILITY-UPDATEs, and insert them if they turn visible

* Explicitly set visibility

* Fix multi-id sql updates

* increate scroll buffer a bit so chat scrolls when new large messages come in

* Add automated test around chat moderation

* Add new chat admin APIs to api spec

* Commit updated API documentation

Co-authored-by: Gabe Kangas <gabek@real-ity.com>
Co-authored-by: Owncast <owncast@owncast.online>
This commit is contained in:
gingervitis
2020-12-29 13:35:33 -08:00
committed by GitHub
parent 0452c4c5fc
commit 8a74af202d
18 changed files with 375 additions and 64 deletions

View File

@@ -257,10 +257,10 @@ components:
examples:
success:
summary: Operation succeeded.
value: {"success": true, "message": "inbound stream disconnected"}
value: {"success": true, "message": "context specific success message"}
failure:
summary: Operation failed.
value: {"success": false, "message": "no inbound stream connected"}
value: {"success": false, "message": "context specific failure message"}
paths:
@@ -648,6 +648,65 @@ paths:
description: The maximum number of HLS video segments we will keep referenced in the playlist.
yp:
$ref: "#/components/schemas/YP"
/api/admin/chat/messages:
get:
summary: Chat messages, unfiltered.
description: Get a list of all chat messages with no filters applied.
tags: ["Admin"]
security:
- AdminBasicAuth: []
responses:
'200':
description: ""
content:
application/json:
schema:
type: array
items:
type: object
properties:
author:
type: string
description: Username of the chat message poster.
body:
type: string
description: Escaped HTML of the chat message content.
id:
type: string
description: Unique ID of the chat message.
visible:
type: boolean
description: "Should chat message be visibly rendered."
timestamp:
type: string
format: date-time
/api/admin/chat/updatemessagevisibility:
post:
summary: Update the visibility of chat messages.
description: Pass an array of IDs you want to change the chat visibility of.
requestBody:
content:
application/json:
schema:
type: object
properties:
visible:
type: boolean
description: Are these messages visible in "Get the CPU, Memory and Disk utilization levels over the collected period."
idArray:
type: array
items:
type: string
description: IDs of the chat messages you wish to change the visibility of.
tags: ["Admin"]
security:
- AdminBasicAuth: []
responses:
'200':
$ref: "#/components/responses/BasicResponse"
/api/admin/viewersOverTime:
get: