loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request 'Make user privacy settings more clear' (#4439) from 0ko/forgejo:ui-settings-activity into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4439
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>

+32 -13
+2 -2
options/locale/locale_en-US.ini
··· 768 768 saved_successfully = Your settings were saved successfully. 769 769 privacy = Privacy 770 770 keep_activity_private = Hide activity from profile page 771 - keep_activity_private_popup = Your activity will only be visible to you and the instance admins 771 + keep_activity_private.description = Your <a href="%s">public activity</a> will only be visible to you and the instance administrators. 772 772 773 773 lookup_avatar_by_mail = Lookup avatar by email address 774 774 federated_avatar_lookup = Federated avatar lookup ··· 820 820 email_preference_set_success = Email preference has been set successfully. 821 821 add_openid_success = The new OpenID address has been added. 822 822 keep_email_private = Hide email address 823 - keep_email_private_popup = This will hide your email address from your profile, as well as when you make a pull request or edit a file using the web interface. Pushed commits will not be modified. Use %s in commits to associate them with your account. 823 + keep_email_private_popup = This will hide your email address from your profile. It will no longer be the default for commits made via the web interface, like file uploads and edits, and will not be used for merge commits. Instead a special address %s can be used to associate commits with your account. Note that changing this option will not affect existing commits. 824 824 openid_desc = OpenID lets you delegate authentication to an external provider. 825 825 826 826 manage_ssh_keys = Manage SSH keys
+1
release-notes/9.0.0/4439.md
··· 1 + Make descriptions of user privacy settings more visible and clear
+4 -2
templates/user/settings/profile.tmpl
··· 103 103 104 104 <div class="field"> 105 105 <div class="ui checkbox"> 106 - <label data-tooltip-content="{{ctx.Locale.Tr "settings.keep_email_private_popup" .SignedUser.GetPlaceholderEmail}}"><strong>{{ctx.Locale.Tr "settings.keep_email_private"}}</strong></label> 106 + <label>{{ctx.Locale.Tr "settings.keep_email_private"}}</label> 107 107 <input name="keep_email_private" type="checkbox" {{if .SignedUser.KeepEmailPrivate}}checked{{end}}> 108 108 </div> 109 + <span class="help tw-block">{{ctx.Locale.Tr "settings.keep_email_private_popup" .SignedUser.GetPlaceholderEmail}}</span> 109 110 </div> 110 111 111 112 <div class="field"> 112 113 <div class="ui checkbox" id="keep-activity-private"> 113 - <label data-tooltip-content="{{ctx.Locale.Tr "settings.keep_activity_private_popup"}}"><strong>{{ctx.Locale.Tr "settings.keep_activity_private"}}</strong></label> 114 + <label>{{ctx.Locale.Tr "settings.keep_activity_private"}}</label> 114 115 <input name="keep_activity_private" type="checkbox" {{if .SignedUser.KeepActivityPrivate}}checked{{end}}> 115 116 </div> 117 + <span class="help tw-block">{{ctx.Locale.Tr "settings.keep_activity_private.description" (printf "/%s?tab=activity" .SignedUser.Name)}}</span> 116 118 </div> 117 119 118 120 <div class="divider"></div>
+25 -9
tests/integration/user_profile_activity_test.go
··· 24 24 // Activity availability should be the same for guest and another non-admin user, so this is not tested separately 25 25 userGuest := emptyTestSession(t) 26 26 27 - // The hint may contain "Configure" link with an anchor. Verify that it works. 28 - response := userRegular.MakeRequest(t, NewRequest(t, "GET", "/user/settings"), http.StatusOK) 29 - page := NewHTMLParser(t, response.Body) 30 - assert.True(t, page.Find(".checkbox#keep-activity-private").Length() > 0) 31 - 32 27 // = Public = 33 28 34 29 // Set activity visibility of user2 to public. This is the default, but won't hurt to set it before testing. ··· 41 36 42 37 // Verify the hint for all types of users: admin, self, guest 43 38 testUser2ActivityVisibility(t, userAdmin, "This activity is visible to everyone, but as an administrator you can also see interactions in private spaces.", true) 44 - testUser2ActivityVisibility(t, userRegular, "Your activity is visible to everyone, except for interactions in private spaces. Configure.", true) 39 + hintLink := testUser2ActivityVisibility(t, userRegular, "Your activity is visible to everyone, except for interactions in private spaces. Configure.", true) 45 40 testUser2ActivityVisibility(t, userGuest, "", true) 46 41 42 + // When viewing own profile, the user is offered to configure activity visibility. Verify that the link is correct and works, also check that it links back to the activity tab. 43 + linkCorrect := assert.EqualValues(t, "/user/settings#keep-activity-private", hintLink) 44 + if linkCorrect { 45 + page := NewHTMLParser(t, userRegular.MakeRequest(t, NewRequest(t, "GET", hintLink), http.StatusOK).Body) 46 + activityLink, exists := page.Find(".field:has(.checkbox#keep-activity-private) .help a").Attr("href") 47 + assert.True(t, exists) 48 + assert.EqualValues(t, "/user2?tab=activity", activityLink) 49 + } 50 + 47 51 // = Private = 48 52 49 53 // Set activity visibility of user2 to private ··· 56 60 57 61 // Verify the hint for all types of users: admin, self, guest 58 62 testUser2ActivityVisibility(t, userAdmin, "This activity is visible to you because you're an administrator, but the user wants it to remain private.", true) 59 - testUser2ActivityVisibility(t, userRegular, "Your activity is only visible to you and the instance administrators. Configure.", true) 63 + hintLink = testUser2ActivityVisibility(t, userRegular, "Your activity is only visible to you and the instance administrators. Configure.", true) 60 64 testUser2ActivityVisibility(t, userGuest, "This user has disabled the public visibility of the activity.", false) 65 + 66 + // Verify that Configure link is correct 67 + assert.EqualValues(t, "/user/settings#keep-activity-private", hintLink) 61 68 }) 62 69 } 63 70 ··· 72 79 } 73 80 74 81 // testUser2ActivityVisibility checks visibility of UI elements on /<user>?tab=activity 75 - func testUser2ActivityVisibility(t *testing.T, session *TestSession, hint string, availability bool) { 82 + // It also returns the account visibility link if it is present on the page. 83 + func testUser2ActivityVisibility(t *testing.T, session *TestSession, hint string, availability bool) string { 84 + t.Helper() 76 85 response := session.MakeRequest(t, NewRequest(t, "GET", "/user2?tab=activity"), http.StatusOK) 77 86 page := NewHTMLParser(t, response.Body) 78 87 // Check hint visibility and correctness 79 88 testSelectorEquals(t, page, "#visibility-hint", hint) 89 + hintLink, hintLinkExists := page.Find("#visibility-hint a").Attr("href") 80 90 81 91 // Check that the hint aligns with the actual feed availability 82 92 assert.EqualValues(t, availability, page.Find("#activity-feed").Length() > 0) ··· 87 97 // Check that the current tab is displayed and is active regardless of it's actual availability 88 98 // For example, on /<user> it wouldn't be available to guest, but it should be still present on /<user>?tab=activity 89 99 assert.True(t, page.Find("overflow-menu .active.item[href='/user2?tab=activity']").Length() > 0) 100 + 101 + if hintLinkExists { 102 + return hintLink 103 + } 104 + return "" 90 105 } 91 106 92 - // testUser2ActivityButtonsAvailability check visibility of Public activity tab on main profile page 107 + // testUser2ActivityButtonsAvailability checks visibility of Public activity tab on main profile page 93 108 func testUser2ActivityButtonsAvailability(t *testing.T, session *TestSession, buttons bool) { 109 + t.Helper() 94 110 response := session.MakeRequest(t, NewRequest(t, "GET", "/user2"), http.StatusOK) 95 111 page := NewHTMLParser(t, response.Body) 96 112 assert.EqualValues(t, buttons, page.Find("overflow-menu .item[href='/user2?tab=activity']").Length() > 0)