Commit 28b3db68 authored by Kev's avatar Kev

Add changes suggested in code review

- remove unused image
- docs changes
- ruby and haml code style improvements
parent bf7a1c02
...@@ -428,7 +428,7 @@ class Commit ...@@ -428,7 +428,7 @@ class Commit
end end
def has_been_reverted?(current_user, notes_association = nil) def has_been_reverted?(current_user, notes_association = nil)
!!reverting_commit(current_user, notes_association) reverting_commit(current_user, notes_association).present?
end end
def reverting_commit(current_user, notes_association = nil) def reverting_commit(current_user, notes_association = nil)
......
...@@ -1577,18 +1577,14 @@ class MergeRequest < ApplicationRecord ...@@ -1577,18 +1577,14 @@ class MergeRequest < ApplicationRecord
end end
def reverted_by_merge_request?(current_user) def reverted_by_merge_request?(current_user)
!!reverting_merge_request(current_user) reverting_merge_request(current_user).present?
end end
def reverting_merge_request(current_user) def reverting_merge_request(current_user)
return unless merge_commit return unless merge_commit
return unless merged_at return unless merged_at
cutoff = merged_at - 1.minute reverting_commit = merge_commit.reverting_commit(current_user, notes_with_associations)
notes_association = notes_with_associations.where('created_at >= ?', cutoff)
reverting_commit = merge_commit.reverting_commit(current_user, notes_association)
if reverting_commit if reverting_commit
MergeRequestsFinder.new( MergeRequestsFinder.new(
......
...@@ -40,14 +40,12 @@ ...@@ -40,14 +40,12 @@
.issuable-meta .issuable-meta
%ul.controls.d-flex.align-items-end %ul.controls.d-flex.align-items-end
- if merge_request.reverted_by_merge_request?(current_user) %li.issuable-status.d-none.d-sm-inline-block
%li.issuable-status.d-none.d-sm-inline-block - if merge_request.reverted_by_merge_request?(current_user)
= _('MERGED (REVERTED)') = _('MERGED (REVERTED)')
- elsif merge_request.merged? - elsif merge_request.merged?
%li.issuable-status.d-none.d-sm-inline-block
= _('MERGED') = _('MERGED')
- elsif merge_request.closed? - elsif merge_request.closed?
%li.issuable-status.d-none.d-sm-inline-block
= sprite_icon('cancel', css_class: 'gl-vertical-align-text-bottom') = sprite_icon('cancel', css_class: 'gl-vertical-align-text-bottom')
= _('CLOSED') = _('CLOSED')
= render 'shared/merge_request_pipeline_status', merge_request: merge_request = render 'shared/merge_request_pipeline_status', merge_request: merge_request
......
...@@ -14,11 +14,10 @@ ...@@ -14,11 +14,10 @@
.detail-page-header-body .detail-page-header-body
.issuable-status-box.status-box{ class: status_box_class(@merge_request) } .issuable-status-box.status-box{ class: status_box_class(@merge_request) }
= sprite_icon(state_icon_name, css_class: 'd-block d-sm-none') = sprite_icon(state_icon_name, css_class: 'd-block d-sm-none')
- if @merge_request.reverted_by_merge_request?(current_user) %span.d-none.d-sm-block
%span.d-none.d-sm-block - if @merge_request.reverted_by_merge_request?(current_user)
= _('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') } = _('Merged (%{reverted})').html_safe % { reverted: link_to(s_('MergeRequest|reverted'), merge_request_path(@merge_request.reverting_merge_request(current_user)), class: 'gl-reset-color! gl-text-decoration-underline') }
- else - else
%span.d-none.d-sm-block
= state_human_name = state_human_name
.issuable-meta .issuable-meta
......
...@@ -59,12 +59,9 @@ mainline: ...@@ -59,12 +59,9 @@ mainline:
git revert -m 2 7a39eb0 git revert -m 2 7a39eb0
``` ```
## Reverted Indicator From [GitLab 13.7 onwards](https://gitlab.com/gitlab-org/gitlab/-/issues/35824), merge requests
reverted by another merge request through one of the methods described in this document
Merge Requests that are reverted by another merge request using one of these will display a link to the reverted merge request at the top-left corner within the **Merged** badge.
methods will display a link to the other MR.
![Reverted indicator in the status box](img/mr_reverted_indicator.png)
<!-- ## Troubleshooting <!-- ## Troubleshooting
......
...@@ -17479,6 +17479,9 @@ msgstr "" ...@@ -17479,6 +17479,9 @@ msgstr ""
msgid "MergeRequest|Search files (%{modifier_key}P)" msgid "MergeRequest|Search files (%{modifier_key}P)"
msgstr "" msgstr ""
msgid "MergeRequest|reverted"
msgstr ""
msgid "Merged" msgid "Merged"
msgstr "" msgstr ""
......
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