Forgejo/templates
0ko 1496bb6079 Better logic for showing user feed/public activity elements (#4189)
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>
2024-06-24 08:19:11 +00:00
..
admin Merge pull request 'Replace gt-word-break with tw-break-anywhere' (#4102) from 0ko/forgejo:ui-replace-gt-word-break into forgejo 2024-06-11 10:39:03 +00:00
api/packages/pypi Update templates/api/packages/pypi/simple.tmpl 2024-04-12 16:43:30 +00:00
base Add slogan config (#3752) 2024-06-07 17:12:48 +00:00
custom [FEAT] Repository flags 2024-02-05 16:09:42 +01:00
devtest Fix some URLs whose sub-path is missing (#31289) 2024-06-09 16:04:57 +02:00
explore [I18N] Injected updated time in translation string (#3837) 2024-05-20 18:47:35 +00:00
mail Remove title from email heads (#3810) 2024-05-17 10:10:33 +00:00
org Org buttons add missing vertical padding (#3964) 2024-06-09 18:24:38 +00:00
package Extract and display readme and comments for Composer packages (#30927) 2024-06-16 13:42:59 +02:00
projects Merge pull request 'Replace gt-word-break with tw-break-anywhere' (#4102) from 0ko/forgejo:ui-replace-gt-word-break into forgejo 2024-06-11 10:39:03 +00:00
repo Merge pull request 'Add headers to follower lists' (#4174) from 0ko/forgejo:ui-profile-followers-title into forgejo 2024-06-19 09:54:41 +00:00
shared Better logic for showing user feed/public activity elements (#4189) 2024-06-24 08:19:11 +00:00
status Add slogan config (#3752) 2024-06-07 17:12:48 +00:00
swagger [SWAGGER] Make it consistent with reality 2024-06-19 07:16:42 +02:00
user Better logic for showing user feed/public activity elements (#4189) 2024-06-24 08:19:11 +00:00
webhook webhook: matrix access_token helper text 2024-04-16 08:59:56 +02:00
home.tmpl Add slogan config (#3752) 2024-06-07 17:12:48 +00:00
install.tmpl A few cosmetic improvements to the installation page (#4170) 2024-06-18 09:49:56 +00:00
post-install.tmpl [BRANDING] Custom loading animation for Forgejo 2024-02-05 16:02:13 +01:00