52 lines
3 KiB
Text
52 lines
3 KiB
Text
- merge_request = local_assigns.fetch(:merge_request, nil)
|
|
- project = local_assigns.fetch(:project) { merge_request&.project }
|
|
- ref = local_assigns.fetch(:ref) { merge_request&.source_branch }
|
|
- can_update_merge_request = can?(current_user, :update_merge_request, @merge_request)
|
|
|
|
- commits = @commits&.map { |commit| commit.present(current_user: current_user) }
|
|
- context_commits = @context_commits&.map { |commit| commit.present(current_user: current_user) }
|
|
- hidden = @hidden_commit_count
|
|
|
|
- commits.chunk { |c| c.committed_date.in_time_zone.to_date }.each do |day, daily_commits|
|
|
%li.commit-header.js-commit-header{ data: { day: day } }
|
|
%span.day= l(day, format: '%d %b, %Y')
|
|
%span.commits-count= n_("%d commit", "%d commits", daily_commits.size) % daily_commits.size
|
|
|
|
%li.commits-row{ data: { day: day } }
|
|
%ul.content-list.commit-list.flex-list
|
|
- if Feature.enabled?(:cached_commits, project)
|
|
= render partial: 'projects/commits/commit', collection: daily_commits, locals: { project: project, ref: ref, merge_request: merge_request }, cached: -> (commit) { commit_partial_cache_key(commit, ref: ref, merge_request: merge_request, request: request) }
|
|
- else
|
|
= render partial: 'projects/commits/commit', collection: daily_commits, locals: { project: project, ref: ref, merge_request: merge_request }
|
|
|
|
- if context_commits.present?
|
|
%li.commit-header.js-commit-header
|
|
%span.font-weight-bold= n_("%d previously merged commit", "%d previously merged commits", context_commits.count) % context_commits.count
|
|
- if can_update_merge_request
|
|
= render Pajamas::ButtonComponent.new(button_options: { class: 'gl-ml-3 add-review-item-modal-trigger', data: { context_commits_empty: 'false' } }) do
|
|
= _('Add/remove')
|
|
|
|
%li.commits-row
|
|
%ul.content-list.commit-list.flex-list
|
|
- if Feature.enabled?(:cached_commits, project)
|
|
= render partial: 'projects/commits/commit', collection: context_commits, locals: { project: project, ref: ref, merge_request: merge_request }, cached: -> (commit) { commit_partial_cache_key(commit, ref: ref, merge_request: merge_request, request: request) }
|
|
- else
|
|
= render partial: 'projects/commits/commit', collection: context_commits, locals: { project: project, ref: ref, merge_request: merge_request }
|
|
|
|
- if hidden > 0 && !@merge_request
|
|
%li
|
|
= render Pajamas::AlertComponent.new(variant: :warning,
|
|
dismissible: false) do |c|
|
|
= c.body do
|
|
= n_('%s additional commit has been omitted to prevent performance issues.', '%s additional commits have been omitted to prevent performance issues.', hidden) % number_with_delimiter(hidden)
|
|
|
|
- if can_update_merge_request && context_commits&.empty? && !(defined?(@next_page) && @next_page)
|
|
.add-review-item-modal-trigger{ data: { context_commits_empty: 'true' } }
|
|
|
|
- if commits.size == 0 && context_commits.nil?
|
|
.commits-empty.gl-mt-6
|
|
= custom_icon('illustration_no_commits')
|
|
%h4
|
|
= _('Your search didn\'t match any commits.')
|
|
%p
|
|
= _('Try changing or removing filters.')
|