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 absolute date/time display option #1990
base: master
Are you sure you want to change the base?
Conversation
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.
Sorry for my slow review. This pull request conflicts subsequent pull requests. If you can resolve conflicts, I will merge this pull request for GitBucket 4.25.0.
@@ -1,5 +1,5 @@ | |||
@(latestUpdatedDate: java.util.Date, | |||
recentOnly: Boolean = true) | |||
recentOnly: Boolean = true)(implicit context: gitbucket.core.controller.Context) |
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.
It might be not necessary to provide this as Twirl template. How about moving this to helper?
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.
Is it means "move to gitbucket.core.view.helpers
?"
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.
Yes, but I think we might have to consider about behavior of date formatting again because it has little complex behavior currently. For example, datetimeAgoRecentOnly
returns absolute date for old dates in current implementation.
In addition, I think Date.toString()
is not good solution to generate display strings.
val value = duration / unitValue | ||
s"${value} ${unitString}${if (value > 1) "s" else ""} ago" | ||
case None => "just now" | ||
def datetimeAgo(date: Date)(implicit context: Context): String = { |
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.
It's nice to apply that the result of this method (and also datetimeAgoRecentOnly
) is changed by context.settings.relativeTime
to Scaladoc comment.
# Conflicts: # src/main/scala/gitbucket/core/controller/SystemSettingsController.scala # src/main/scala/gitbucket/core/service/SystemSettingsService.scala # src/main/twirl/gitbucket/core/admin/settings_system.scala.html # src/test/scala/gitbucket/core/view/AvatarImageProviderSpec.scala
This PR can close #816. Add "Absolute/Relative" time option to system settings. By default, it still uses relateive time format.
Before submitting a pull-request to GitBucket I have first: