mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-25 15:53:36 +01:00
1496bb6079
There are a few changes of template logic which defines when which elements should be shown on profile page. The motivation is to have the elements when needed and don't when they're not relevant. ## Changes ### RSS button Now displayed if: * feeds are enabled AND one or more of: * the current user is an admin * the current user is viewing their profile * the activity is publicly available So, basically in cases when the .rss feed actually contains any events. Before this change this button was constantly shown and was giving an empty feed if it was unavailable. ### Public activity tab The tab is displayed if: * the current user is an admin * the current user is viewing their profile * the activity is publicly available * the current tab is this exact tab, for example, in case it was accessed by adding `?tab=activity` to the URL, so that the UI is not broken w/o a highlighted tab So, this tab is not displayed when it's not going to contain any information, but still can be accessed. ### Banner "This user has disabled the public visibility of the activity." For admins: * always show the big blue banner to warn that sharing a screenshot of this publicly is bad idea For self: * always display a little note about the current visibility status with a "Change" link For others: * only display a little note to explain why the activity is not shown ### Heatmap and activity feed Elements are only displayed when relevant, instead of keeping empty leftovers, for easier testing. This template change is also covered by test. **Everything in this Changes section is covered by test unless I forgot something.** ## Preview There's obviously too many states to screenshot, here are highlights: ![](https://codeberg.org/attachments/47559531-9bcd-46c0-90d4-8b51512da752) _Warning admin for why they're seeing the information_ ![](https://codeberg.org/attachments/3107bf62-955b-4fe5-bce3-6305a928afe1) _Viewing self - private_ ![](https://codeberg.org/attachments/afb63ead-fb0b-4fc7-9d8b-c6c09e9ae62b) _Viewing self - public_ ![](https://codeberg.org/attachments/df3c090a-7490-4827-b33b-771fd4fa0a9f) _Don't have access to the information_ ![](https://codeberg.org/attachments/2dd2b0ac-2fe0-4453-aa4b-e91fd08f4411) _The tab is not shown when the activity can't be accessed_ ![](https://codeberg.org/attachments/ed4c61de-b3b7-4523-b92b-bc76e1d8b7c5) _Can't access the RSS feed_ ![](https://codeberg.org/attachments/5a27f2be-d79c-4fb4-85a5-758348398f1b) _Can access the RSS feed_ Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4189 Reviewed-by: Otto <otto@codeberg.org>
76 lines
2.6 KiB
Go HTML Template
76 lines
2.6 KiB
Go HTML Template
{{template "base/head" .}}
|
|
<div role="main" aria-label="{{.Title}}" class="page-content user profile">
|
|
<div class="ui container">
|
|
{{template "base/alert" .}}
|
|
<div class="ui stackable grid">
|
|
<div class="ui four wide column">
|
|
{{template "shared/user/profile_big_avatar" .}}
|
|
</div>
|
|
<div class="ui twelve wide column tw-mb-4">
|
|
{{template "user/overview/header" .}}
|
|
{{if eq .TabName "activity"}}
|
|
{{if eq .SignedUserID .ContextUser.ID}}
|
|
<p id="visibility-hint">
|
|
{{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"}}
|
|
{{end}}
|
|
</p>
|
|
{{else}}
|
|
{{if .IsAdmin}}
|
|
<div id="visibility-hint" class="ui info message">
|
|
{{if .ContextUser.KeepActivityPrivate}}
|
|
{{ctx.Locale.Tr "user.public_activity.visibility_hint.admin_private"}}
|
|
{{else}}
|
|
{{ctx.Locale.Tr "user.public_activity.visibility_hint.admin_public"}}
|
|
{{end}}
|
|
</div>
|
|
{{else}}
|
|
{{if .ContextUser.KeepActivityPrivate}}
|
|
<p id="visibility-hint">{{ctx.Locale.Tr "user.disabled_public_activity"}}</p>
|
|
{{end}}
|
|
{{end}}
|
|
{{end}}
|
|
{{if or .IsAdmin (eq .SignedUserID .ContextUser.ID) (not .ContextUser.KeepActivityPrivate)}}
|
|
{{template "user/heatmap" .}}
|
|
{{template "user/dashboard/feeds" .}}
|
|
{{end}}
|
|
{{else if eq .TabName "stars"}}
|
|
<div class="stars">
|
|
{{template "shared/repo_search" .}}
|
|
{{template "explore/repo_list" .}}
|
|
{{template "base/paginate" .}}
|
|
</div>
|
|
{{else if eq .TabName "following"}}
|
|
{{template "repo/user_cards" .}}
|
|
{{else if eq .TabName "followers"}}
|
|
{{template "repo/user_cards" .}}
|
|
{{else if eq .TabName "overview"}}
|
|
<div id="readme_profile" class="markup">{{.ProfileReadme}}</div>
|
|
{{else}}
|
|
{{template "shared/repo_search" .}}
|
|
{{template "explore/repo_list" .}}
|
|
{{template "base/paginate" .}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ui g-modal-confirm delete modal" id="block-user">
|
|
<div class="header">
|
|
{{ctx.Locale.Tr "user.block_user"}}
|
|
</div>
|
|
<div class="content">
|
|
<p>{{ctx.Locale.Tr "user.block_user.detail"}}</p>
|
|
<ul>
|
|
<li>{{ctx.Locale.Tr "user.block_user.detail_1"}}</li>
|
|
<li>{{ctx.Locale.Tr "user.block_user.detail_2"}}</li>
|
|
<li>{{ctx.Locale.Tr "user.block_user.detail_3"}}</li>
|
|
</ul>
|
|
</div>
|
|
{{template "base/modal_actions_confirm" .}}
|
|
</div>
|
|
|
|
{{template "base/footer" .}}
|