diff options
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/ci/group_variable_presenter.rb | 10 | ||||
-rw-r--r-- | app/presenters/ci/variable_presenter.rb | 10 | ||||
-rw-r--r-- | app/presenters/merge_request_presenter.rb | 11 |
3 files changed, 15 insertions, 16 deletions
diff --git a/app/presenters/ci/group_variable_presenter.rb b/app/presenters/ci/group_variable_presenter.rb index 81fea106a5c..98d68bc7a83 100644 --- a/app/presenters/ci/group_variable_presenter.rb +++ b/app/presenters/ci/group_variable_presenter.rb @@ -7,19 +7,15 @@ module Ci end def form_path - if variable.persisted? - group_variable_path(group, variable) - else - group_variables_path(group) - end + group_settings_ci_cd_path(group) end def edit_path - group_variable_path(group, variable) + group_variables_path(group) end def delete_path - group_variable_path(group, variable) + group_variables_path(group) end end end diff --git a/app/presenters/ci/variable_presenter.rb b/app/presenters/ci/variable_presenter.rb index 5d7998393a6..96159f88c59 100644 --- a/app/presenters/ci/variable_presenter.rb +++ b/app/presenters/ci/variable_presenter.rb @@ -7,19 +7,15 @@ module Ci end def form_path - if variable.persisted? - project_variable_path(project, variable) - else - project_variables_path(project) - end + project_settings_ci_cd_path(project) end def edit_path - project_variable_path(project, variable) + project_variables_path(project) end def delete_path - project_variable_path(project, variable) + project_variables_path(project) end end end diff --git a/app/presenters/merge_request_presenter.rb b/app/presenters/merge_request_presenter.rb index c6806b7cc26..08ae49562c7 100644 --- a/app/presenters/merge_request_presenter.rb +++ b/app/presenters/merge_request_presenter.rb @@ -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? && cached_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? && cached_can_be_reverted? end def can_cherry_pick_on_current_merge_request? @@ -164,6 +165,12 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated private + def cached_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 |