diff --git a/app/helpers/git_helper.rb b/app/helpers/git_helper.rb index 1e44b61d1..bb053fac7 100644 --- a/app/helpers/git_helper.rb +++ b/app/helpers/git_helper.rb @@ -93,8 +93,9 @@ module GitHelper end def split_commits_by_date(commits) - commits.sort{|x, y| y.authored_date <=> x.authored_date}.inject({}) do |h, commit| - dt = commit.authored_date + # See: https://github.com/gitlabhq/gitlabhq/blob/master/app/views/projects/commits/_commits.html.haml#L1 + commits.sort{|x, y| y.committed_date <=> x.committed_date}.inject({}) do |h, commit| + dt = commit.committed_date h[dt.year] ||= {} h[dt.year][dt.month] ||= {} h[dt.year][dt.month][dt.day] ||= [] diff --git a/app/presenters/git_presenters/commit_as_message_presenter.rb b/app/presenters/git_presenters/commit_as_message_presenter.rb index 420b45ca5..2248fb9ac 100644 --- a/app/presenters/git_presenters/commit_as_message_presenter.rb +++ b/app/presenters/git_presenters/commit_as_message_presenter.rb @@ -61,7 +61,7 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter end def content? - !content.blank? + content.present? end def caption? @@ -108,7 +108,7 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter @content = (@content.present?) ? tmp + @content : tmp @caption = @caption[0..68] + '...' end -# @content = @content.gsub("\n", "
").html_safe if @content + # @content = @content.gsub("\n", "
").html_safe if @content @content = simple_format(@content, {}, sanitize: true).html_safe if @content end end diff --git a/app/views/projects/git/commits/_commits.html.haml b/app/views/projects/git/commits/_commits.html.haml index c28dcd0c8..bae720729 100644 --- a/app/views/projects/git/commits/_commits.html.haml +++ b/app/views/projects/git/commits/_commits.html.haml @@ -9,7 +9,7 @@ - by_month.each_pair do |month, by_day| - by_day.each_pair do |day, commits| .date-block - .date= raw l(commits.first.authored_date, format: :date_block_format) + .date= raw l(commits.first.committed_date, format: :date_block_format) .messages - commits.each_with_index do |commit| - GitPresenters::CommitAsMessagePresenter.present(commit, project: @project) do |presenter|