This commit is contained in:
parent
2d1be88dd1
commit
5afdd56bb1
|
|
@ -85,7 +85,7 @@ func itemPtr(item *microsub.Item, key string) *[]string {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func simplifyToItem(itemType string, item map[string][]interface{}) microsub.Item {
|
func simplifyToItem(itemType string, item map[string][]interface{}, author microsub.Card) microsub.Item {
|
||||||
var feedItem microsub.Item
|
var feedItem microsub.Item
|
||||||
|
|
||||||
if itemType == "cite" {
|
if itemType == "cite" {
|
||||||
|
|
@ -94,6 +94,8 @@ func simplifyToItem(itemType string, item map[string][]interface{}) microsub.Ite
|
||||||
feedItem.Type = itemType
|
feedItem.Type = itemType
|
||||||
feedItem.Refs = make(map[string]microsub.Item)
|
feedItem.Refs = make(map[string]microsub.Item)
|
||||||
|
|
||||||
|
hasAuthor := false
|
||||||
|
|
||||||
for k, v := range item {
|
for k, v := range item {
|
||||||
switch k {
|
switch k {
|
||||||
case "bookmark-of", "like-of", "repost-of", "in-reply-to":
|
case "bookmark-of", "like-of", "repost-of", "in-reply-to":
|
||||||
|
|
@ -111,6 +113,7 @@ func simplifyToItem(itemType string, item map[string][]interface{}) microsub.Ite
|
||||||
case "author":
|
case "author":
|
||||||
author, _ := simplifyCard(v[0])
|
author, _ := simplifyCard(v[0])
|
||||||
feedItem.Author = &author
|
feedItem.Author = &author
|
||||||
|
hasAuthor = true
|
||||||
case "checkin", "location":
|
case "checkin", "location":
|
||||||
author, _ := simplifyCard(v[0])
|
author, _ := simplifyCard(v[0])
|
||||||
feedItem.Checkin = &author
|
feedItem.Checkin = &author
|
||||||
|
|
@ -156,6 +159,10 @@ func simplifyToItem(itemType string, item map[string][]interface{}) microsub.Ite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !hasAuthor {
|
||||||
|
feedItem.Author = &author
|
||||||
|
}
|
||||||
|
|
||||||
return feedItem
|
return feedItem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -235,7 +242,7 @@ func SimplifyMicroformatItem(mdItem *microformats.Microformat, author microsub.C
|
||||||
return item, false
|
return item, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return simplifyToItem(itemType, mdItem.Properties), true
|
return simplifyToItem(itemType, mdItem.Properties, author), true
|
||||||
}
|
}
|
||||||
|
|
||||||
func hasType(item *microformats.Microformat, itemType string) bool {
|
func hasType(item *microformats.Microformat, itemType string) bool {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user