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
end
def has_been_reverted?(current_user, notes_association = nil)
!!reverting_commit(current_user, notes_association)
reverting_commit(current_user, notes_association).present?
end
def reverting_commit(current_user, notes_association = nil)
......
......@@ -1577,18 +1577,14 @@ class MergeRequest < ApplicationRecord
end
def reverted_by_merge_request?(current_user)
!!reverting_merge_request(current_user)
reverting_merge_request(current_user).present?
end
def reverting_merge_request(current_user)
return unless merge_commit
return unless merged_at
cutoff = merged_at - 1.minute
notes_association = notes_with_associations.where('created_at >= ?', cutoff)
reverting_commit = merge_commit.reverting_commit(current_user, notes_association)
reverting_commit = merge_commit.reverting_commit(current_user, notes_with_associations)
if reverting_commit
MergeRequestsFinder.new(
......
......@@ -40,14 +40,12 @@
.issuable-meta
%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)')
- elsif merge_request.merged?
%li.issuable-status.d-none.d-sm-inline-block
- elsif merge_request.merged?
= _('MERGED')
- elsif merge_request.closed?
%li.issuable-status.d-none.d-sm-inline-block
- elsif merge_request.closed?
= sprite_icon('cancel', css_class: 'gl-vertical-align-text-bottom')
= _('CLOSED')
= render 'shared/merge_request_pipeline_status', merge_request: merge_request
......
......@@ -14,11 +14,10 @@
.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.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
%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(s_('MergeRequest|reverted'), merge_request_path(@merge_request.reverting_merge_request(current_user)), class: 'gl-reset-color! gl-text-decoration-underline') }
- else
= state_human_name
.issuable-meta
......
......@@ -59,12 +59,9 @@ mainline:
git revert -m 2 7a39eb0
```
## Reverted Indicator
Merge Requests that are reverted by another merge request using one of these
methods will display a link to the other MR.
![Reverted indicator in the status box](img/mr_reverted_indicator.png)
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
will display a link to the reverted merge request at the top-left corner within the **Merged** badge.
<!-- ## Troubleshooting
......
......@@ -17479,6 +17479,9 @@ msgstr ""
msgid "MergeRequest|Search files (%{modifier_key}P)"
msgstr ""
msgid "MergeRequest|reverted"
msgstr ""
msgid "Merged"
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