Rework how hiding messages works. (#1509)
* Rework how hiding messages work. Fixes #1350 * Remove unused function * Revert to old event name to support previously saved webhooks
This commit is contained in:
@@ -10,8 +10,8 @@ const (
|
||||
UserJoined EventType = "USER_JOINED"
|
||||
// UserNameChanged is the event sent when a chat username change takes place.
|
||||
UserNameChanged EventType = "NAME_CHANGE"
|
||||
// VisibiltyToggled is the event sent when a chat message's visibility changes.
|
||||
VisibiltyToggled EventType = "VISIBILITY-UPDATE"
|
||||
// VisibiltyUpdate is the event sent when a chat message's visibility changes.
|
||||
VisibiltyUpdate EventType = "VISIBILITY-UPDATE"
|
||||
// PING is a ping message.
|
||||
PING EventType = "PING"
|
||||
// PONG is a pong message.
|
||||
|
||||
21
core/chat/events/setMessageVisibilityEvent.go
Normal file
21
core/chat/events/setMessageVisibilityEvent.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package events
|
||||
|
||||
// SetMessageVisibilityEvent is the event fired when one or more message
|
||||
// visibilities are changed.
|
||||
type SetMessageVisibilityEvent struct {
|
||||
Event
|
||||
UserMessageEvent
|
||||
MessageIDs []string
|
||||
Visible bool
|
||||
}
|
||||
|
||||
// GetBroadcastPayload will return the object to send to all chat users.
|
||||
func (e *SetMessageVisibilityEvent) GetBroadcastPayload() EventPayload {
|
||||
return EventPayload{
|
||||
"type": VisibiltyUpdate,
|
||||
"id": e.ID,
|
||||
"timestamp": e.Timestamp,
|
||||
"ids": e.MessageIDs,
|
||||
"visible": e.Visible,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user