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:
@@ -14,7 +14,7 @@ func Setup(listener models.ChatListener) {
|
||||
clients := make(map[string]*Client)
|
||||
addCh := make(chan *Client)
|
||||
delCh := make(chan *Client)
|
||||
sendAllCh := make(chan models.ChatMessage)
|
||||
sendAllCh := make(chan models.ChatEvent)
|
||||
pingCh := make(chan models.PingMessage)
|
||||
doneCh := make(chan bool)
|
||||
errCh := make(chan error)
|
||||
@@ -51,7 +51,7 @@ func Start() error {
|
||||
}
|
||||
|
||||
// SendMessage sends a message to all.
|
||||
func SendMessage(message models.ChatMessage) {
|
||||
func SendMessage(message models.ChatEvent) {
|
||||
if _server == nil {
|
||||
return
|
||||
}
|
||||
@@ -60,12 +60,12 @@ func SendMessage(message models.ChatMessage) {
|
||||
}
|
||||
|
||||
// GetMessages gets all of the messages.
|
||||
func GetMessages() []models.ChatMessage {
|
||||
func GetMessages(filtered bool) []models.ChatEvent {
|
||||
if _server == nil {
|
||||
return []models.ChatMessage{}
|
||||
return []models.ChatEvent{}
|
||||
}
|
||||
|
||||
return getChatHistory()
|
||||
return getChatHistory(filtered)
|
||||
}
|
||||
|
||||
func GetClient(clientID string) *Client {
|
||||
|
||||
Reference in New Issue
Block a user