Fixed bug in view object where inReplyTo author link and name was not displayed. Updating icons for view object menu.

This commit is contained in:
Nick Gerakines 2020-03-29 10:36:46 -04:00
parent 9a85f9df5b
commit 9ae4c163cc
No known key found for this signature in database
GPG Key ID: 33D43D854F96B2E4
2 changed files with 39 additions and 10 deletions

View File

@ -10,28 +10,52 @@
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
{{ if .ViewContext.LinkView }}
<a href="{{ .ViewContext.LinkViewURL }}" class="dropdown-item">View</a>
<a href="{{ .ViewContext.LinkViewURL }}" class="dropdown-item">
<i class="fas fa-comment-alt"></i>
View
</a>
{{ end }}
{{ if .ViewContext.HasParent }}
<a href="{{ .ViewContext.ParentObjectLink }}" class="dropdown-item">
<i class="fas fa-comments-alt"></i>
View Parent
</a>
{{ end }}
{{ if .ViewContext.LinkReply }}
<a href="{{ .ViewContext.LinkReplyURL }}" class="dropdown-item">Reply</a>
<a href="{{ .ViewContext.LinkReplyURL }}" class="dropdown-item">
<i class="fas fa-comment-alt-plus"></i>
Reply
</a>
{{ end }}
{{ if .ViewContext.LinkAnnounce }}
<a href="#" class="dropdown-item announce"
data-object="{{ .ViewContext.ObjectID }}">Announce</a>
data-object="{{ .ViewContext.ObjectID }}">
<i class="fas fa-bullhorn"></i>
Announce
</a>
{{ end }}
{{ if and (or .ViewContext.LinkView .ViewContext.LinkReply) .ViewContext.LinkDelete }}
{{ end }}
{{ if .ViewContext.LinkDelete }}
<a href="#" class="dropdown-item owner_delete">Delete</a>
<a href="#" class="dropdown-item owner_delete">
<i class="fas fa-comment-alt-slash"></i>
Delete
</a>
{{ end }}
</div>
</div>
<p>
<span class="w-auto border-bottom">
<a href="{{ .ViewContext.AttributedToLink }}">{{ .ViewContext.AttributedTo }}</a> wrote
{{ if .ViewContext.HasParent }}
to
<a href="{{ .ViewContext.ParentAttributedToLink }}">{{ .ViewContext.ParentAttributedTo }}</a>
<a href="{{ .ViewContext.AttributedToLink }}">{{ .ViewContext.AttributedTo }}</a>
{{ if not (eq .ViewContext.ParentAttributedToLink .ViewContext.AttributedToLink) }}
replied to
<a href="{{ .ViewContext.ParentAttributedToLink }}">{{ .ViewContext.ParentAttributedTo }}</a>
{{ else }}
continued
{{ end }}
{{ else }}
<a href="{{ .ViewContext.AttributedToLink }}">{{ .ViewContext.AttributedTo }}</a> wrote
{{ end }}
{{ if .ViewContext.HasPublishedAt }}
on {{ datetime .ViewContext.PublishedAt }}

View File

@ -103,7 +103,12 @@ func (h handler) displayObjectFeed(c *gin.Context, requireUser bool, vars map[st
for _, feedPayload := range feedPayloads {
foundPayloadIDs = append(foundPayloadIDs,
storage.CollectJSONDeepStrings(feedPayload, []string{"id"}, []string{"object"}, []string{"object", "id"}, []string{"object", "inReplyTo"})...)
storage.CollectJSONDeepStrings(feedPayload,
[]string{"id"},
[]string{"inReplyTo"},
[]string{"object"},
[]string{"object", "id"},
[]string{"object", "inReplyTo"})...)
foundActorIDs = append(foundActorIDs,
storage.CollectJSONDeepStrings(feedPayload, []string{"actor"}, []string{"object", "attributedTo"}, []string{"attributedTo"})...)
@ -114,7 +119,7 @@ func (h handler) displayObjectFeed(c *gin.Context, requireUser bool, vars map[st
actorNames := make(map[string]string)
actorIcons := make(map[string]string)
objectIDToObjectRowID := make(map[string]uuid.UUID)
// objectIDToObjectRowID := make(map[string]uuid.UUID)
objectRowIDs, err := h.storage.ObjectRowIDsForObjectIDs(ctx, foundPayloadIDs)
if err != nil {
@ -330,7 +335,7 @@ func (h handler) displayObjectFeed(c *gin.Context, requireUser bool, vars map[st
viewContext.HasParent = true
viewContext.ParentObjectLink = inReplyTo
if parentObjectRowID, hasParentObjectRowID := objectIDToObjectRowID[inReplyTo]; hasParentObjectRowID {
if parentObjectRowID, hasParentObjectRowID := objectRowIDs[inReplyTo]; hasParentObjectRowID {
if parentRef, hasParentRef := refs[parentObjectRowID]; hasParentRef {
inReplyToAuthor, hasInReplyToAuthor := storage.JSONString(parentRef, "attributedTo")