Added more explitit attribution to unknown when parent object is not available in feed. Fixed bug in tombstone date defaulting to unix epoch.

This commit is contained in:
Nick Gerakines 2020-04-19 13:39:11 -04:00
parent 28a3df182c
commit d46adf9237
No known key found for this signature in database
GPG Key ID: 33D43D854F96B2E4
4 changed files with 17 additions and 7 deletions

View File

@ -17,8 +17,8 @@
{{ with .ViewContext.ObjectID }}
<li>{{ . }}</li>
{{ end }}
{{ with .ViewContext.TombstoneDeletedAt }}
<li>Deleted {{ date . }}</li>
{{ if .ViewContext.TombstoneHasDeletedAt }}
<li>Deleted {{ date .ViewContext.TombstoneDeletedAt }}</li>
{{ end }}
{{ with .ViewContext.TombstoneFormerType }}
<li>Former Type "{{ . }}"</li>

View File

@ -1,5 +1,6 @@
{{ define "view_object" }}
<div id="{{ .ViewContext.ShortHash }}" class="media pt-2 {{ if .ViewContext.Focus }} pl-2 border-top border-left border-primary{{ else }} border-top border-secondary{{ end }} tavern-feed-item">
<div id="{{ .ViewContext.ShortHash }}"
class="media pt-2 {{ if .ViewContext.Focus }} pl-2 border-top border-left border-primary{{ else }} border-top border-secondary{{ end }} tavern-feed-item">
<img class="pr-1" src="{{ .ViewContext.Icon }}" alt="icon"/>
<div class="media-body">
<div class="dropdown float-right">
@ -50,7 +51,11 @@
<a href="{{ .ViewContext.AttributedToLink }}">{{ .ViewContext.AttributedTo }}</a>
{{ if not (eq .ViewContext.ParentAttributedToLink .ViewContext.AttributedToLink) }}
replied to
<a href="{{ .ViewContext.ParentAttributedToLink }}">{{ .ViewContext.ParentAttributedTo }}</a>
{{ if eq .ViewContext.ParentAttributedTo "unknown" }}
<span class="text-danger">unknown</span>
{{ else }}
<a href="{{ .ViewContext.ParentAttributedToLink }}">{{ .ViewContext.ParentAttributedTo }}</a>
{{ end }}
{{ else }}
continued
{{ end }}

View File

@ -236,6 +236,7 @@ func (h handler) displayObjectFeed(c *gin.Context, requireUser bool, vars map[st
var deletedAt time.Time
deletedAt, err := time.ParseInLocation("2006-01-02T15:04:05Z", deleted, time.UTC)
if err == nil {
viewContext.TombstoneHasDeletedAt = true
viewContext.TombstoneDeletedAt = deletedAt
}
@ -326,6 +327,9 @@ func (h handler) displayObjectFeed(c *gin.Context, requireUser bool, vars map[st
viewContext.HasParent = true
viewContext.ParentObjectLink = inReplyTo
viewContext.ParentAttributedToLink = inReplyTo
viewContext.ParentAttributedTo = "unknown"
if parentObjectRowID, hasParentObjectRowID := objectRowIDs[inReplyTo]; hasParentObjectRowID {
if parentRef, hasParentRef := refs[parentObjectRowID]; hasParentRef {

View File

@ -84,9 +84,10 @@ type viewObjectContext struct {
Error string
Tombstone bool
TombstoneFormerType string
TombstoneDeletedAt time.Time
Tombstone bool
TombstoneFormerType string
TombstoneHasDeletedAt bool
TombstoneDeletedAt time.Time
Sensitive bool
ContentWarning string