Add notification banners about upcoming Public Avatar change

This commit is contained in:
Noah Petherbridge 2024-06-29 19:28:51 -07:00
parent 4f04323d5a
commit 91a3cc27ba
7 changed files with 71 additions and 5 deletions

View File

@ -125,6 +125,7 @@ const (
// NOTE: search code base for PublicAvatar or "public avatar" for related feature code. // NOTE: search code base for PublicAvatar or "public avatar" for related feature code.
var ( var (
PublicAvatarEnforcementDate = time.Date(2024, time.August, 30, 12, 0, 0, 0, time.UTC) PublicAvatarEnforcementDate = time.Date(2024, time.August, 30, 12, 0, 0, 0, time.UTC)
PublicAvatarForumThread = "https://www.nonshy.com/forum/thread/667"
) )
// Forum settings // Forum settings

View File

@ -18,11 +18,7 @@ func PublicAvatarConsent(user *models.User, w http.ResponseWriter, r *http.Reque
} }
// If the current user has a non-public avatar and has not consented. // If the current user has a non-public avatar and has not consented.
if user.ProfilePhoto.ID > 0 && user.ProfilePhoto.Visibility != models.PhotoPublic { if user.NeedsPublicAvatarConsent() {
if user.GetProfileField("public_avatar_consent") == "true" {
return
}
templates.Redirect(w, "/settings/public-avatar-consent?next="+url.QueryEscape(r.URL.String())) templates.Redirect(w, "/settings/public-avatar-consent?next="+url.QueryEscape(r.URL.String()))
return true return true
} }

View File

@ -97,6 +97,13 @@ func (um ShyMap) Get(id uint64) bool {
return um[id] return um[id]
} }
// NeedsPublicAvatarConsent returns true if the user will be impacted by the Public Avatar policy.
//
// That is, their default profile picture is non-public and they have not answered the consent form.
func (u *User) NeedsPublicAvatarConsent() bool {
return u.ProfilePhoto.ID > 0 && u.ProfilePhoto.Visibility != PhotoPublic && u.GetProfileField("public_avatar_consent") != "true"
}
// MapPublicAvatarConsent checks a set of users if they have answered the public avatar consent form. // MapPublicAvatarConsent checks a set of users if they have answered the public avatar consent form.
func MapPublicAvatarConsent(users []*User) (map[uint64]bool, error) { func MapPublicAvatarConsent(users []*User) (map[uint64]bool, error) {
var ( var (

View File

@ -25,6 +25,7 @@ func MergeVars(r *http.Request, m map[string]interface{}) {
// Temporary? variables for migration efforts on PublicAvatar consent. // Temporary? variables for migration efforts on PublicAvatar consent.
m["PublicAvatarEnforcementDate"] = config.PublicAvatarEnforcementDate m["PublicAvatarEnforcementDate"] = config.PublicAvatarEnforcementDate
m["PublicAvatarForumThread"] = config.PublicAvatarForumThread
if r == nil { if r == nil {
return return

View File

@ -13,6 +13,48 @@
<div class="block p-4"> <div class="block p-4">
<div class="columns"> <div class="columns">
<div class="column"> <div class="column">
<!-- Public Avatar Consent notice -->
{{if and (.CurrentUser.Certified) (.CurrentUser.NeedsPublicAvatarConsent)}}
<div class="card block">
<header class="card-header has-background-danger">
<p class="card-header-title has-text-light">
<i class="fa fa-info-circle mr-2"></i>
<span>Notification about an upcoming change in Profile Picture policy</span>
</p>
</header>
<div class="card-content content">
<p>
Beginning on <strong>{{.PublicAvatarEnforcementDate.Format "January 2, 2006"}}</strong>,
{{PrettyTitle}} will begin to require that your square cropped profile picture (your "avatar" image)
will need be visible to all members of the website.
</p>
<p>
Please see the <a href="{{.PublicAvatarForumThread}}">announcement thread in the forum</a>
about the upcoming change, and visit the <a href="/settings/public-avatar-consent">Public Avatar Consent page</a>
for more information.
</p>
<p>
You are seeing this message because your default profile picture is set to
{{if eq .CurrentUser.ProfilePhoto.Visibility "friends"}}
"Friends-only"
{{else if eq .CurrentUser.ProfilePhoto.Visibility "private"}}
"Private"
{{else if eq .CurrentUser.ProfilePhoto.Visibility "circle"}}
"Inner circle only"
{{else}}
"{{.CurrentUser.ProfilePhoto.Visibility}}"
{{end}} and your avatar currently shows as a placeholder image to members
who are not allowed to see it. This message will disappear after you have
<a href="/settings/public-avatar-consent#consent">accepted the upcoming change in policy</a>
or you set a "Public" photo as your profile picture.
</p>
</div>
</div>
{{end}}
<!-- Onboarding Checklist --> <!-- Onboarding Checklist -->
{{if or (not .CurrentUser.Certified) (not .CurrentUser.ProfilePhoto.ID)}} {{if or (not .CurrentUser.Certified) (not .CurrentUser.ProfilePhoto.ID)}}
<div class="card block"> <div class="card block">

View File

@ -42,6 +42,12 @@
have responded to this consent form by answering the prompt at the bottom of this page. have responded to this consent form by answering the prompt at the bottom of this page.
</p> </p>
<p>
If your profile picture is already set to "Public" visibility: no action is needed from
you at this time. However, you may be asked to respond to this consent form in the future
if you set a non-public photo to be your default profile picture.
</p>
<ul> <ul>
<li> <li>
<a href="#summary">Summary of the change</a> <a href="#summary">Summary of the change</a>

View File

@ -56,6 +56,19 @@
</div> </div>
{{end}} {{end}}
<!-- Public Avatar Consent notification -->
{{if Now.Before .PublicAvatarEnforcementDate}}
<div class="notification is-info is-light">
<i class="fa fa-info-circle mr-2"></i>
<strong>Notice of an upcoming website policy change:</strong> beginning on {{.PublicAvatarEnforcementDate.Format "January 2, 2006"}},
all square cropped default profile pictures will need to be made visible to all {{PrettyTitle}} members. The
<img src="/static/img/shy-friends.png" width="16" height="16" alt=""> yellow and
<img src="/static/img/shy-private.png" width="16" height="16" alt=""> purple placeholder avatars
that you sometimes see in the chat room will be going away after that time.<br><br>
Please <a href="{{.PublicAvatarForumThread}}">see the announcement post on the forum</a> for more information.
</div>
{{end}}
<div class="content"> <div class="content">
<p> <p>
{{PrettyTitle}} has a chat room! Come and check it out. It features some public rooms, direct {{PrettyTitle}} has a chat room! Come and check it out. It features some public rooms, direct