Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
28b3db68
Commit
28b3db68
authored
Nov 19, 2020
by
Kev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add changes suggested in code review
- remove unused image - docs changes - ruby and haml code style improvements
parent
bf7a1c02
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
24 deletions
+17
-24
app/models/commit.rb
app/models/commit.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+2
-6
app/views/projects/merge_requests/_merge_request.html.haml
app/views/projects/merge_requests/_merge_request.html.haml
+4
-6
app/views/projects/merge_requests/_mr_title.html.haml
app/views/projects/merge_requests/_mr_title.html.haml
+4
-5
doc/user/project/merge_requests/img/mr_reverted_indicator.png
...user/project/merge_requests/img/mr_reverted_indicator.png
+0
-0
doc/user/project/merge_requests/revert_changes.md
doc/user/project/merge_requests/revert_changes.md
+3
-6
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
app/models/commit.rb
View file @
28b3db68
...
@@ -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
)
...
...
app/models/merge_request.rb
View file @
28b3db68
...
@@ -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
(
...
...
app/views/projects/merge_requests/_merge_request.html.haml
View file @
28b3db68
...
@@ -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
...
...
app/views/projects/merge_requests/_mr_title.html.haml
View file @
28b3db68
...
@@ -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
...
...
doc/user/project/merge_requests/img/mr_reverted_indicator.png
deleted
100644 → 0
View file @
bf7a1c02
22.4 KB
doc/user/project/merge_requests/revert_changes.md
View file @
28b3db68
...
@@ -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
...
...
locale/gitlab.pot
View file @
28b3db68
...
@@ -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 ""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment