Add support for edited statuses

ActivityPub supports "status.update" for editing statuses. These should
be made available for streams.
This commit is contained in:
Brint E. Kriebel 2022-12-20 22:37:57 -08:00 committed by mattn
parent 6e810f25fa
commit 9faaa4f0dc
6 changed files with 66 additions and 9 deletions

View file

@ -20,6 +20,13 @@ type UpdateEvent struct {
func (e *UpdateEvent) event() {}
// UpdateEditEvent is a struct for passing status edit event to app.
type UpdateEditEvent struct {
Status *Status `json:"status"`
}
func (e *UpdateEditEvent) event() {}
// NotificationEvent is a struct for passing notification event to app.
type NotificationEvent struct {
Notification *Notification `json:"notification"`
@ -81,6 +88,12 @@ func handleReader(q chan Event, r io.Reader) error {
if err == nil {
q <- &UpdateEvent{&status}
}
case "status.update":
var status Status
err = json.Unmarshal([]byte(token[1]), &status)
if err == nil {
q <- &UpdateEditEvent{&status}
}
case "notification":
var notification Notification
err = json.Unmarshal([]byte(token[1]), &notification)