More private avatars more places

This commit is contained in:
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) 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? // Is the current user subscribed to notifications on this thread?
_, isSubscribed := models.IsSubscribed(currentUser, "photos", photo.ID) _, isSubscribed := models.IsSubscribed(currentUser, "photos", photo.ID)

View File

@ -1,5 +1,24 @@
<!-- User avatar widgets --> <!-- 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 --> <!-- Parameter: .User -->
{{define "avatar-48x48"}} {{define "avatar-48x48"}}
<figure class="image is-48x48 is-inline-block"> <figure class="image is-48x48 is-inline-block">

View File

@ -305,14 +305,8 @@
{{if $Root.UserMap.Has .UserID}} {{if $Root.UserMap.Has .UserID}}
{{$Owner := $Root.UserMap.Get .UserID}} {{$Owner := $Root.UserMap.Get .UserID}}
<div class="columns is-mobile is-gapless nonshy-fullwidth"> <div class="columns is-mobile is-gapless nonshy-fullwidth">
<div class="column is-narrow"> <div class="column is-narrow mr-2">
<figure class="image is-24x24 mr-2"> {{template "avatar-24x24" $Owner}}
{{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> </div>
<div class="column"> <div class="column">
<a href="/u/{{$Owner.Username}}" class="has-text-light"> <a href="/u/{{$Owner.Username}}" class="has-text-light">
@ -416,14 +410,8 @@
{{if $Root.UserMap.Has .UserID}} {{if $Root.UserMap.Has .UserID}}
{{$Owner := $Root.UserMap.Get .UserID}} {{$Owner := $Root.UserMap.Get .UserID}}
<div class="columns is-mobile is-gapless nonshy-fullwidth"> <div class="columns is-mobile is-gapless nonshy-fullwidth">
<div class="column is-narrow"> <div class="column is-narrow mr-2">
<figure class="image is-24x24 mr-2"> {{template "avatar-24x24" $Owner}}
{{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> </div>
<div class="column"> <div class="column">
<a href="/u/{{$Owner.Username}}" class="has-text-light"> <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}}"> <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="card-header-title has-text-light">
<div class="columns is-mobile is-gapless nonshy-fullwidth"> <div class="columns is-mobile is-gapless nonshy-fullwidth">
<div class="column is-narrow"> <div class="column is-narrow mr-2">
<figure class="image is-24x24 mr-2"> {{template "avatar-24x24" .User}}
{{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> </div>
<div class="column"> <div class="column">
<a href="/u/{{.User.Username}}" class="has-text-light"> <a href="/u/{{.User.Username}}" class="has-text-light">
@ -209,13 +203,7 @@
<div class="column is-2 has-text-centered"> <div class="column is-2 has-text-centered">
<div> <div>
<a href="/u/{{.User.Username}}"> <a href="/u/{{.User.Username}}">
<figure class="image is-96x96 is-inline-block"> {{template "avatar-96x96" .User}}
{{if .User.ProfilePhoto.ID}}
<img src="{{PhotoURL .User.ProfilePhoto.CroppedFilename}}">
{{else}}
<img src="/static/img/shy.png">
{{end}}
</figure>
</a> </a>
</div> </div>
<a href="/u/{{.User.Username}}">{{.User.Username}}</a> <a href="/u/{{.User.Username}}">{{.User.Username}}</a>