From 3e1d5cc44701ffc4f50a932c6d78ff4db492977d Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Mon, 21 Oct 2024 14:39:29 +0000 Subject: [PATCH] feat(ui): better activity messages for cases of private profiles (#5638) * added a message for the case where the user's profile is private but the Public activity is not hidden The activity is still hidden anyway because the profile is private, but previously the message would say: `Your activity is visible to everyone, except for interactions in private spaces...` which I would consider as a flaw of the original implementation. Now it will say: `Your activity is only visible to you and the instance administrators because your profile is private...` * started showing the message for admins that the activity they see should remain private in the case where the whole profile is private, not just the activity tab. Previously it would say: This activity is visible to everyone, but as an administrator you can also see interactions in private spaces.` which I would also consider as a flaw of the original implementation. Now it will say: `This activity is visible to you because you're an administrator, but the user wants it to remain private.` * added test cases * bumped up the number of our GPL-licensed files Preview For both screenshots, Forgejo would previously display misinformation. Change 1: User viewing their private profile, but activity isn't configured as hidden https://codeberg.org/attachments/6659c80c-15dd-48be-a379-db737fd1dd5e Change 2: Admin viewing user's private profile https://codeberg.org/attachments/220da57f-b658-4474-9ad2-049e8438a0af Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5638 Reviewed-by: Earl Warren Reviewed-by: Gusted --- options/locale/locale_en-US.ini | 1 + templates/user/profile.tmpl | 8 +++-- templates/user/settings/profile.tmpl | 2 +- .../integration/user_profile_activity_test.go | 36 +++++++++++++++++-- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 7789139b2f..b87fd2a69b 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -712,6 +712,7 @@ public_activity.visibility_hint.self_public = Your activity is visible to everyo public_activity.visibility_hint.admin_public = This activity is visible to everyone, but as an administrator you can also see interactions in private spaces. public_activity.visibility_hint.self_private = Your activity is only visible to you and the instance administrators. Configure. public_activity.visibility_hint.admin_private = This activity is visible to you because you're an administrator, but the user wants it to remain private. +public_activity.visibility_hint.self_private_profile = Your activity is only visible to you and the instance administrators because your profile is private. Configure. form.name_reserved = The username "%s" is reserved. form.name_pattern_not_allowed = The pattern "%s" is not allowed in a username. diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 477b838b0f..1f39576ac2 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -14,13 +14,17 @@ {{if .ContextUser.KeepActivityPrivate}} {{ctx.Locale.Tr "user.public_activity.visibility_hint.self_private" "/user/settings#keep-activity-private"}} {{else}} - {{ctx.Locale.Tr "user.public_activity.visibility_hint.self_public" "/user/settings#keep-activity-private"}} + {{if eq .ContextUser.Visibility 2}} + {{ctx.Locale.Tr "user.public_activity.visibility_hint.self_private_profile" "/user/settings#visibility-setting"}} + {{else}} + {{ctx.Locale.Tr "user.public_activity.visibility_hint.self_public" "/user/settings#keep-activity-private"}} + {{end}} {{end}}

{{else}} {{if .IsAdmin}}
- {{if .ContextUser.KeepActivityPrivate}} + {{if or .ContextUser.KeepActivityPrivate (eq .ContextUser.Visibility 2)}} {{ctx.Locale.Tr "user.public_activity.visibility_hint.admin_private"}} {{else}} {{ctx.Locale.Tr "user.public_activity.visibility_hint.admin_public"}} diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl index a092a42032..56b5666cae 100644 --- a/templates/user/settings/profile.tmpl +++ b/templates/user/settings/profile.tmpl @@ -76,7 +76,7 @@
- +