Also copy author over

This commit is contained in:
Peter Stuifzand 2018-04-07 01:56:17 +02:00
parent 18f270c42c
commit e4540ab2b3

View File

@ -130,6 +130,21 @@ func (b *memoryBackend) ChannelsDelete(uid string) {
} }
} }
func mapToAuthor(result map[string]interface{}) microsub.Author {
item := microsub.Author{}
item.Type = "card"
if name, e := result["name"]; e {
item.Name = name.(string)
}
if url, e := result["url"]; e {
item.URL = url.(string)
}
if photo, e := result["photo"]; e {
item.Photo = photo.(string)
}
return item
}
func mapToItem(result map[string]interface{}) microsub.Item { func mapToItem(result map[string]interface{}) microsub.Item {
item := microsub.Item{} item := microsub.Item{}
@ -147,6 +162,10 @@ func mapToItem(result map[string]interface{}) microsub.Item {
item.UID = uid.(string) item.UID = uid.(string)
} }
if author, e := result["author"]; e {
item.Author = mapToAuthor(author.(map[string]interface{}))
}
if content, e := result["content"]; e { if content, e := result["content"]; e {
if c, ok := content.(map[string]interface{}); ok { if c, ok := content.(map[string]interface{}); ok {
if html, e2 := c["html"]; e2 { if html, e2 := c["html"]; e2 {