More private avatars more places

pull/12/head
Noah 2022-09-08 21:52:50 -07:00
parent 6c91c67c97
commit c7e5760c4c
4 changed files with 29 additions and 31 deletions

View File

@ -90,6 +90,9 @@ func View() http.HandlerFunc {
}
commentLikeMap := models.MapLikes(currentUser, "comments", commentIDs)
// Populate the user relationships in these comments.
models.SetUserRelationshipsInComments(currentUser, comments)
// Is the current user subscribed to notifications on this thread?
_, isSubscribed := models.IsSubscribed(currentUser, "photos", photo.ID)

View File

@ -1,5 +1,24 @@
<!-- User avatar widgets -->
<!-- Parameter: .User -->
{{define "avatar-24x24"}}
<figure class="image is-24x24 is-inline-block">
<a href="/u/{{.Username}}" class="has-text-dark">
{{if .ProfilePhoto.ID}}
{{if and (eq .ProfilePhoto.Visibility "private") (not .UserRelationship.IsPrivateGranted)}}
<img src="/static/img/shy-private.png" class="is-rounded">
{{else if and (eq .ProfilePhoto.Visibility "friends") (not .UserRelationship.IsFriend)}}
<img src="/static/img/shy-friends.png" class="is-rounded">
{{else}}
<img src="{{PhotoURL .ProfilePhoto.CroppedFilename}}" class="is-rounded">
{{end}}
{{else}}
<img src="/static/img/shy.png" class="is-rounded">
{{end}}
</a>
</figure>
{{end}}
<!-- Parameter: .User -->
{{define "avatar-48x48"}}
<figure class="image is-48x48 is-inline-block">

View File

@ -305,14 +305,8 @@
{{if $Root.UserMap.Has .UserID}}
{{$Owner := $Root.UserMap.Get .UserID}}
<div class="columns is-mobile is-gapless nonshy-fullwidth">
<div class="column is-narrow">
<figure class="image is-24x24 mr-2">
{{if gt $Owner.ProfilePhoto.ID 0}}
<img src="{{PhotoURL $Owner.ProfilePhoto.CroppedFilename}}" class="is-rounded">
{{else}}
<img src="/static/img/shy.png" class="is-rounded has-background-warning">
{{end}}
</figure>
<div class="column is-narrow mr-2">
{{template "avatar-24x24" $Owner}}
</div>
<div class="column">
<a href="/u/{{$Owner.Username}}" class="has-text-light">
@ -416,14 +410,8 @@
{{if $Root.UserMap.Has .UserID}}
{{$Owner := $Root.UserMap.Get .UserID}}
<div class="columns is-mobile is-gapless nonshy-fullwidth">
<div class="column is-narrow">
<figure class="image is-24x24 mr-2">
{{if gt $Owner.ProfilePhoto.ID 0}}
<img src="{{PhotoURL $Owner.ProfilePhoto.CroppedFilename}}" class="is-rounded">
{{else}}
<img src="/static/img/shy.png" class="is-rounded has-background-warning">
{{end}}
</figure>
<div class="column is-narrow mr-2">
{{template "avatar-24x24" $Owner}}
</div>
<div class="column">
<a href="/u/{{$Owner.Username}}" class="has-text-light">

View File

@ -44,14 +44,8 @@
<header class="card-header {{if .Photo.Explicit}}has-background-danger{{else}}has-background-link{{end}}">
<div class="card-header-title has-text-light">
<div class="columns is-mobile is-gapless nonshy-fullwidth">
<div class="column is-narrow">
<figure class="image is-24x24 mr-2">
{{if gt .User.ProfilePhoto.ID 0}}
<img src="{{PhotoURL .User.ProfilePhoto.CroppedFilename}}" class="is-rounded">
{{else}}
<img src="/static/img/shy.png" class="is-rounded has-background-warning">
{{end}}
</figure>
<div class="column is-narrow mr-2">
{{template "avatar-24x24" .User}}
</div>
<div class="column">
<a href="/u/{{.User.Username}}" class="has-text-light">
@ -209,13 +203,7 @@
<div class="column is-2 has-text-centered">
<div>
<a href="/u/{{.User.Username}}">
<figure class="image is-96x96 is-inline-block">
{{if .User.ProfilePhoto.ID}}
<img src="{{PhotoURL .User.ProfilePhoto.CroppedFilename}}">
{{else}}
<img src="/static/img/shy.png">
{{end}}
</figure>
{{template "avatar-96x96" .User}}
</a>
</div>
<a href="/u/{{.User.Username}}">{{.User.Username}}</a>