mirror of https://gitlab.com/ngerakines/tavern.git
Fixing bug where some feed objects were not displayed.
This commit is contained in:
parent
4d7da52a1b
commit
392af77364
|
@ -64,6 +64,7 @@ func (h handler) displayObjectFeed(c *gin.Context, requireUser bool, vars map[st
|
|||
foundActorIDs := common.NewUniqueStrings()
|
||||
feedIDs := common.NewUniqueStrings()
|
||||
boosters := make(common.StringsMultiMap)
|
||||
chains := make(common.UUIDsMultiMap)
|
||||
|
||||
for _, feedPayload := range feedPayloads {
|
||||
feedIDs.Add(storage.CollectJSONDeepStrings(feedPayload, []string{"id"})...)
|
||||
|
@ -77,7 +78,6 @@ func (h handler) displayObjectFeed(c *gin.Context, requireUser bool, vars map[st
|
|||
|
||||
foundActorIDs.Add(storage.CollectJSONDeepStrings(feedPayload, []string{"actor"}, []string{"object", "attributedTo"}, []string{"attributedTo"})...)
|
||||
|
||||
// feedPayloadID, _ := storage.JSONString(feedPayload, "id")
|
||||
feedPayloadType, hasFeedPayloadType := storage.JSONString(feedPayload, "type")
|
||||
if hasFeedPayloadType && feedPayloadType == "Announce" {
|
||||
feedPayloadActor, hasFeedPayloadActor := storage.JSONString(feedPayload, "actor")
|
||||
|
@ -113,17 +113,24 @@ func (h handler) displayObjectFeed(c *gin.Context, requireUser bool, vars map[st
|
|||
h.logger.Debug("queried object refs", zap.Int("count", len(refs)))
|
||||
|
||||
hasParents := map[uuid.UUID]bool{}
|
||||
chains := make(common.UUIDsMultiMap)
|
||||
|
||||
for refRowID, _ := range refs {
|
||||
hasParents[refRowID] = false
|
||||
}
|
||||
for _, feedPayload := range feedPayloads {
|
||||
objectID := storage.FirstJSONDeepStrings(feedPayload, []string{"object"}, []string{"object", "id"})
|
||||
if rowID, hasRowID := objectRowIDs[objectID]; hasRowID {
|
||||
chains.Add(rowID)
|
||||
}
|
||||
}
|
||||
for refRowID, ref := range refs {
|
||||
inReplyTo, hasInReplyTo := storage.JSONString(ref, "inReplyTo")
|
||||
if hasInReplyTo {
|
||||
if rowID, hasRowID := objectRowIDs[inReplyTo]; hasRowID {
|
||||
chains.Add(rowID, refRowID)
|
||||
chains.Add(refRowID)
|
||||
hasParents[refRowID] = true
|
||||
}
|
||||
hasParents[refRowID] = true
|
||||
} else {
|
||||
chains.Add(refRowID)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue