diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-07 18:08:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-07-07 18:08:16 +0300 |
commit | 048eea4614d24363b9b150f3674600e5964e422a (patch) | |
tree | a348b26577596ecd5e4b1676290f38f848b03bc9 /app | |
parent | 6c42aa7c56f2909f2a4f1f178197cfa7d927ce8d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/runners_controller.rb | 2 | ||||
-rw-r--r-- | app/models/ci/stage.rb | 2 | ||||
-rw-r--r-- | app/models/service_desk_setting.rb | 9 | ||||
-rw-r--r-- | app/presenters/blob_presenter.rb | 21 | ||||
-rw-r--r-- | app/services/import/github_service.rb | 11 |
5 files changed, 30 insertions, 15 deletions
diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index d312dcc3563..b368ba6e495 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -3,7 +3,7 @@ class Admin::RunnersController < Admin::ApplicationController include RunnerSetupScripts - before_action :runner, except: [:index, :new, :tag_list, :runner_setup_scripts] + before_action :runner, only: [:show, :edit, :register, :update] feature_category :runner urgency :low diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb index d61760bd0fc..af0eee97481 100644 --- a/app/models/ci/stage.rb +++ b/app/models/ci/stage.rb @@ -148,7 +148,7 @@ module Ci end def manual_playable? - blocked? || skipped? + blocked? end # This will be removed with ci_remove_ensure_stage_service diff --git a/app/models/service_desk_setting.rb b/app/models/service_desk_setting.rb index 4216ad7e70f..6560b25b39c 100644 --- a/app/models/service_desk_setting.rb +++ b/app/models/service_desk_setting.rb @@ -21,6 +21,7 @@ class ServiceDeskSetting < ApplicationRecord validates :project_id, presence: true validate :valid_issue_template validate :valid_project_key + validate :custom_email_enabled_state validates :outgoing_name, length: { maximum: 255 }, allow_blank: true validates :project_key, length: { maximum: 255 }, @@ -86,6 +87,14 @@ class ServiceDeskSetting < ApplicationRecord end end + def custom_email_enabled_state + return unless custom_email_enabled? + + if custom_email_verification.blank? || !custom_email_verification.finished? + errors.add(:custom_email_enabled, 'cannot be enabled until verification process has finished.') + end + end + private def source_template_project diff --git a/app/presenters/blob_presenter.rb b/app/presenters/blob_presenter.rb index cd473152b41..bc12d210334 100644 --- a/app/presenters/blob_presenter.rb +++ b/app/presenters/blob_presenter.rb @@ -86,7 +86,7 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated end def find_file_path - url_helpers.project_find_file_path(project, blob.commit_id) + url_helpers.project_find_file_path(project, commit_id, ref_type: ref_type) end def blame_path @@ -131,13 +131,13 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated end def can_modify_blob? - super(blob, project, blob.commit_id) + super(blob, project, commit_id) end def can_current_user_push_to_branch? - return false unless current_user && project.repository.branch_exists?(blob.commit_id) + return false unless current_user && project.repository.branch_exists?(commit_id) - user_access(project).can_push_to_branch?(blob.commit_id) + user_access(project).can_push_to_branch?(commit_id) end def archived? @@ -145,7 +145,7 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated end def ide_edit_path - super(project, blob.commit_id, blob.path) + super(project, commit_id, blob.path) end def external_storage_url @@ -159,7 +159,7 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated end def project_blob_path_root - project_blob_path(project, blob.commit_id) + project_blob_path(project, commit_id) end private @@ -181,7 +181,7 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated end def environment - environment_params = project.repository.branch_exists?(blob.commit_id) ? { ref: blob.commit_id } : { sha: blob.commit_id } + environment_params = project.repository.branch_exists?(commit_id) ? { ref: commit_id } : { sha: commit_id } environment_params[:find_latest] = true ::Environments::EnvironmentsByDeploymentsFinder.new(project, current_user, environment_params).execute.last end @@ -190,12 +190,13 @@ class BlobPresenter < Gitlab::View::Presenter::Delegated blob.repository.project end - def ref_qualified_path + def commit_id # If `ref_type` is present the commit_id will include the ref qualifier e.g. `refs/heads/`. # We only accept/return unqualified refs so we need to remove the qualifier from the `commit_id`. + ExtractsRef.unqualify_ref(blob.commit_id, ref_type) + end - commit_id = ExtractsRef.unqualify_ref(blob.commit_id, ref_type) - + def ref_qualified_path File.join(commit_id, blob.path) end diff --git a/app/services/import/github_service.rb b/app/services/import/github_service.rb index 7e7f7ea9810..df255a7ae24 100644 --- a/app/services/import/github_service.rb +++ b/app/services/import/github_service.rb @@ -16,7 +16,7 @@ module Import track_access_level('github') if project.persisted? - store_import_settings(project) + store_import_settings(project, access_params) success(project) elsif project.errors[:import_source_disabled].present? error(project.errors[:import_source_disabled], :forbidden) @@ -134,8 +134,13 @@ module Import error(translated_message, http_status) end - def store_import_settings(project) - Gitlab::GithubImport::Settings.new(project).write(params[:optional_stages]) + def store_import_settings(project, access_params) + Gitlab::GithubImport::Settings + .new(project) + .write( + optional_stages: params[:optional_stages], + additional_access_tokens: access_params[:additional_access_tokens] + ) end end end |