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

@ -87,7 +87,16 @@ func cmdStream(c *cli.Context) error {
if asJSON {
json.NewEncoder(c.App.Writer).Encode(e)
} else if asSimpleJSON {
if t, ok := e.(*mastodon.UpdateEvent); ok {
switch t := e.(type) {
case *mastodon.UpdateEvent:
json.NewEncoder(c.App.Writer).Encode(&SimpleJSON{
ID: t.Status.ID,
Username: t.Status.Account.Username,
Acct: t.Status.Account.Acct,
Avatar: t.Status.Account.AvatarStatic,
Content: textContent(t.Status.Content),
})
case *mastodon.UpdateEditEvent:
json.NewEncoder(c.App.Writer).Encode(&SimpleJSON{
ID: t.Status.ID,
Username: t.Status.Account.Username,
@ -102,6 +111,8 @@ func cmdStream(c *cli.Context) error {
switch t := e.(type) {
case *mastodon.UpdateEvent:
s.displayStatus(c.App.Writer, t.Status)
case *mastodon.UpdateEditEvent:
s.displayStatus(c.App.Writer, t.Status)
case *mastodon.NotificationEvent:
// TODO s.displayStatus(c.App.Writer, t.Notification.Status)
case *mastodon.ErrorEvent: