Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/ci/pipeline_editor_controller.rb2
-rw-r--r--app/controllers/projects/commits_controller.rb2
-rw-r--r--app/controllers/projects/compare_controller.rb19
-rw-r--r--app/controllers/projects/environments/prometheus_api_controller.rb1
-rw-r--r--app/controllers/projects/environments/sample_metrics_controller.rb1
-rw-r--r--app/controllers/projects/environments_controller.rb6
-rw-r--r--app/controllers/projects/error_tracking/base_controller.rb1
-rw-r--r--app/controllers/projects/error_tracking/projects_controller.rb1
-rw-r--r--app/controllers/projects/google_cloud/base_controller.rb1
-rw-r--r--app/controllers/projects/grafana_api_controller.rb1
-rw-r--r--app/controllers/projects/incidents_controller.rb1
-rw-r--r--app/controllers/projects/issues_controller.rb26
-rw-r--r--app/controllers/projects/jobs_controller.rb4
-rw-r--r--app/controllers/projects/logs_controller.rb1
-rw-r--r--app/controllers/projects/mattermosts_controller.rb2
-rw-r--r--app/controllers/projects/merge_requests/drafts_controller.rb13
-rw-r--r--app/controllers/projects/merge_requests_controller.rb10
-rw-r--r--app/controllers/projects/metrics/dashboards/builder_controller.rb1
-rw-r--r--app/controllers/projects/metrics_dashboard_controller.rb1
-rw-r--r--app/controllers/projects/performance_monitoring/dashboards_controller.rb1
-rw-r--r--app/controllers/projects/pipeline_schedules_controller.rb2
-rw-r--r--app/controllers/projects/pipelines/tests_controller.rb4
-rw-r--r--app/controllers/projects/pipelines_controller.rb22
-rw-r--r--app/controllers/projects/prometheus/alerts_controller.rb10
-rw-r--r--app/controllers/projects/prometheus/metrics_controller.rb7
-rw-r--r--app/controllers/projects/releases_controller.rb18
-rw-r--r--app/controllers/projects/service_hook_logs_controller.rb23
-rw-r--r--app/controllers/projects/services_controller.rb122
-rw-r--r--app/controllers/projects/settings/branch_rules_controller.rb15
-rw-r--r--app/controllers/projects/settings/ci_cd_controller.rb10
-rw-r--r--app/controllers/projects/settings/integration_hook_logs_controller.rb27
-rw-r--r--app/controllers/projects/settings/integrations_controller.rb130
-rw-r--r--app/controllers/projects/settings/packages_and_registries_controller.rb7
-rw-r--r--app/controllers/projects/settings/repository_controller.rb1
-rw-r--r--app/controllers/projects/static_site_editor_controller.rb51
-rw-r--r--app/controllers/projects/tags_controller.rb9
-rw-r--r--app/controllers/projects/tracings_controller.rb1
-rw-r--r--app/controllers/projects/usage_quotas_controller.rb1
-rw-r--r--app/controllers/projects/work_items_controller.rb2
39 files changed, 265 insertions, 292 deletions
diff --git a/app/controllers/projects/ci/pipeline_editor_controller.rb b/app/controllers/projects/ci/pipeline_editor_controller.rb
index dbf3b2051fb..85e258b62e8 100644
--- a/app/controllers/projects/ci/pipeline_editor_controller.rb
+++ b/app/controllers/projects/ci/pipeline_editor_controller.rb
@@ -4,7 +4,7 @@ class Projects::Ci::PipelineEditorController < Projects::ApplicationController
before_action :check_can_collaborate!
before_action do
push_frontend_feature_flag(:schema_linting, @project)
- push_frontend_feature_flag(:pipeline_editor_file_tree, @project)
+ push_frontend_feature_flag(:simulate_pipeline, @project)
end
feature_category :pipeline_authoring
diff --git a/app/controllers/projects/commits_controller.rb b/app/controllers/projects/commits_controller.rb
index 60b8e45f5be..f4125fd0a15 100644
--- a/app/controllers/projects/commits_controller.rb
+++ b/app/controllers/projects/commits_controller.rb
@@ -84,7 +84,7 @@ class Projects::CommitsController < Projects::ApplicationController
@commits.each(&:lazy_author) # preload authors
- @commits = @commits.with_latest_pipeline(@ref)
+ @commits = @commits.with_markdown_cache.with_latest_pipeline(@ref)
@commits = set_commits_for_rendering(@commits)
end
diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb
index 3ced5f21b24..09a06aaed8c 100644
--- a/app/controllers/projects/compare_controller.rb
+++ b/app/controllers/projects/compare_controller.rb
@@ -102,7 +102,11 @@ class Projects::CompareController < Projects::ApplicationController
# source == head_ref == to
def source_project
- project
+ strong_memoize(:source_project) do
+ # Eager load project's avatar url to prevent batch loading
+ # for all forked projects
+ project&.tap(&:avatar_url)
+ end
end
def compare
@@ -112,17 +116,24 @@ class Projects::CompareController < Projects::ApplicationController
end
def start_ref
- @start_ref ||= Addressable::URI.unescape(compare_params[:from])
+ @start_ref ||= Addressable::URI.unescape(compare_params[:from]).presence
end
def head_ref
return @ref if defined?(@ref)
- @ref = @head_ref = Addressable::URI.unescape(compare_params[:to])
+ @ref = @head_ref = Addressable::URI.unescape(compare_params[:to]).presence
end
def define_commits
- @commits = compare.present? ? set_commits_for_rendering(@compare.commits) : []
+ strong_memoize(:commits) do
+ if compare.present?
+ commits = compare.commits.with_markdown_cache.with_latest_pipeline(head_ref)
+ set_commits_for_rendering(commits)
+ else
+ []
+ end
+ end
end
def define_diffs
diff --git a/app/controllers/projects/environments/prometheus_api_controller.rb b/app/controllers/projects/environments/prometheus_api_controller.rb
index 94fe67b5e85..cbb16d596a0 100644
--- a/app/controllers/projects/environments/prometheus_api_controller.rb
+++ b/app/controllers/projects/environments/prometheus_api_controller.rb
@@ -6,6 +6,7 @@ class Projects::Environments::PrometheusApiController < Projects::ApplicationCon
before_action :proxyable
feature_category :metrics
+ urgency :low
private
diff --git a/app/controllers/projects/environments/sample_metrics_controller.rb b/app/controllers/projects/environments/sample_metrics_controller.rb
index 3df20810cb3..80344c83ab7 100644
--- a/app/controllers/projects/environments/sample_metrics_controller.rb
+++ b/app/controllers/projects/environments/sample_metrics_controller.rb
@@ -2,6 +2,7 @@
class Projects::Environments::SampleMetricsController < Projects::ApplicationController
feature_category :metrics
+ urgency :low
def query
result = Metrics::SampleMetricsService.new(params[:identifier], range_start: params[:start], range_end: params[:end]).query
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index 1a2c0d64d19..ac3c85f3b40 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -207,7 +207,11 @@ class Projects::EnvironmentsController < Projects::ApplicationController
private
def deployments
- environment.deployments.ordered.page(params[:page])
+ environment
+ .deployments
+ .with_environment_page_associations
+ .ordered
+ .page(params[:page])
end
def verify_api_request!
diff --git a/app/controllers/projects/error_tracking/base_controller.rb b/app/controllers/projects/error_tracking/base_controller.rb
index ffbe487d8a1..62b8b9f3c1a 100644
--- a/app/controllers/projects/error_tracking/base_controller.rb
+++ b/app/controllers/projects/error_tracking/base_controller.rb
@@ -4,6 +4,7 @@ class Projects::ErrorTracking::BaseController < Projects::ApplicationController
POLLING_INTERVAL = 1_000
feature_category :error_tracking
+ urgency :low
def set_polling_interval
Gitlab::PollingInterval.set_header(response, interval: POLLING_INTERVAL)
diff --git a/app/controllers/projects/error_tracking/projects_controller.rb b/app/controllers/projects/error_tracking/projects_controller.rb
index d59cbc25d25..531bd327e43 100644
--- a/app/controllers/projects/error_tracking/projects_controller.rb
+++ b/app/controllers/projects/error_tracking/projects_controller.rb
@@ -8,6 +8,7 @@ module Projects
before_action :authorize_read_sentry_issue!
feature_category :error_tracking
+ urgency :low
def index
service = ::ErrorTracking::ListProjectsService.new(
diff --git a/app/controllers/projects/google_cloud/base_controller.rb b/app/controllers/projects/google_cloud/base_controller.rb
index 0d65431d870..980e9bdcdad 100644
--- a/app/controllers/projects/google_cloud/base_controller.rb
+++ b/app/controllers/projects/google_cloud/base_controller.rb
@@ -2,6 +2,7 @@
class Projects::GoogleCloud::BaseController < Projects::ApplicationController
feature_category :five_minute_production_app
+ urgency :low
before_action :admin_project_google_cloud!
before_action :google_oauth2_enabled!
diff --git a/app/controllers/projects/grafana_api_controller.rb b/app/controllers/projects/grafana_api_controller.rb
index 9c5d6c8ebc3..d5099367873 100644
--- a/app/controllers/projects/grafana_api_controller.rb
+++ b/app/controllers/projects/grafana_api_controller.rb
@@ -5,6 +5,7 @@ class Projects::GrafanaApiController < Projects::ApplicationController
include MetricsDashboard
feature_category :metrics
+ urgency :low
def proxy
result = ::Grafana::ProxyService.new(
diff --git a/app/controllers/projects/incidents_controller.rb b/app/controllers/projects/incidents_controller.rb
index fd7ba7b5460..70eab792b40 100644
--- a/app/controllers/projects/incidents_controller.rb
+++ b/app/controllers/projects/incidents_controller.rb
@@ -7,7 +7,6 @@ class Projects::IncidentsController < Projects::ApplicationController
before_action :authorize_read_issue!
before_action :load_incident, only: [:show]
before_action do
- push_frontend_feature_flag(:incident_escalations, @project)
push_frontend_feature_flag(:incident_timeline, @project)
end
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index b65616fdb3c..f974b16468c 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -20,10 +20,12 @@ class Projects::IssuesController < Projects::ApplicationController
before_action :disable_query_limiting, only: [:create_merge_request, :move, :bulk_update]
before_action :check_issues_available!
before_action :issue, unless: ->(c) { ISSUES_EXCEPT_ACTIONS.include?(c.action_name.to_sym) }
+ before_action :redirect_if_task, unless: ->(c) { ISSUES_EXCEPT_ACTIONS.include?(c.action_name.to_sym) }
+
after_action :log_issue_show, unless: ->(c) { ISSUES_EXCEPT_ACTIONS.include?(c.action_name.to_sym) }
before_action :set_issuables_index, if: ->(c) {
- SET_ISSUABLES_INDEX_ONLY_ACTIONS.include?(c.action_name.to_sym) && !vue_issues_list?
+ SET_ISSUABLES_INDEX_ONLY_ACTIONS.include?(c.action_name.to_sym) && !index_html_request?
}
# Allow write(create) issue
@@ -39,7 +41,6 @@ class Projects::IssuesController < Projects::ApplicationController
before_action :authorize_download_code!, only: [:related_branches]
before_action do
- push_frontend_feature_flag(:vue_issues_list, project&.group)
push_frontend_feature_flag(:contacts_autocomplete, project&.group)
push_frontend_feature_flag(:incident_timeline, project)
end
@@ -50,6 +51,8 @@ class Projects::IssuesController < Projects::ApplicationController
push_frontend_feature_flag(:paginated_issue_discussions, project)
push_frontend_feature_flag(:realtime_labels, project)
push_force_frontend_feature_flag(:work_items, project&.work_items_feature_flag_enabled?)
+ push_frontend_feature_flag(:work_items_mvc_2)
+ push_frontend_feature_flag(:work_items_hierarchy, project)
end
around_action :allow_gitaly_ref_name_caching, only: [:discussions]
@@ -81,7 +84,7 @@ class Projects::IssuesController < Projects::ApplicationController
attr_accessor :vulnerability_id
def index
- if vue_issues_list?
+ if index_html_request?
set_sort_order
else
@issues = @issuables
@@ -251,16 +254,14 @@ class Projects::IssuesController < Projects::ApplicationController
end
def service_desk
- @issues = @issuables # rubocop:disable Gitlab/ModuleWithInstanceVariables
- @users.push(User.support_bot) # rubocop:disable Gitlab/ModuleWithInstanceVariables
+ @issues = @issuables
+ @users.push(User.support_bot)
end
protected
- def vue_issues_list?
- action_name.to_sym == :index &&
- html_request? &&
- Feature.enabled?(:vue_issues_list, project&.group)
+ def index_html_request?
+ action_name.to_sym == :index && html_request?
end
def sorting_field
@@ -403,6 +404,13 @@ class Projects::IssuesController < Projects::ApplicationController
# Overridden in EE
def create_vulnerability_issue_feedback(issue); end
+
+ def redirect_if_task
+ return render_404 if issue.task? && !project.work_items_feature_flag_enabled?
+ return unless issue.task?
+
+ redirect_to project_work_items_path(project, issue.id, params: request.query_parameters)
+ end
end
Projects::IssuesController.prepend_mod_with('Projects::IssuesController')
diff --git a/app/controllers/projects/jobs_controller.rb b/app/controllers/projects/jobs_controller.rb
index 8c9f82b9dc1..9574c5d5849 100644
--- a/app/controllers/projects/jobs_controller.rb
+++ b/app/controllers/projects/jobs_controller.rb
@@ -3,6 +3,7 @@
class Projects::JobsController < Projects::ApplicationController
include SendFileUpload
include ContinueParams
+ include ProjectStatsRefreshConflictsGuard
urgency :low, [:index, :show, :trace, :retry, :play, :cancel, :unschedule, :status, :erase, :raw]
@@ -19,6 +20,7 @@ class Projects::JobsController < Projects::ApplicationController
before_action :verify_proxy_request!, only: :proxy_websocket_authorize
before_action :push_jobs_table_vue, only: [:index]
before_action :push_jobs_table_vue_search, only: [:index]
+ before_action :reject_if_build_artifacts_size_refreshing!, only: [:erase]
before_action do
push_frontend_feature_flag(:infinitely_collapsible_sections, @project)
@@ -40,7 +42,6 @@ class Projects::JobsController < Projects::ApplicationController
@builds = @builds.page(params[:page]).per(30).without_count
end
- # rubocop: disable CodeReuse/ActiveRecord
def show
respond_to do |format|
format.html
@@ -53,7 +54,6 @@ class Projects::JobsController < Projects::ApplicationController
end
end
end
- # rubocop: enable CodeReuse/ActiveRecord
def trace
@build.trace.being_watched! if @build.running?
diff --git a/app/controllers/projects/logs_controller.rb b/app/controllers/projects/logs_controller.rb
index 63d8981ef38..0f751db2064 100644
--- a/app/controllers/projects/logs_controller.rb
+++ b/app/controllers/projects/logs_controller.rb
@@ -8,6 +8,7 @@ module Projects
before_action :ensure_deployments, only: %i(k8s elasticsearch)
feature_category :logging
+ urgency :low
def index
return render_404 unless Feature.enabled?(:monitor_logging, project)
diff --git a/app/controllers/projects/mattermosts_controller.rb b/app/controllers/projects/mattermosts_controller.rb
index c4f4913a620..a4091ebdf4b 100644
--- a/app/controllers/projects/mattermosts_controller.rb
+++ b/app/controllers/projects/mattermosts_controller.rb
@@ -20,7 +20,7 @@ class Projects::MattermostsController < Projects::ApplicationController
if result
flash[:notice] = 'This service is now configured'
- redirect_to edit_project_integration_path(@project, integration)
+ redirect_to edit_project_settings_integration_path(@project, integration)
else
flash[:alert] = message || 'Failed to configure service'
redirect_to new_project_mattermost_path(@project)
diff --git a/app/controllers/projects/merge_requests/drafts_controller.rb b/app/controllers/projects/merge_requests/drafts_controller.rb
index 686d2c1dc1f..db7557674b2 100644
--- a/app/controllers/projects/merge_requests/drafts_controller.rb
+++ b/app/controllers/projects/merge_requests/drafts_controller.rb
@@ -49,6 +49,10 @@ class Projects::MergeRequests::DraftsController < Projects::MergeRequests::Appli
def publish
result = DraftNotes::PublishService.new(merge_request, current_user).execute(draft_note(allow_nil: true))
+ if Feature.enabled?(:mr_review_submit_comment, @project) && create_note_params[:note]
+ Notes::CreateService.new(@project, current_user, create_note_params).execute
+ end
+
if result[:status] == :success
head :ok
else
@@ -102,6 +106,15 @@ class Projects::MergeRequests::DraftsController < Projects::MergeRequests::Appli
end
end
+ def create_note_params
+ params.permit(
+ :note
+ ).tap do |create_params|
+ create_params[:noteable_type] = merge_request.class.name
+ create_params[:noteable_id] = merge_request.id
+ end
+ end
+
def prepare_notes_for_rendering(notes)
return [] unless notes
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 458df40ece1..d420e136316 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -35,19 +35,19 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag(:file_identifier_hash)
push_frontend_feature_flag(:merge_request_widget_graphql, project)
push_frontend_feature_flag(:core_security_mr_widget_counts, project)
- push_frontend_feature_flag(:paginated_notes, project)
push_frontend_feature_flag(:confidential_notes, project)
push_frontend_feature_flag(:restructured_mr_widget, project)
push_frontend_feature_flag(:refactor_mr_widgets_extensions, project)
+ push_frontend_feature_flag(:refactor_code_quality_extension, project)
push_frontend_feature_flag(:refactor_mr_widget_test_summary, project)
push_frontend_feature_flag(:rebase_without_ci_ui, project)
push_frontend_feature_flag(:issue_assignees_widget, @project)
push_frontend_feature_flag(:realtime_labels, project)
- push_frontend_feature_flag(:updated_diff_expansion_buttons, project)
+ push_frontend_feature_flag(:refactor_security_extension, @project)
push_frontend_feature_flag(:mr_attention_requests, current_user)
- push_frontend_feature_flag(:updated_mr_header, project)
- push_frontend_feature_flag(:remove_diff_header_icons, project)
push_frontend_feature_flag(:moved_mr_sidebar, project)
+ push_frontend_feature_flag(:paginated_mr_discussions, project)
+ push_frontend_feature_flag(:mr_review_submit_comment, project)
end
before_action do
@@ -299,7 +299,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
def remove_wip
@merge_request = ::MergeRequests::UpdateService
- .new(project: project, current_user: current_user, params: { wip_event: 'unwip' })
+ .new(project: project, current_user: current_user, params: { wip_event: 'ready' })
.execute(@merge_request)
render json: serialize_widget(@merge_request)
diff --git a/app/controllers/projects/metrics/dashboards/builder_controller.rb b/app/controllers/projects/metrics/dashboards/builder_controller.rb
index 96ca6d89111..a6b57798923 100644
--- a/app/controllers/projects/metrics/dashboards/builder_controller.rb
+++ b/app/controllers/projects/metrics/dashboards/builder_controller.rb
@@ -7,6 +7,7 @@ module Projects
before_action :authorize_metrics_dashboard!
feature_category :metrics
+ urgency :low
def panel_preview
respond_to do |format|
diff --git a/app/controllers/projects/metrics_dashboard_controller.rb b/app/controllers/projects/metrics_dashboard_controller.rb
index e305b018293..f2f276071a0 100644
--- a/app/controllers/projects/metrics_dashboard_controller.rb
+++ b/app/controllers/projects/metrics_dashboard_controller.rb
@@ -16,6 +16,7 @@ module Projects
end
feature_category :metrics
+ urgency :low
def show
if environment
diff --git a/app/controllers/projects/performance_monitoring/dashboards_controller.rb b/app/controllers/projects/performance_monitoring/dashboards_controller.rb
index 51a07c1b7a5..8acbc17aef3 100644
--- a/app/controllers/projects/performance_monitoring/dashboards_controller.rb
+++ b/app/controllers/projects/performance_monitoring/dashboards_controller.rb
@@ -13,6 +13,7 @@ module Projects
end
feature_category :metrics
+ urgency :low
def create
result = ::Metrics::Dashboard::CloneDashboardService.new(project, current_user, dashboard_params).execute
diff --git a/app/controllers/projects/pipeline_schedules_controller.rb b/app/controllers/projects/pipeline_schedules_controller.rb
index fa38fb209f0..a23d7fb3e6b 100644
--- a/app/controllers/projects/pipeline_schedules_controller.rb
+++ b/app/controllers/projects/pipeline_schedules_controller.rb
@@ -14,13 +14,11 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
feature_category :continuous_integration
urgency :low
- # rubocop: disable CodeReuse/ActiveRecord
def index
@scope = params[:scope]
@all_schedules = Ci::PipelineSchedulesFinder.new(@project).execute
@schedules = Ci::PipelineSchedulesFinder.new(@project).execute(scope: params[:scope])
end
- # rubocop: enable CodeReuse/ActiveRecord
def new
@schedule = project.pipeline_schedules.new
diff --git a/app/controllers/projects/pipelines/tests_controller.rb b/app/controllers/projects/pipelines/tests_controller.rb
index 8f0e20290fe..e5b2dd14f69 100644
--- a/app/controllers/projects/pipelines/tests_controller.rb
+++ b/app/controllers/projects/pipelines/tests_controller.rb
@@ -23,7 +23,7 @@ module Projects
def show
respond_to do |format|
format.json do
- if Feature.enabled?(:ci_test_report_artifacts_expired, project) && pipeline.has_expired_test_reports?
+ if pipeline.has_expired_test_reports?
render json: { errors: 'Test report artifacts have expired' }, status: :not_found
else
render json: TestSuiteSerializer
@@ -36,7 +36,6 @@ module Projects
private
- # rubocop: disable CodeReuse/ActiveRecord
def builds
@builds ||= pipeline.latest_builds.id_in(build_ids).presence || render_404
end
@@ -56,7 +55,6 @@ module Projects
suite
end
- # rubocop: enable CodeReuse/ActiveRecord
end
end
end
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb
index 94865024688..adc3a912a91 100644
--- a/app/controllers/projects/pipelines_controller.rb
+++ b/app/controllers/projects/pipelines_controller.rb
@@ -3,6 +3,8 @@
class Projects::PipelinesController < Projects::ApplicationController
include ::Gitlab::Utils::StrongMemoize
include RedisTracking
+ include ProjectStatsRefreshConflictsGuard
+ include ZuoraCSP
urgency :low, [
:index, :new, :builds, :show, :failures, :create,
@@ -19,11 +21,10 @@ class Projects::PipelinesController < Projects::ApplicationController
before_action :authorize_create_pipeline!, only: [:new, :create, :config_variables]
before_action :authorize_update_pipeline!, only: [:retry, :cancel]
before_action :ensure_pipeline, only: [:show, :downloadable_artifacts]
+ before_action :reject_if_build_artifacts_size_refreshing!, only: [:destroy]
before_action do
push_frontend_feature_flag(:pipeline_tabs_vue, @project)
- push_frontend_feature_flag(:downstream_retry_action, @project)
- push_frontend_feature_flag(:failed_jobs_tab_vue, @project)
end
# Will be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/225596
@@ -42,23 +43,6 @@ class Projects::PipelinesController < Projects::ApplicationController
POLLING_INTERVAL = 10_000
- content_security_policy do |policy|
- next if policy.directives.blank?
-
- default_script_src = policy.directives['script-src'] || policy.directives['default-src']
- script_src_values = Array.wrap(default_script_src) | ["'self'", "'unsafe-eval'", 'https://*.zuora.com']
-
- default_frame_src = policy.directives['frame-src'] || policy.directives['default-src']
- frame_src_values = Array.wrap(default_frame_src) | ["'self'", 'https://*.zuora.com']
-
- default_child_src = policy.directives['child-src'] || policy.directives['default-src']
- child_src_values = Array.wrap(default_child_src) | ["'self'", 'https://*.zuora.com']
-
- policy.script_src(*script_src_values)
- policy.frame_src(*frame_src_values)
- policy.child_src(*child_src_values)
- end
-
feature_category :continuous_integration, [
:charts, :show, :config_variables, :stage, :cancel, :retry,
:builds, :dag, :failures, :status,
diff --git a/app/controllers/projects/prometheus/alerts_controller.rb b/app/controllers/projects/prometheus/alerts_controller.rb
index 5e1b9570fa0..c3dc17694d9 100644
--- a/app/controllers/projects/prometheus/alerts_controller.rb
+++ b/app/controllers/projects/prometheus/alerts_controller.rb
@@ -14,19 +14,11 @@ module Projects
prepend_before_action :repository, :project_without_auth, only: [:notify]
before_action :authorize_read_prometheus_alerts!, except: [:notify]
- before_action :alert, only: [:show, :metrics_dashboard]
+ before_action :alert, only: [:metrics_dashboard]
feature_category :incident_management
urgency :low
- def index
- render json: serialize_as_json(alerts)
- end
-
- def show
- render json: serialize_as_json(alert)
- end
-
def notify
token = extract_alert_manager_token(request)
result = notify_service.execute(token)
diff --git a/app/controllers/projects/prometheus/metrics_controller.rb b/app/controllers/projects/prometheus/metrics_controller.rb
index c5778ba15f2..db5471ea322 100644
--- a/app/controllers/projects/prometheus/metrics_controller.rb
+++ b/app/controllers/projects/prometheus/metrics_controller.rb
@@ -7,6 +7,7 @@ module Projects
before_action :require_prometheus_metrics!
feature_category :metrics
+ urgency :low
def active_common
respond_to do |format|
@@ -66,7 +67,7 @@ module Projects
)
if @metric.persisted?
- redirect_to edit_project_integration_path(project, ::Integrations::Prometheus),
+ redirect_to edit_project_settings_integration_path(project, ::Integrations::Prometheus),
notice: _('Metric was successfully added.')
else
render 'new'
@@ -77,7 +78,7 @@ module Projects
@metric = prometheus_metric
if @metric.update(metrics_params)
- redirect_to edit_project_integration_path(project, ::Integrations::Prometheus),
+ redirect_to edit_project_settings_integration_path(project, ::Integrations::Prometheus),
notice: _('Metric was successfully updated.')
else
render 'edit'
@@ -93,7 +94,7 @@ module Projects
respond_to do |format|
format.html do
- redirect_to edit_project_integration_path(project, ::Integrations::Prometheus), status: :see_other
+ redirect_to edit_project_settings_integration_path(project, ::Integrations::Prometheus), status: :see_other
end
format.json do
head :ok
diff --git a/app/controllers/projects/releases_controller.rb b/app/controllers/projects/releases_controller.rb
index 1dfb71842bd..da414d068a6 100644
--- a/app/controllers/projects/releases_controller.rb
+++ b/app/controllers/projects/releases_controller.rb
@@ -18,11 +18,7 @@ class Projects::ReleasesController < Projects::ApplicationController
require_non_empty_project
end
format.json do
- if Feature.enabled?(:remove_sha_from_releases_json, project)
- render json: ReleaseSerializer.new.represent(releases)
- else
- render json: releases
- end
+ render json: ReleaseSerializer.new.represent(releases)
end
end
end
@@ -56,19 +52,11 @@ class Projects::ReleasesController < Projects::ApplicationController
end
def release
- @release ||= project.releases.find_by_tag!(sanitized_tag_name)
+ @release ||= project.releases.find_by_tag!(params[:tag])
end
def link
- release.links.find_by_filepath!(sanitized_filepath)
- end
-
- def sanitized_filepath
- "/#{CGI.unescape(params[:filepath])}"
- end
-
- def sanitized_tag_name
- CGI.unescape(params[:tag])
+ release.links.find_by_filepath!("/#{params[:filepath]}")
end
# Default order_by is 'released_at', which is set in ReleasesFinder.
diff --git a/app/controllers/projects/service_hook_logs_controller.rb b/app/controllers/projects/service_hook_logs_controller.rb
deleted file mode 100644
index 7b037c60321..00000000000
--- a/app/controllers/projects/service_hook_logs_controller.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# frozen_string_literal: true
-
-class Projects::ServiceHookLogsController < Projects::HookLogsController
- extend Gitlab::Utils::Override
-
- before_action :integration, only: [:show, :retry]
-
- def retry
- execute_hook
- redirect_to edit_project_integration_path(@project, @integration)
- end
-
- private
-
- def integration
- @integration ||= @project.find_or_initialize_integration(params[:integration_id])
- end
-
- override :hook
- def hook
- @hook ||= integration.service_hook || not_found
- end
-end
diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb
deleted file mode 100644
index 8f83e34411b..00000000000
--- a/app/controllers/projects/services_controller.rb
+++ /dev/null
@@ -1,122 +0,0 @@
-# frozen_string_literal: true
-
-class Projects::ServicesController < Projects::ApplicationController
- include Integrations::Params
- include InternalRedirect
-
- # Authorize
- before_action :authorize_admin_project!
- before_action :ensure_service_enabled
- before_action :integration
- before_action :default_integration, only: [:edit, :update]
- before_action :web_hook_logs, only: [:edit, :update]
-
- respond_to :html
-
- layout "project_settings"
-
- feature_category :integrations
- urgency :low, [:test]
-
- def edit
- end
-
- def update
- attributes = integration_params[:integration]
-
- if use_inherited_settings?(attributes)
- integration.inherit_from_id = default_integration.id
-
- if saved = integration.save(context: :manual_change)
- BulkUpdateIntegrationService.new(default_integration, [integration]).execute
- end
- else
- attributes[:inherit_from_id] = nil
- integration.attributes = attributes
- saved = integration.save(context: :manual_change)
- end
-
- respond_to do |format|
- format.html do
- if saved
- redirect_to redirect_path, notice: success_message
- else
- render 'edit'
- end
- end
-
- format.json do
- status = saved ? :ok : :unprocessable_entity
-
- render json: serialize_as_json, status: status
- end
- end
- end
-
- def test
- if integration.testable?
- render json: service_test_response, status: :ok
- else
- render json: {}, status: :not_found
- end
- end
-
- private
-
- def redirect_path
- safe_redirect_path(params[:redirect_to]).presence || edit_project_integration_path(project, integration)
- end
-
- def service_test_response
- unless integration.update(integration_params[:integration])
- return { error: true, message: _('Validations failed.'), service_response: integration.errors.full_messages.join(','), test_failed: false }
- end
-
- result = ::Integrations::Test::ProjectService.new(integration, current_user, params[:event]).execute
-
- unless result[:success]
- return { error: true, message: s_('Integrations|Connection failed. Please check your settings.'), service_response: result[:message].to_s, test_failed: true }
- end
-
- result[:data].presence || {}
- rescue *Gitlab::HTTP::HTTP_ERRORS => e
- { error: true, message: s_('Integrations|Connection failed. Please check your settings.'), service_response: e.message, test_failed: true }
- end
-
- def success_message
- if integration.active?
- s_('Integrations|%{integration} settings saved and active.') % { integration: integration.title }
- else
- s_('Integrations|%{integration} settings saved, but not active.') % { integration: integration.title }
- end
- end
-
- def integration
- @integration ||= project.find_or_initialize_integration(params[:id])
- end
- alias_method :service, :integration
-
- def default_integration
- @default_integration ||= Integration.default_integration(integration.type, project)
- end
-
- def web_hook_logs
- return unless integration.service_hook.present?
-
- @web_hook_logs ||= integration.service_hook.web_hook_logs.recent.page(params[:page])
- end
-
- def ensure_service_enabled
- render_404 unless service
- end
-
- def serialize_as_json
- integration
- .as_json(only: integration.json_fields)
- .merge(errors: integration.errors.as_json)
- end
-
- def use_inherited_settings?(attributes)
- default_integration && attributes[:inherit_from_id] == default_integration.id.to_s
- end
-end
diff --git a/app/controllers/projects/settings/branch_rules_controller.rb b/app/controllers/projects/settings/branch_rules_controller.rb
new file mode 100644
index 00000000000..0a415b60124
--- /dev/null
+++ b/app/controllers/projects/settings/branch_rules_controller.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Projects
+ module Settings
+ class BranchRulesController < Projects::ApplicationController
+ before_action :authorize_admin_project!
+
+ feature_category :source_code_management
+
+ def index
+ render_404 unless Feature.enabled?(:branch_rules, project)
+ end
+ end
+ end
+end
diff --git a/app/controllers/projects/settings/ci_cd_controller.rb b/app/controllers/projects/settings/ci_cd_controller.rb
index ee50327be8f..cda6c8abea7 100644
--- a/app/controllers/projects/settings/ci_cd_controller.rb
+++ b/app/controllers/projects/settings/ci_cd_controller.rb
@@ -13,6 +13,7 @@ module Projects
before_action :define_variables
before_action do
push_frontend_feature_flag(:ajax_new_deploy_token, @project)
+ push_frontend_feature_flag(:ci_variable_settings_graphql, @project)
end
helper_method :highlight_badge
@@ -27,14 +28,7 @@ module Projects
).to_json
end
- if current_user.ci_owned_runners_cross_joins_fix_enabled?
- render
- else
- # @assignable_runners is using ci_owned_runners
- ::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/336436') do
- render
- end
- end
+ render
end
def update
diff --git a/app/controllers/projects/settings/integration_hook_logs_controller.rb b/app/controllers/projects/settings/integration_hook_logs_controller.rb
new file mode 100644
index 00000000000..b3b5a292d42
--- /dev/null
+++ b/app/controllers/projects/settings/integration_hook_logs_controller.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+module Projects
+ module Settings
+ class IntegrationHookLogsController < Projects::HookLogsController
+ extend Gitlab::Utils::Override
+
+ before_action :integration, only: [:show, :retry]
+
+ def retry
+ execute_hook
+ redirect_to edit_project_settings_integration_path(@project, @integration)
+ end
+
+ private
+
+ def integration
+ @integration ||= @project.find_or_initialize_integration(params[:integration_id])
+ end
+
+ override :hook
+ def hook
+ @hook ||= integration.service_hook || not_found
+ end
+ end
+ end
+end
diff --git a/app/controllers/projects/settings/integrations_controller.rb b/app/controllers/projects/settings/integrations_controller.rb
index c9d92d1aee9..3365da65de8 100644
--- a/app/controllers/projects/settings/integrations_controller.rb
+++ b/app/controllers/projects/settings/integrations_controller.rb
@@ -3,14 +3,142 @@
module Projects
module Settings
class IntegrationsController < Projects::ApplicationController
+ include ::Integrations::Params
+ include ::InternalRedirect
+
before_action :authorize_admin_project!
+ before_action :ensure_integration_enabled, only: [:edit, :update, :test]
+ before_action :integration, only: [:edit, :update, :test]
+ before_action :default_integration, only: [:edit, :update]
+ before_action :web_hook_logs, only: [:edit, :update]
+
+ respond_to :html
+
layout "project_settings"
feature_category :integrations
+ urgency :low, [:test]
- def show
+ def index
@integrations = @project.find_or_initialize_integrations
end
+
+ def edit
+ end
+
+ def update
+ attributes = integration_params[:integration]
+
+ if use_inherited_settings?(attributes)
+ integration.inherit_from_id = default_integration.id
+
+ if saved = integration.save(context: :manual_change)
+ BulkUpdateIntegrationService.new(default_integration, [integration]).execute
+ end
+ else
+ attributes[:inherit_from_id] = nil
+ integration.attributes = attributes
+ saved = integration.save(context: :manual_change)
+ end
+
+ respond_to do |format|
+ format.html do
+ if saved
+ redirect_to redirect_path, notice: success_message
+ else
+ render 'edit'
+ end
+ end
+
+ format.json do
+ status = saved ? :ok : :unprocessable_entity
+
+ render json: serialize_as_json, status: status
+ end
+ end
+ end
+
+ def test
+ if integration.testable?
+ render json: integration_test_response, status: :ok
+ else
+ render json: {}, status: :not_found
+ end
+ end
+
+ private
+
+ def redirect_path
+ safe_redirect_path(params[:redirect_to]).presence ||
+ edit_project_settings_integration_path(project, integration)
+ end
+
+ def integration_test_response
+ unless integration.update(integration_params[:integration])
+ return {
+ error: true,
+ message: _('Validations failed.'),
+ service_response: integration.errors.full_messages.join(','),
+ test_failed: false
+ }
+ end
+
+ result = ::Integrations::Test::ProjectService.new(integration, current_user, params[:event]).execute
+
+ unless result[:success]
+ return {
+ error: true,
+ message: s_('Integrations|Connection failed. Please check your settings.'),
+ service_response: result[:message].to_s,
+ test_failed: true
+ }
+ end
+
+ result[:data].presence || {}
+ rescue *Gitlab::HTTP::HTTP_ERRORS => e
+ {
+ error: true,
+ message: s_('Integrations|Connection failed. Please check your settings.'),
+ service_response: e.message,
+ test_failed: true
+ }
+ end
+
+ def success_message
+ if integration.active?
+ format(s_('Integrations|%{integration} settings saved and active.'), integration: integration.title)
+ else
+ format(s_('Integrations|%{integration} settings saved, but not active.'), integration: integration.title)
+ end
+ end
+
+ def integration
+ @integration ||= project.find_or_initialize_integration(params[:id])
+ end
+
+ def default_integration
+ @default_integration ||= Integration.default_integration(integration.type, project)
+ end
+
+ def web_hook_logs
+ return unless integration.service_hook.present?
+
+ @web_hook_logs ||= integration.service_hook.web_hook_logs.recent.page(params[:page])
+ end
+
+ def ensure_integration_enabled
+ render_404 unless integration
+ end
+
+ def serialize_as_json
+ integration
+ .as_json(only: integration.json_fields)
+ .merge(errors: integration.errors.as_json)
+ end
+
+ def use_inherited_settings?(attributes)
+ default_integration && attributes[:inherit_from_id] == default_integration.id.to_s
+ end
end
end
end
diff --git a/app/controllers/projects/settings/packages_and_registries_controller.rb b/app/controllers/projects/settings/packages_and_registries_controller.rb
index 0cd2bfa9695..d3c08bef808 100644
--- a/app/controllers/projects/settings/packages_and_registries_controller.rb
+++ b/app/controllers/projects/settings/packages_and_registries_controller.rb
@@ -17,12 +17,7 @@ module Projects
private
def packages_and_registries_settings_enabled!
- render_404 unless can_destroy_container_registry_image?(project)
- end
-
- def can_destroy_container_registry_image?(project)
- Gitlab.config.registry.enabled &&
- can?(current_user, :destroy_container_image, project)
+ render_404 unless can?(current_user, :view_package_registry_project_settings, project)
end
end
end
diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb
index 0fd2d56229a..a178b8f7aa3 100644
--- a/app/controllers/projects/settings/repository_controller.rb
+++ b/app/controllers/projects/settings/repository_controller.rb
@@ -15,6 +15,7 @@ module Projects
urgency :low, [:show, :create_deploy_token]
def show
+ push_frontend_feature_flag(:branch_rules, @project)
render_show
end
diff --git a/app/controllers/projects/static_site_editor_controller.rb b/app/controllers/projects/static_site_editor_controller.rb
deleted file mode 100644
index fed6307514e..00000000000
--- a/app/controllers/projects/static_site_editor_controller.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-# frozen_string_literal: true
-
-class Projects::StaticSiteEditorController < Projects::ApplicationController
- include ExtractsPath
- include CreatesCommit
- include BlobHelper
-
- layout 'fullscreen'
-
- content_security_policy do |policy|
- next if policy.directives.blank?
-
- frame_src_values = Array.wrap(policy.directives['frame-src']) | ['https://www.youtube.com']
- policy.frame_src(*frame_src_values)
- end
-
- prepend_before_action :authenticate_user!, only: [:show]
- before_action :assign_ref_and_path, only: [:show]
- before_action :authorize_edit_tree!, only: [:show]
-
- feature_category :static_site_editor
-
- def index
- render_404
- end
-
- def show
- redirect_to ide_edit_path(project, @ref, @path)
- end
-
- private
-
- def serialize_necessary_payload_values_to_json(payload)
- # This will convert booleans, Array-like and Hash-like objects to JSON
- payload.transform_values do |value|
- if value.is_a?(String) || value.is_a?(Integer)
- value
- elsif value.nil?
- ''
- else
- value.to_json
- end
- end
- end
-
- def assign_ref_and_path
- @ref, @path = extract_ref(params.fetch(:id))
-
- render_404 if @ref.blank? || @path.blank?
- end
-end
diff --git a/app/controllers/projects/tags_controller.rb b/app/controllers/projects/tags_controller.rb
index eb3579551bd..432497850f2 100644
--- a/app/controllers/projects/tags_controller.rb
+++ b/app/controllers/projects/tags_controller.rb
@@ -94,11 +94,10 @@ class Projects::TagsController < Projects::ApplicationController
def destroy
result = ::Tags::DestroyService.new(project, current_user).execute(params[:id])
- if result[:status] == :success
- render json: result
- else
- render json: { message: result[:message] }, status: result[:return_code]
- end
+ flash_type = result[:status] == :error ? :alert : :notice
+ flash[flash_type] = result[:message]
+
+ redirect_to project_tags_path(@project), status: :see_other
end
private
diff --git a/app/controllers/projects/tracings_controller.rb b/app/controllers/projects/tracings_controller.rb
index a4aac6aaa32..b5c1354c4a9 100644
--- a/app/controllers/projects/tracings_controller.rb
+++ b/app/controllers/projects/tracings_controller.rb
@@ -13,6 +13,7 @@ module Projects
before_action :authorize_update_environment!
feature_category :tracing
+ urgency :low
def show
render_404 unless Feature.enabled?(:monitor_tracing, @project)
diff --git a/app/controllers/projects/usage_quotas_controller.rb b/app/controllers/projects/usage_quotas_controller.rb
index f45ee265432..07a3c010f4f 100644
--- a/app/controllers/projects/usage_quotas_controller.rb
+++ b/app/controllers/projects/usage_quotas_controller.rb
@@ -6,6 +6,7 @@ class Projects::UsageQuotasController < Projects::ApplicationController
layout "project_settings"
feature_category :utilization
+ urgency :low
def index
@hide_search_settings = true
diff --git a/app/controllers/projects/work_items_controller.rb b/app/controllers/projects/work_items_controller.rb
index 27857dac2b7..ba23af41bb0 100644
--- a/app/controllers/projects/work_items_controller.rb
+++ b/app/controllers/projects/work_items_controller.rb
@@ -3,6 +3,8 @@
class Projects::WorkItemsController < Projects::ApplicationController
before_action do
push_force_frontend_feature_flag(:work_items, project&.work_items_feature_flag_enabled?)
+ push_frontend_feature_flag(:work_items_mvc_2)
+ push_frontend_feature_flag(:work_items_hierarchy, project)
end
feature_category :team_planning