Skip to content

Commit f61560f

Browse files
committed
[fix] handle missing user id in bookmark view
1 parent 1a64408 commit f61560f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

templates/view_bookmark.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
<p class="is-size-7 has-text-grey has-text-weight-normal">{{ Truncate .Bookmark.URL 100 }}</p>
1515
</h4>
1616
<p>{{ .Bookmark.Notes }}</p>
17+
{{ $uid := 0 }}
18+
{{ if .User }}{{ $uid = .User.ID }}{{ end }}
1719
{{ if .Bookmark.Tags }}
18-
{{ $uid := 0 }}
19-
{{ if .User }}{{ $uid = .User.ID }}{{ end }}
2020
{{ range .Bookmark.Tags }}
2121
<a href="{{ if ne $uid $.Bookmark.UserID }}{{ BaseURL "/bookmarks" }}{{ else }}{{ BaseURL "/my_bookmarks" }}{{ end }}?tag={{ .Text }}"><span class="tag is-info">{{ .Text }}</span></a>
2222
{{ end }}
2323
{{ end }}
24-
{{ block "snapshots" KVData "Snapshots" .Bookmark.Snapshots "IsOwn" (eq .Bookmark.UserID .User.ID ) }}{{ end }}
24+
{{ block "snapshots" KVData "Snapshots" .Bookmark.Snapshots "IsOwn" (eq .Bookmark.UserID $uid ) }}{{ end }}
2525
{{ .Bookmark.CreatedAt | ToDate }} {{ if .Bookmark.Public }}Public{{ else }}Private{{ end }}
2626
{{ if .User }}
2727
{{ if eq .User.ID .Bookmark.UserID }}

0 commit comments

Comments
 (0)