0b5d7c8a4d
* WIP * fix(test): fix ap test failing * fix: fix unkeyed fields being used * chore(tests): clean up browser tests by splitting out federation UI tests
38 lines
1003 B
Go
38 lines
1003 B
Go
package events
|
|
|
|
import (
|
|
"github.com/owncast/owncast/persistence/configrepository"
|
|
)
|
|
|
|
// FediverseEngagementEvent is a message displayed in chat on representing an action on the Fediverse.
|
|
type FediverseEngagementEvent struct {
|
|
Event
|
|
MessageEvent
|
|
Image *string `json:"image"`
|
|
Link string `json:"link"`
|
|
UserAccountName string `json:"title"`
|
|
}
|
|
|
|
// GetBroadcastPayload will return the object to send to all chat users.
|
|
func (e *FediverseEngagementEvent) GetBroadcastPayload() EventPayload {
|
|
configRepository := configrepository.Get()
|
|
|
|
return EventPayload{
|
|
"id": e.ID,
|
|
"timestamp": e.Timestamp,
|
|
"body": e.Body,
|
|
"image": e.Image,
|
|
"type": e.Event.Type,
|
|
"title": e.UserAccountName,
|
|
"link": e.Link,
|
|
"user": EventPayload{
|
|
"displayName": configRepository.GetServerName(),
|
|
},
|
|
}
|
|
}
|
|
|
|
// GetMessageType will return the event type for this message.
|
|
func (e *FediverseEngagementEvent) GetMessageType() EventType {
|
|
return e.Event.Type
|
|
}
|