-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add global setting how timestamps should be rendered #28657
Conversation
Some admins prefer all timestamps to display the full date instead of relative time. They can do that now by setting ```ini [ui] PREFER_ABSOLUTE_TIMESTAMPS = true ``` Signed-off-by: Yarden Shoham <[email protected]>
custom/conf/app.example.ini
Outdated
@@ -1244,6 +1244,9 @@ LEVEL = Info | |||
;; Change the sort type of the explore pages. | |||
;; Default is "recentupdate", but you also have "alphabetically", "reverselastlogin", "newest", "oldest". | |||
;EXPLORE_PAGING_DEFAULT_SORT = recentupdate | |||
;; | |||
;; Whether to prefer all timestamps to be rendered as absolute. Setting this to false means some timestamps would render as relative. | |||
;PREFER_ABSOLUTE_TIMESTAMPS = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a related note, wouldn't it be better to name the setting
;PREFER_ABSOLUTE_TIMESTAMPS = false | |
;TIMESTAMP_FORMAT = relative |
with relative,absolute
being the possible options (for now)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think other options exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can think of a few at the top of my head: relative_v2, relative_legacy, absolute_v2, absolute_legacy, both, …
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If relative is set here, some timestamps still render as absolute though (e.g. joined on date in profile page)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but those are either intended or a bug.
Either way, to me it makes sense despite some minor exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, if you add a comment why relative
does not yet exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My current description is:
PREFERRED_TIMESTAMP_TENSE
: mixed: The tense all timestamps should be rendered as. Possible values areabsolute
time (i.e. 1970-01-01, 11:59) ormixed
which means some timestamps would render as relative (i.e. 2 days ago).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Today some of our timestamps are absolute and some are relative. I don't know why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some most
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 0504a8c
Signed-off-by: Yarden Shoham <[email protected]>
Co-authored-by: delvh <[email protected]> Signed-off-by: Yarden Shoham <[email protected]>
Should we make this also a user setting? |
Tried it in #24342 |
See #24342, but yes, this is probably the next step. |
The user setting system has some framework-level problems: too complex to use, and it might cause bugs easily. I have refactored the system setting package in #27000 , IMO the user setting system also needs some big refactoring. |
Signed-off-by: Yarden Shoham <[email protected]>
…estamps Signed-off-by: Yarden Shoham <[email protected]>
Co-authored-by: delvh <[email protected]>
* giteaofficial/main: Add global setting how timestamps should be rendered (go-gitea#28657) [skip ci] Updated translations via Crowdin Upgrade xorm to new version which supported update join for all supported databases (go-gitea#28590) Fix: system webhooks API bug (go-gitea#28531) Fix alpine package files are not rebuilt (go-gitea#28638) Fix migration test (go-gitea#28659) Avoid cycle-redirecting user/login page (go-gitea#28636) Fix long package version names overflowing (go-gitea#28619)
- Resolves go-gitea#22493 - Related to go-gitea#4520 Some admins prefer all timestamps to display the full date instead of relative time. They can do that now by setting ```ini [ui] PREFERRED_TIMESTAMP_TENSE = absolute ``` This setting is set to `mixed` by default, allowing dates to render as "5 hours ago". Here are some screenshots of the UI with this setting set to `absolute`: ![image](https://github.com/go-gitea/gitea/assets/20454870/f496457f-6afa-44be-a1e7-249ee5fe0706) ![image](https://github.com/go-gitea/gitea/assets/20454870/c03b14f5-063d-4e13-9780-76ab002d76a9) ![image](https://github.com/go-gitea/gitea/assets/20454870/f4b34e28-1546-4374-9199-c43348844edd) --------- Signed-off-by: Yarden Shoham <[email protected]> Co-authored-by: delvh <[email protected]>
- Resolves go-gitea#22493 - Related to go-gitea#4520 Some admins prefer all timestamps to display the full date instead of relative time. They can do that now by setting ```ini [ui] PREFERRED_TIMESTAMP_TENSE = absolute ``` This setting is set to `mixed` by default, allowing dates to render as "5 hours ago". Here are some screenshots of the UI with this setting set to `absolute`: ![image](https://github.com/go-gitea/gitea/assets/20454870/f496457f-6afa-44be-a1e7-249ee5fe0706) ![image](https://github.com/go-gitea/gitea/assets/20454870/c03b14f5-063d-4e13-9780-76ab002d76a9) ![image](https://github.com/go-gitea/gitea/assets/20454870/f4b34e28-1546-4374-9199-c43348844edd) --------- Signed-off-by: Yarden Shoham <[email protected]> Co-authored-by: delvh <[email protected]>
Some admins prefer all timestamps to display the full date instead of relative time. They can do that now by setting
This setting is set to
![image](https://private-user-images.githubusercontent.com/20454870/293457488-f496457f-6afa-44be-a1e7-249ee5fe0706.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5OTU4NTQsIm5iZiI6MTcyMzk5NTU1NCwicGF0aCI6Ii8yMDQ1NDg3MC8yOTM0NTc0ODgtZjQ5NjQ1N2YtNmFmYS00NGJlLWExZTctMjQ5ZWU1ZmUwNzA2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE1MzkxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIwNTVlOGNhMWRkZTFmYTc5YjQxNmFlMTk3OTkxZThlZDA3MWU5N2JjNTgxNjQ1NWU4MjM3ZGFlOWFiY2E3Y2YmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.2OP8bEIo7XlvFjjKwj3CV5Q-V1LCMDRIVLioTUF1Hho)
![image](https://private-user-images.githubusercontent.com/20454870/293457533-c03b14f5-063d-4e13-9780-76ab002d76a9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5OTU4NTQsIm5iZiI6MTcyMzk5NTU1NCwicGF0aCI6Ii8yMDQ1NDg3MC8yOTM0NTc1MzMtYzAzYjE0ZjUtMDYzZC00ZTEzLTk3ODAtNzZhYjAwMmQ3NmE5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE1MzkxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMxYmM0ZmU3YTdkOTNjYTQyY2NmYmUyNTQyYzg1ZTNjZDdiNTcyODhjNTMzMGUxZDNkN2VhYWVhZGViNTViYWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.qTDqee7b-a2Rm0WMZC-KMk5A7-s7OVGH_HMaa0LUNQQ)
![image](https://private-user-images.githubusercontent.com/20454870/293457547-f4b34e28-1546-4374-9199-c43348844edd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5OTU4NTQsIm5iZiI6MTcyMzk5NTU1NCwicGF0aCI6Ii8yMDQ1NDg3MC8yOTM0NTc1NDctZjRiMzRlMjgtMTU0Ni00Mzc0LTkxOTktYzQzMzQ4ODQ0ZWRkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDE1MzkxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTczYTViMTdiNGFhYTEzZDIxOWQ0NTFhYmZlZTQ1NGQ5ZTk5NzEzZmQxMTY4ODI5YzM0N2YxNDYyYmExYTRhZTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.UG9jSihsJKXyvKR8YwdYFCCB19DgxvCdCyiroKuJgQE)
mixed
by default, allowing dates to render as "5 hours ago". Here are some screenshots of the UI with this setting set toabsolute
: