Commit 13a2352c authored by Kev's avatar Kev

Fix rubocop offenses

parent ea42b27c
......@@ -1576,13 +1576,13 @@ class MergeRequest < ApplicationRecord
!merge_commit.has_been_reverted?(current_user, notes_association)
end
def is_reverted?(current_user)
def reverted_by_merge_request?(current_user)
!!reverting_merge_request(current_user)
end
def reverting_merge_request(current_user)
return nil unless merge_commit
return nil unless merged_at
return unless merge_commit
return unless merged_at
cutoff = merged_at - 1.minute
......@@ -1590,12 +1590,14 @@ class MergeRequest < ApplicationRecord
reverting_commit = merge_commit.reverting_commit(current_user, notes_association)
MergeRequestsFinder.new(
current_user,
project_id: project.id,
commit_sha: reverting_commit.sha,
state: 'merged'
).execute.first if reverting_commit
if reverting_commit
MergeRequestsFinder.new(
current_user,
project_id: project.id,
commit_sha: reverting_commit.sha,
state: 'merged'
).execute.first
end
end
def merged_at
......
......@@ -40,7 +40,7 @@
.issuable-meta
%ul.controls.d-flex.align-items-end
- if merge_request.is_reverted?(current_user)
- if merge_request.reverted_by_merge_request?(current_user)
%li.issuable-status.d-none.d-sm-inline-block
= _('MERGED (REVERTED)')
- elsif merge_request.merged?
......
......@@ -14,7 +14,7 @@
.detail-page-header-body
.issuable-status-box.status-box{ class: status_box_class(@merge_request) }
= sprite_icon(state_icon_name, css_class: 'd-block d-sm-none')
- if @merge_request.is_reverted?(current_user)
- if @merge_request.reverted_by_merge_request?(current_user)
%span.d-none.d-sm-block
= _('Merged (%{reverted})').html_safe % { reverted: link_to('reverted', merge_request_path(@merge_request.reverting_merge_request(current_user)), class: 'gl-text-white! gl-text-decoration-underline') }
- else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment