diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /app/presenters | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/analytics/cycle_analytics/stage_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/ci/build_runner_presenter.rb | 3 | ||||
-rw-r--r-- | app/presenters/merge_request_presenter.rb | 13 | ||||
-rw-r--r-- | app/presenters/project_hook_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/project_member_presenter.rb | 22 | ||||
-rw-r--r-- | app/presenters/project_presenter.rb | 4 | ||||
-rw-r--r-- | app/presenters/service_hook_presenter.rb | 2 | ||||
-rw-r--r-- | app/presenters/web_hook_log_presenter.rb | 2 |
8 files changed, 31 insertions, 19 deletions
diff --git a/app/presenters/analytics/cycle_analytics/stage_presenter.rb b/app/presenters/analytics/cycle_analytics/stage_presenter.rb index 7b295b814bc..d023b0c5d55 100644 --- a/app/presenters/analytics/cycle_analytics/stage_presenter.rb +++ b/app/presenters/analytics/cycle_analytics/stage_presenter.rb @@ -28,7 +28,7 @@ module Analytics description: _('Time before an issue gets scheduled') }, plan: { - title: s_('CycleAnalyticsStage|Plan'), + title: s_('CycleAnalyticsStage|Plan'), description: _('Time before an issue starts implementation') }, code: { diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb index 015dfc16df0..71a05ef2c72 100644 --- a/app/presenters/ci/build_runner_presenter.rb +++ b/app/presenters/ci/build_runner_presenter.rb @@ -33,7 +33,8 @@ module Ci end def runner_variables - variables.sort_and_expand_all(keep_undefined: true).to_runner_variables + stop_expanding_file_vars = ::Feature.enabled?(:ci_stop_expanding_file_vars_for_runners, project) + variables.sort_and_expand_all(keep_undefined: true, expand_file_vars: !stop_expanding_file_vars).to_runner_variables end def refspecs diff --git a/app/presenters/merge_request_presenter.rb b/app/presenters/merge_request_presenter.rb index efab1e84923..417a2f9c51f 100644 --- a/app/presenters/merge_request_presenter.rb +++ b/app/presenters/merge_request_presenter.rb @@ -191,18 +191,7 @@ class MergeRequestPresenter < Gitlab::View::Presenter::Delegated end def mergeable_discussions_state - if Feature.enabled?(:change_response_code_merge_status, project) - merge_request.mergeable_discussions_state? - else - # This avoids calling MergeRequest#mergeable_discussions_state without - # considering the state of the MR first. If a MR isn't mergeable, we can - # safely short-circuit it. - if merge_request.mergeable_state?(skip_ci_check: true, skip_discussions_check: true) - merge_request.mergeable_discussions_state? - else - false - end - end + merge_request.mergeable_discussions_state? end delegator_override :subscribed? diff --git a/app/presenters/project_hook_presenter.rb b/app/presenters/project_hook_presenter.rb index a696e9fd0ec..76a3a187924 100644 --- a/app/presenters/project_hook_presenter.rb +++ b/app/presenters/project_hook_presenter.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ProjectHookPresenter < Gitlab::View::Presenter::Delegated - presents ::ProjectHook, as: :project_hook + presents ::ProjectHook def logs_details_path(log) project_hook_hook_log_path(project, self, log) diff --git a/app/presenters/project_member_presenter.rb b/app/presenters/project_member_presenter.rb index 91d3ae96877..da24972775a 100644 --- a/app/presenters/project_member_presenter.rb +++ b/app/presenters/project_member_presenter.rb @@ -3,6 +3,24 @@ class ProjectMemberPresenter < MemberPresenter presents ::ProjectMember + def access_level_roles + ProjectMember.permissible_access_level_roles(current_user, source) + end + + def can_remove? + # If this user is attempting to manage an Owner member and doesn't have permission, do not allow + return can_manage_owners? if member.owner? + + super + end + + def can_update? + # If this user is attempting to manage an Owner member and doesn't have permission, do not allow + return can_manage_owners? if member.owner? + + super + end + private def admin_member_permission @@ -16,6 +34,10 @@ class ProjectMemberPresenter < MemberPresenter def destroy_member_permission :destroy_project_member end + + def can_manage_owners? + can?(current_user, :manage_owners, source) + end end ProjectMemberPresenter.prepend_mod_with('ProjectMemberPresenter') diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb index 84aec19cba0..209f016dc6b 100644 --- a/app/presenters/project_presenter.rb +++ b/app/presenters/project_presenter.rb @@ -437,9 +437,9 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated project_new_blob_path( project, default_branch_or_main, - file_name: file_name, + file_name: file_name, commit_message: commit_message, - branch_name: branch_name, + branch_name: branch_name, **additional_params ) end diff --git a/app/presenters/service_hook_presenter.rb b/app/presenters/service_hook_presenter.rb index b34679c85cf..7ec3d7c5b5c 100644 --- a/app/presenters/service_hook_presenter.rb +++ b/app/presenters/service_hook_presenter.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ServiceHookPresenter < Gitlab::View::Presenter::Delegated - presents ::ServiceHook, as: :service_hook + presents ::ServiceHook def logs_details_path(log) project_settings_integration_hook_log_path(integration.project, integration, log) diff --git a/app/presenters/web_hook_log_presenter.rb b/app/presenters/web_hook_log_presenter.rb index a5166589073..30941076913 100644 --- a/app/presenters/web_hook_log_presenter.rb +++ b/app/presenters/web_hook_log_presenter.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class WebHookLogPresenter < Gitlab::View::Presenter::Delegated - presents ::WebHookLog, as: :web_hook_log + presents ::WebHookLog def details_path web_hook.present.logs_details_path(self) |