Support media attachments in Mastodon account

This commit is contained in:
Christian Muehlhaeuser 2019-05-02 11:52:28 +02:00
parent dce3526e49
commit 5d99470415
No known key found for this signature in database
GPG key ID: 3CF9FA45CA1EBB7E

View file

@ -161,6 +161,10 @@ func (mod *Account) handleStreamEvent(item interface{}) {
URL: status.Notification.Status.URL,
},
}
for _, v := range status.Notification.Status.MediaAttachments {
ev.Media = append(ev.Media, v.PreviewURL)
}
}
switch status.Notification.Type {
@ -213,9 +217,17 @@ func (mod *Account) handleStreamEvent(item interface{}) {
},
}
for _, v := range status.Status.MediaAttachments {
ev.Media = append(ev.Media, v.PreviewURL)
}
if status.Status.Reblog != nil {
ev.Forward = true
for _, v := range status.Status.Reblog.MediaAttachments {
ev.Media = append(ev.Media, v.PreviewURL)
}
ev.Post.URL = status.Status.Reblog.URL
ev.Post.Author = status.Status.Reblog.Account.DisplayName
ev.Post.AuthorName = status.Status.Reblog.Account.Username