Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kounoike
Copy link
Contributor

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:

  • read the contribution guidelines
  • rebased my branch over master
  • verified that project is compiling
  • verified that tests are passing
  • squashed my commits as appropriate (keep several commits if it is relevant to understand the PR)
  • marked as closed using commit message all issue ID that this PR should correct

Copy link
Member

@takezoe takezoe left a 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)
Copy link
Member

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?

Copy link
Contributor Author

@kounoike kounoike May 12, 2018

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?"

Copy link
Member

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 = {
Copy link
Member

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

'x' days ago is not a useful information in commit list.
2 participants