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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
dfe9f0bc
Commit
dfe9f0bc
authored
Feb 07, 2018
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplicate calls of MergeRequest#can_be_reverted?
parent
64416126
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
app/presenters/merge_request_presenter.rb
app/presenters/merge_request_presenter.rb
+10
-2
changelogs/unreleased/osw-remove-duplicate-can-be-reverted-calls.yml
...unreleased/osw-remove-duplicate-can-be-reverted-calls.yml
+5
-0
No files found.
app/presenters/merge_request_presenter.rb
View file @
dfe9f0bc
...
...
@@ -3,6 +3,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
include
GitlabRoutingHelper
include
MarkupHelper
include
TreeHelper
include
Gitlab
::
Utils
::
StrongMemoize
presents
:merge_request
...
...
@@ -43,7 +44,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
end
def
revert_in_fork_path
if
user_can_fork_project?
&&
can_be_reverted?
(
current_user
)
if
user_can_fork_project?
&&
_can_be_reverted?
continue_params
=
{
to:
merge_request_path
(
merge_request
),
notice:
"
#{
edit_in_new_fork_notice
}
Try to cherry-pick this commit again."
,
...
...
@@ -151,7 +152,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
end
def
can_revert_on_current_merge_request?
user_can_collaborate_with_project?
&&
can_be_reverted?
(
current_user
)
user_can_collaborate_with_project?
&&
_can_be_reverted?
end
def
can_cherry_pick_on_current_merge_request?
...
...
@@ -164,6 +165,13 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated
private
# Method overrides doesn't work for Gitlab::View::Presenter::Delegated
def
_can_be_reverted?
strong_memoize
(
:can_be_reverted
)
do
can_be_reverted?
(
current_user
)
end
end
def
conflicts
@conflicts
||=
MergeRequests
::
Conflicts
::
ListService
.
new
(
merge_request
)
end
...
...
changelogs/unreleased/osw-remove-duplicate-can-be-reverted-calls.yml
0 → 100644
View file @
dfe9f0bc
---
title
:
Remove duplicate calls of MergeRequest#can_be_reverted?
merge_request
:
author
:
type
:
performance
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