summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /app/controllers
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
downloadgitlab-ce-13.8.0-rc42.tar.gz
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin/application_settings_controller.rb2
-rw-r--r--app/controllers/admin/dev_ops_report_controller.rb8
-rw-r--r--app/controllers/admin/projects_controller.rb4
-rw-r--r--app/controllers/application_controller.rb30
-rw-r--r--app/controllers/concerns/invisible_captcha_on_signup.rb4
-rw-r--r--app/controllers/concerns/issuable_actions.rb1
-rw-r--r--app/controllers/concerns/redis_tracking.rb2
-rw-r--r--app/controllers/concerns/show_inherited_labels_checker.rb11
-rw-r--r--app/controllers/concerns/spammable_actions.rb25
-rw-r--r--app/controllers/dashboard/snippets_controller.rb1
-rw-r--r--app/controllers/explore/projects_controller.rb7
-rw-r--r--app/controllers/groups/group_members_controller.rb4
-rw-r--r--app/controllers/groups/labels_controller.rb3
-rw-r--r--app/controllers/groups/settings/packages_and_registries_controller.rb14
-rw-r--r--app/controllers/import/bulk_imports_controller.rb35
-rw-r--r--app/controllers/jira_connect/app_descriptor_controller.rb41
-rw-r--r--app/controllers/jira_connect/subscriptions_controller.rb3
-rw-r--r--app/controllers/metrics_controller.rb10
-rw-r--r--app/controllers/projects/blob_controller.rb3
-rw-r--r--app/controllers/projects/ci/pipeline_editor_controller.rb2
-rw-r--r--app/controllers/projects/cycle_analytics_controller.rb5
-rw-r--r--app/controllers/projects/environments_controller.rb3
-rw-r--r--app/controllers/projects/feature_flags_controller.rb10
-rw-r--r--app/controllers/projects/incident_management/pager_duty_incidents_controller.rb2
-rw-r--r--app/controllers/projects/labels_controller.rb3
-rw-r--r--app/controllers/projects/mattermosts_controller.rb2
-rw-r--r--app/controllers/projects/merge_requests/creations_controller.rb2
-rw-r--r--app/controllers/projects/merge_requests/diffs_controller.rb16
-rw-r--r--app/controllers/projects/merge_requests_controller.rb14
-rw-r--r--app/controllers/projects/pipeline_schedules_controller.rb1
-rw-r--r--app/controllers/projects/pipelines/tests_controller.rb2
-rw-r--r--app/controllers/projects/pipelines_controller.rb39
-rw-r--r--app/controllers/projects/project_members_controller.rb13
-rw-r--r--app/controllers/projects/usage_ping_controller.rb2
-rw-r--r--app/controllers/projects_controller.rb6
-rw-r--r--app/controllers/repositories/lfs_api_controller.rb11
-rw-r--r--app/controllers/users_controller.rb6
37 files changed, 223 insertions, 124 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index 56ec10fa43a..179e6ef60fb 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -31,7 +31,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
feature_category :source_code_management, [:repository, :clear_repository_check_states]
feature_category :continuous_integration, [:ci_cd, :reset_registration_token]
- feature_category :collection, [:usage_data]
+ feature_category :usage_ping, [:usage_data]
feature_category :integrations, [:integrations]
feature_category :pages, [:lets_encrypt_terms_of_service]
diff --git a/app/controllers/admin/dev_ops_report_controller.rb b/app/controllers/admin/dev_ops_report_controller.rb
index 59b2200fb59..4ebc643be33 100644
--- a/app/controllers/admin/dev_ops_report_controller.rb
+++ b/app/controllers/admin/dev_ops_report_controller.rb
@@ -3,6 +3,8 @@
class Admin::DevOpsReportController < Admin::ApplicationController
include Analytics::UniqueVisitsHelper
+ helper_method :show_adoption?
+
track_unique_visits :show, target_id: 'i_analytics_dev_ops_score'
feature_category :devops_reports
@@ -12,4 +14,10 @@ class Admin::DevOpsReportController < Admin::ApplicationController
@metric = DevOpsReport::Metric.order(:created_at).last&.present
end
# rubocop: enable CodeReuse/ActiveRecord
+
+ def show_adoption?
+ false
+ end
end
+
+Admin::DevOpsReportController.prepend_if_ee('EE::Admin::DevOpsReportController')
diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb
index c4564478462..39718793c1d 100644
--- a/app/controllers/admin/projects_controller.rb
+++ b/app/controllers/admin/projects_controller.rb
@@ -57,6 +57,10 @@ class Admin::ProjectsController < Admin::ApplicationController
namespace = Namespace.find_by(id: params[:new_namespace_id])
::Projects::TransferService.new(@project, current_user, params.dup).execute(namespace)
+ if @project.errors[:new_namespace].present?
+ flash[:alert] = @project.errors[:new_namespace].first
+ end
+
@project.reset
redirect_to admin_project_path(@project)
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index b78029a52cd..3cb7373a970 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -103,14 +103,6 @@ class ApplicationController < ActionController::Base
head :forbidden, retry_after: Gitlab::Auth::UniqueIpsLimiter.config.unique_ips_limit_time_window
end
- rescue_from GRPC::Unavailable, Gitlab::Git::CommandError do |exception|
- log_exception(exception)
-
- headers['Retry-After'] = exception.retry_after if exception.respond_to?(:retry_after)
-
- render_503
- end
-
def redirect_back_or_default(default: root_path, options: {})
redirect_back(fallback_location: default, **options)
end
@@ -246,19 +238,6 @@ class ApplicationController < ActionController::Base
head :unprocessable_entity
end
- def render_503
- respond_to do |format|
- format.html do
- render(
- file: Rails.root.join("public", "503"),
- layout: false,
- status: :service_unavailable
- )
- end
- format.any { head :service_unavailable }
- end
- end
-
def no_cache_headers
DEFAULT_GITLAB_NO_CACHE_HEADERS.each do |k, v|
headers[k] = v
@@ -286,6 +265,14 @@ class ApplicationController < ActionController::Base
end
end
+ def stream_csv_headers(csv_filename)
+ no_cache_headers
+ stream_headers
+
+ headers['Content-Type'] = 'text/csv; charset=utf-8; header=present'
+ headers['Content-Disposition'] = "attachment; filename=\"#{csv_filename}\""
+ end
+
def default_cache_control
if request.xhr?
ActionDispatch::Http::Cache::Response::DEFAULT_CACHE_CONTROL
@@ -468,6 +455,7 @@ class ApplicationController < ActionController::Base
project: -> { @project if @project&.persisted? },
namespace: -> { @group if @group&.persisted? },
caller_id: caller_id,
+ remote_ip: request.ip,
feature_category: feature_category) do
yield
ensure
diff --git a/app/controllers/concerns/invisible_captcha_on_signup.rb b/app/controllers/concerns/invisible_captcha_on_signup.rb
index 9bea6145ff3..c7fd6d08744 100644
--- a/app/controllers/concerns/invisible_captcha_on_signup.rb
+++ b/app/controllers/concerns/invisible_captcha_on_signup.rb
@@ -8,7 +8,7 @@ module InvisibleCaptchaOnSignup
end
def on_honeypot_spam_callback
- return unless Feature.enabled?(:invisible_captcha)
+ return unless Gitlab::CurrentSettings.invisible_captcha_enabled
invisible_captcha_honeypot_counter.increment
log_request('Invisible_Captcha_Honeypot_Request')
@@ -17,7 +17,7 @@ module InvisibleCaptchaOnSignup
end
def on_timestamp_spam_callback
- return unless Feature.enabled?(:invisible_captcha)
+ return unless Gitlab::CurrentSettings.invisible_captcha_enabled
invisible_captcha_timestamp_counter.increment
log_request('Invisible_Captcha_Timestamp_Request')
diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb
index 3b46a547d47..57d4203ad43 100644
--- a/app/controllers/concerns/issuable_actions.rb
+++ b/app/controllers/concerns/issuable_actions.rb
@@ -217,6 +217,7 @@ module IssuableActions
:issuable_ids,
:assignee_id,
:milestone_id,
+ :sprint_id,
:state_event,
:subscription_event,
assignee_ids: [],
diff --git a/app/controllers/concerns/redis_tracking.rb b/app/controllers/concerns/redis_tracking.rb
index d81bd10d5bb..d71935356b8 100644
--- a/app/controllers/concerns/redis_tracking.rb
+++ b/app/controllers/concerns/redis_tracking.rb
@@ -33,7 +33,7 @@ module RedisTracking
return unless metric_feature_enabled?(feature, feature_default_enabled)
return unless visitor_id
- Gitlab::UsageDataCounters::HLLRedisCounter.track_event(visitor_id, event_name)
+ Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event_name, values: visitor_id)
end
def trackable_request?
diff --git a/app/controllers/concerns/show_inherited_labels_checker.rb b/app/controllers/concerns/show_inherited_labels_checker.rb
deleted file mode 100644
index 9847226f599..00000000000
--- a/app/controllers/concerns/show_inherited_labels_checker.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# frozen_string_literal: true
-
-module ShowInheritedLabelsChecker
- extend ActiveSupport::Concern
-
- private
-
- def show_inherited_labels?(include_ancestor_groups)
- Feature.enabled?(:show_inherited_labels, @project || @group, default_enabled: true) || include_ancestor_groups # rubocop:disable Gitlab/ModuleWithInstanceVariables
- end
-end
diff --git a/app/controllers/concerns/spammable_actions.rb b/app/controllers/concerns/spammable_actions.rb
index 50c93441dd4..4ec561014a8 100644
--- a/app/controllers/concerns/spammable_actions.rb
+++ b/app/controllers/concerns/spammable_actions.rb
@@ -32,10 +32,6 @@ module SpammableActions
elsif render_recaptcha?
ensure_spam_config_loaded!
- if params[:recaptcha_verification]
- flash[:alert] = _('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')
- end
-
respond_to do |format|
format.html do
render :verify
@@ -56,9 +52,9 @@ module SpammableActions
def spammable_params
default_params = { request: request }
- recaptcha_check = params[:recaptcha_verification] &&
+ recaptcha_check = recaptcha_response &&
ensure_spam_config_loaded! &&
- verify_recaptcha
+ verify_recaptcha(response: recaptcha_response)
return default_params unless recaptcha_check
@@ -66,6 +62,23 @@ module SpammableActions
spam_log_id: params[:spam_log_id] }.merge(default_params)
end
+ def recaptcha_response
+ # NOTE: This field name comes from `Recaptcha::ClientHelper#recaptcha_tags` in the recaptcha
+ # gem, which is called from the HAML `_recaptcha_form.html.haml` form.
+ #
+ # It is used in the `Recaptcha::Verify#verify_recaptcha` if the `response` option is not
+ # passed explicitly.
+ #
+ # Instead of relying on this behavior, we are extracting and passing it explicitly. This will
+ # make it consistent with the newer, modern reCAPTCHA verification process as it will be
+ # implemented via the GraphQL API and in Vue components via the native reCAPTCHA Javascript API,
+ # which requires that the recaptcha response param be obtained and passed explicitly.
+ #
+ # After this newer GraphQL/JS API process is fully supported by the backend, we can remove this
+ # (and other) HAML-specific support.
+ params['g-recaptcha-response']
+ end
+
def spammable
raise NotImplementedError, "#{self.class} does not implement #{__method__}"
end
diff --git a/app/controllers/dashboard/snippets_controller.rb b/app/controllers/dashboard/snippets_controller.rb
index 6fe3d878639..01dc0b1ab00 100644
--- a/app/controllers/dashboard/snippets_controller.rb
+++ b/app/controllers/dashboard/snippets_controller.rb
@@ -18,6 +18,7 @@ class Dashboard::SnippetsController < Dashboard::ApplicationController
.execute
.page(params[:page])
.inc_author
+ .inc_projects_namespace_route
return if redirect_out_of_range(@snippets)
diff --git a/app/controllers/explore/projects_controller.rb b/app/controllers/explore/projects_controller.rb
index d210d0f66fd..1fd3cfd11f9 100644
--- a/app/controllers/explore/projects_controller.rb
+++ b/app/controllers/explore/projects_controller.rb
@@ -9,13 +9,16 @@ class Explore::ProjectsController < Explore::ApplicationController
include SortingPreference
MIN_SEARCH_LENGTH = 3
+ PAGE_LIMIT = 50
before_action :set_non_archived_param
before_action :set_sorting
- # Limit taken from https://gitlab.com/gitlab-org/gitlab/issues/38357
+ # For background information on the limit, see:
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/38357
+ # https://gitlab.com/gitlab-org/gitlab/-/issues/262682
before_action only: [:index, :trending, :starred] do
- limit_pages(200)
+ limit_pages(PAGE_LIMIT)
end
rescue_from PageOutOfBoundsError, with: :page_out_of_bounds
diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb
index d1b09e1b49e..5df7ff0632a 100644
--- a/app/controllers/groups/group_members_controller.rb
+++ b/app/controllers/groups/group_members_controller.rb
@@ -14,10 +14,6 @@ class Groups::GroupMembersController < Groups::ApplicationController
# Authorize
before_action :authorize_admin_group_member!, except: admin_not_required_endpoints
- before_action do
- push_frontend_feature_flag(:group_members_filtered_search, @group, default_enabled: true)
- end
-
skip_before_action :check_two_factor_requirement, only: :leave
skip_cross_project_access_check :index, :create, :update, :destroy, :request_access,
:approve_access_request, :leave, :resend_invite,
diff --git a/app/controllers/groups/labels_controller.rb b/app/controllers/groups/labels_controller.rb
index 34856f8d84e..c5dd3e1df35 100644
--- a/app/controllers/groups/labels_controller.rb
+++ b/app/controllers/groups/labels_controller.rb
@@ -2,7 +2,6 @@
class Groups::LabelsController < Groups::ApplicationController
include ToggleSubscriptionAction
- include ShowInheritedLabelsChecker
before_action :label, only: [:edit, :update, :destroy]
before_action :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy]
@@ -112,7 +111,7 @@ class Groups::LabelsController < Groups::ApplicationController
current_user,
group_id: @group.id,
only_group_labels: options[:only_group_labels],
- include_ancestor_groups: show_inherited_labels?(params[:include_ancestor_groups]),
+ include_ancestor_groups: true,
sort: sort,
subscribed: options[:subscribed],
include_descendant_groups: options[:include_descendant_groups],
diff --git a/app/controllers/groups/settings/packages_and_registries_controller.rb b/app/controllers/groups/settings/packages_and_registries_controller.rb
new file mode 100644
index 00000000000..dbc1e68742b
--- /dev/null
+++ b/app/controllers/groups/settings/packages_and_registries_controller.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module Groups
+ module Settings
+ class PackagesAndRegistriesController < Groups::ApplicationController
+ before_action :authorize_admin_group!
+
+ feature_category :package_registry
+
+ def index
+ end
+ end
+ end
+end
diff --git a/app/controllers/import/bulk_imports_controller.rb b/app/controllers/import/bulk_imports_controller.rb
index 4417cfe9098..7394e8bf615 100644
--- a/app/controllers/import/bulk_imports_controller.rb
+++ b/app/controllers/import/bulk_imports_controller.rb
@@ -1,11 +1,15 @@
# frozen_string_literal: true
class Import::BulkImportsController < ApplicationController
+ include ActionView::Helpers::SanitizeHelper
+
before_action :ensure_group_import_enabled
before_action :verify_blocked_uri, only: :status
feature_category :importers
+ POLLING_INTERVAL = 3_000
+
rescue_from BulkImports::Clients::Http::ConnectionError, with: :bulk_import_connection_error
def configure
@@ -32,6 +36,12 @@ class Import::BulkImportsController < ApplicationController
render json: :ok
end
+ def realtime_changes
+ Gitlab::PollingInterval.set_header(response, interval: POLLING_INTERVAL)
+
+ render json: current_user_bulk_imports.to_json(only: [:id], methods: [:status_name])
+ end
+
private
def serialized_importable_data
@@ -43,7 +53,22 @@ class Import::BulkImportsController < ApplicationController
end
def importable_data
- client.get('groups', top_level_only: true).parsed_response
+ client.get('groups', query_params).parsed_response
+ end
+
+ # Default query string params used to fetch groups from GitLab source instance
+ #
+ # top_level_only: fetch only top level groups (subgroups are fetched during import itself)
+ # min_access_level: fetch only groups user has maintainer or above permissions
+ # search: optional search param to search user's groups by a keyword
+ def query_params
+ query_params = {
+ top_level_only: true,
+ min_access_level: Gitlab::Access::MAINTAINER
+ }
+
+ query_params[:search] = sanitized_filter_param if sanitized_filter_param
+ query_params
end
def client
@@ -131,4 +156,12 @@ class Import::BulkImportsController < ApplicationController
access_token: session[access_token_key]
}
end
+
+ def sanitized_filter_param
+ @filter ||= sanitize(params[:filter])&.downcase
+ end
+
+ def current_user_bulk_imports
+ current_user.bulk_imports.gitlab
+ end
end
diff --git a/app/controllers/jira_connect/app_descriptor_controller.rb b/app/controllers/jira_connect/app_descriptor_controller.rb
index d1ba8a98c64..137f830e40b 100644
--- a/app/controllers/jira_connect/app_descriptor_controller.rb
+++ b/app/controllers/jira_connect/app_descriptor_controller.rb
@@ -65,6 +65,8 @@ class JiraConnect::AppDescriptorController < JiraConnect::ApplicationController
}
modules.merge!(build_information_module)
+ modules.merge!(deployment_information_module)
+ modules.merge!(feature_flag_module)
modules
end
@@ -73,17 +75,46 @@ class JiraConnect::AppDescriptorController < JiraConnect::ApplicationController
view_context.image_url('gitlab_logo.png')
end
+ # See: https://developer.atlassian.com/cloud/jira/software/modules/deployment/
+ def deployment_information_module
+ {
+ jiraDeploymentInfoProvider: common_module_properties.merge(
+ actions: {}, # TODO: list deployments
+ name: { value: "GitLab Deployments" },
+ key: "gitlab-deployments"
+ )
+ }
+ end
+
+ # see: https://developer.atlassian.com/cloud/jira/software/modules/feature-flag/
+ def feature_flag_module
+ {
+ jiraFeatureFlagInfoProvider: common_module_properties.merge(
+ actions: {}, # TODO: create, link and list feature flags https://gitlab.com/gitlab-org/gitlab/-/issues/297386
+ name: {
+ value: 'GitLab Feature Flags'
+ },
+ key: 'gitlab-feature-flags'
+ )
+ }
+ end
+
# See: https://developer.atlassian.com/cloud/jira/software/modules/build/
def build_information_module
{
- jiraBuildInfoProvider: {
- homeUrl: HOME_URL,
- logoUrl: logo_url,
- documentationUrl: DOC_URL,
+ jiraBuildInfoProvider: common_module_properties.merge(
actions: {},
name: { value: "GitLab CI" },
key: "gitlab-ci"
- }
+ )
+ }
+ end
+
+ def common_module_properties
+ {
+ homeUrl: HOME_URL,
+ logoUrl: logo_url,
+ documentationUrl: DOC_URL
}
end
diff --git a/app/controllers/jira_connect/subscriptions_controller.rb b/app/controllers/jira_connect/subscriptions_controller.rb
index 3ff12f29f10..161280a05fc 100644
--- a/app/controllers/jira_connect/subscriptions_controller.rb
+++ b/app/controllers/jira_connect/subscriptions_controller.rb
@@ -19,6 +19,9 @@ class JiraConnect::SubscriptionsController < JiraConnect::ApplicationController
before_action :allow_rendering_in_iframe, only: :index
before_action :verify_qsh_claim!, only: :index
before_action :authenticate_user!, only: :create
+ before_action do
+ push_frontend_feature_flag(:new_jira_connect_ui, type: :development, default_enabled: :yaml)
+ end
def index
@subscriptions = current_jira_installation.subscriptions.preload_namespace_route
diff --git a/app/controllers/metrics_controller.rb b/app/controllers/metrics_controller.rb
index c2089a0fca3..1ef1e12bb02 100644
--- a/app/controllers/metrics_controller.rb
+++ b/app/controllers/metrics_controller.rb
@@ -18,9 +18,19 @@ class MetricsController < ActionController::Base
render plain: response, content_type: 'text/plain; version=0.0.4'
end
+ def system
+ render json: system_metrics
+ end
+
private
def metrics_service
@metrics_service ||= MetricsService.new
end
+
+ def system_metrics
+ Gitlab::Metrics::System.summary.merge(
+ worker_id: Prometheus::PidProvider.worker_id
+ )
+ end
end
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index 8f16650a6f2..8c66f45dd79 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -31,6 +31,9 @@ class Projects::BlobController < Projects::ApplicationController
before_action :editor_variables, except: [:show, :preview, :diff]
before_action :validate_diff_params, only: :diff
before_action :set_last_commit_sha, only: [:edit, :update]
+ before_action only: :new do
+ record_experiment_user(:ci_syntax_templates, namespace_id: @project.namespace_id) if params[:file_name] == @project.ci_config_path_or_default
+ end
track_redis_hll_event :create, :update, name: 'g_edit_by_sfe', feature: :track_editor_edit_actions, feature_default_enabled: true
diff --git a/app/controllers/projects/ci/pipeline_editor_controller.rb b/app/controllers/projects/ci/pipeline_editor_controller.rb
index cc391868df0..ef9025ae52f 100644
--- a/app/controllers/projects/ci/pipeline_editor_controller.rb
+++ b/app/controllers/projects/ci/pipeline_editor_controller.rb
@@ -3,7 +3,7 @@
class Projects::Ci::PipelineEditorController < Projects::ApplicationController
before_action :check_can_collaborate!
before_action do
- push_frontend_feature_flag(:ci_config_visualization_tab, @project, default_enabled: false)
+ push_frontend_feature_flag(:ci_config_visualization_tab, @project, default_enabled: :yaml)
end
feature_category :pipeline_authoring
diff --git a/app/controllers/projects/cycle_analytics_controller.rb b/app/controllers/projects/cycle_analytics_controller.rb
index ab1cf63c885..5c15a5d246c 100644
--- a/app/controllers/projects/cycle_analytics_controller.rb
+++ b/app/controllers/projects/cycle_analytics_controller.rb
@@ -7,7 +7,6 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
include Analytics::UniqueVisitsHelper
include GracefulTimeoutHandling
- before_action :whitelist_query_limiting, only: [:show]
before_action :authorize_read_cycle_analytics!
track_unique_visits :show, target_id: 'p_analytics_valuestream'
@@ -38,8 +37,4 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
permissions: @cycle_analytics.permissions(user: current_user)
}
end
-
- def whitelist_query_limiting
- Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-foss/issues/42671')
- end
end
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index c37abf82fe9..92483607e65 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -15,6 +15,9 @@ class Projects::EnvironmentsController < Projects::ApplicationController
push_frontend_feature_flag(:prometheus_computed_alerts)
push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate)
end
+ before_action do
+ push_frontend_feature_flag(:canary_ingress_weight_control, default_enabled: true)
+ end
before_action :authorize_read_environment!, except: [:metrics, :additional_metrics, :metrics_dashboard, :metrics_redirect]
before_action :authorize_create_environment!, only: [:new, :create]
before_action :authorize_stop_environment!, only: [:stop]
diff --git a/app/controllers/projects/feature_flags_controller.rb b/app/controllers/projects/feature_flags_controller.rb
index da9dcd1c09c..6b6606c4f41 100644
--- a/app/controllers/projects/feature_flags_controller.rb
+++ b/app/controllers/projects/feature_flags_controller.rb
@@ -10,12 +10,10 @@ class Projects::FeatureFlagsController < Projects::ApplicationController
before_action :feature_flag, only: [:edit, :update, :destroy]
- before_action :ensure_legacy_flags_writable!, only: [:update]
+ before_action :ensure_flag_writable!, only: [:update]
before_action do
push_frontend_feature_flag(:feature_flag_permissions)
- push_frontend_feature_flag(:feature_flags_legacy_read_only, project, default_enabled: true)
- push_frontend_feature_flag(:feature_flags_legacy_read_only_override, project)
end
feature_category :feature_flags
@@ -103,10 +101,8 @@ class Projects::FeatureFlagsController < Projects::ApplicationController
@feature_flag ||= @noteable = project.operations_feature_flags.find_by_iid!(params[:iid])
end
- def ensure_legacy_flags_writable!
- if ::Feature.enabled?(:feature_flags_legacy_read_only, project, default_enabled: true) &&
- ::Feature.disabled?(:feature_flags_legacy_read_only_override, project) &&
- feature_flag.legacy_flag?
+ def ensure_flag_writable!
+ if feature_flag.legacy_flag?
render_error_json(['Legacy feature flags are read-only'])
end
end
diff --git a/app/controllers/projects/incident_management/pager_duty_incidents_controller.rb b/app/controllers/projects/incident_management/pager_duty_incidents_controller.rb
index f1264ca4a45..408652b4b9e 100644
--- a/app/controllers/projects/incident_management/pager_duty_incidents_controller.rb
+++ b/app/controllers/projects/incident_management/pager_duty_incidents_controller.rb
@@ -26,7 +26,7 @@ module Projects
end
def webhook_processor
- ::IncidentManagement::PagerDuty::ProcessWebhookService.new(project, nil, payload)
+ ::IncidentManagement::PagerDuty::ProcessWebhookService.new(project, payload)
end
def payload
diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb
index ba8e6b90971..3992165d07c 100644
--- a/app/controllers/projects/labels_controller.rb
+++ b/app/controllers/projects/labels_controller.rb
@@ -2,7 +2,6 @@
class Projects::LabelsController < Projects::ApplicationController
include ToggleSubscriptionAction
- include ShowInheritedLabelsChecker
before_action :check_issuables_available!
before_action :label, only: [:edit, :update, :destroy, :promote]
@@ -164,7 +163,7 @@ class Projects::LabelsController < Projects::ApplicationController
@available_labels ||=
LabelsFinder.new(current_user,
project_id: @project.id,
- include_ancestor_groups: show_inherited_labels?(params[:include_ancestor_groups]),
+ include_ancestor_groups: true,
search: params[:search],
subscribed: params[:subscribed],
sort: sort).execute
diff --git a/app/controllers/projects/mattermosts_controller.rb b/app/controllers/projects/mattermosts_controller.rb
index 63a36732d87..ac204427885 100644
--- a/app/controllers/projects/mattermosts_controller.rb
+++ b/app/controllers/projects/mattermosts_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class Projects::MattermostsController < Projects::ApplicationController
- include TriggersHelper
+ include Ci::TriggersHelper
include ActionView::Helpers::AssetUrlHelper
layout 'project_settings'
diff --git a/app/controllers/projects/merge_requests/creations_controller.rb b/app/controllers/projects/merge_requests/creations_controller.rb
index 7d3e7759081..858bdc066c1 100644
--- a/app/controllers/projects/merge_requests/creations_controller.rb
+++ b/app/controllers/projects/merge_requests/creations_controller.rb
@@ -14,7 +14,7 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap
before_action do
push_frontend_feature_flag(:merge_request_reviewers, @project, default_enabled: true)
push_frontend_feature_flag(:mr_collapsed_approval_rules, @project)
- push_frontend_feature_flag(:reviewer_approval_rules, @project)
+ push_frontend_feature_flag(:reviewer_approval_rules, @project, default_enabled: :yaml)
end
def new
diff --git a/app/controllers/projects/merge_requests/diffs_controller.rb b/app/controllers/projects/merge_requests/diffs_controller.rb
index da19ddf6105..9180b3f6b62 100644
--- a/app/controllers/projects/merge_requests/diffs_controller.rb
+++ b/app/controllers/projects/merge_requests/diffs_controller.rb
@@ -11,6 +11,8 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
around_action :allow_gitaly_ref_name_caching
+ after_action :track_viewed_diffs_events, only: [:diffs_batch]
+
def show
render_diffs
end
@@ -163,7 +165,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
end
def render_merge_ref_head_diff?
- Gitlab::Utils.to_boolean(params[:diff_head]) && @merge_request.diffable_merge_ref?
+ Gitlab::Utils.to_boolean(params[:diff_head]) && @merge_request.diffable_merge_ref? && @start_sha.nil?
end
def note_positions
@@ -188,4 +190,16 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
Discussions::CaptureDiffNotePositionsService.new(@merge_request).execute
end
+
+ def track_viewed_diffs_events
+ return if request.headers['DNT'] == '1'
+
+ Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter
+ .track_mr_diffs_action(merge_request: @merge_request)
+
+ return unless current_user&.view_diffs_file_by_file
+
+ Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter
+ .track_mr_diffs_single_file_action(merge_request: @merge_request, user: current_user)
+ end
end
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 382fbfaac25..d452a5e02e2 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -28,22 +28,21 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
before_action :authenticate_user!, only: [:assign_related_issues]
before_action :check_user_can_push_to_source_branch!, only: [:rebase]
before_action only: [:show] do
- push_frontend_feature_flag(:widget_visibility_polling, @project, default_enabled: true)
- push_frontend_feature_flag(:mr_commit_neighbor_nav, @project, default_enabled: true)
push_frontend_feature_flag(:multiline_comments, @project, default_enabled: true)
push_frontend_feature_flag(:file_identifier_hash)
push_frontend_feature_flag(:batch_suggestions, @project, default_enabled: true)
push_frontend_feature_flag(:approvals_commented_by, @project, default_enabled: true)
- push_frontend_feature_flag(:hide_jump_to_next_unresolved_in_threads, default_enabled: true)
push_frontend_feature_flag(:merge_request_widget_graphql, @project)
- push_frontend_feature_flag(:unified_diff_components, @project)
+ push_frontend_feature_flag(:drag_comment_selection, @project, default_enabled: true)
+ push_frontend_feature_flag(:unified_diff_components, @project, default_enabled: true)
push_frontend_feature_flag(:default_merge_ref_for_diffs, @project)
push_frontend_feature_flag(:core_security_mr_widget, @project, default_enabled: true)
push_frontend_feature_flag(:core_security_mr_widget_counts, @project)
push_frontend_feature_flag(:core_security_mr_widget_downloads, @project, default_enabled: true)
push_frontend_feature_flag(:remove_resolve_note, @project, default_enabled: true)
- push_frontend_feature_flag(:test_failure_history, @project)
push_frontend_feature_flag(:diffs_gradual_load, @project, default_enabled: true)
+ push_frontend_feature_flag(:codequality_mr_diff, @project)
+ push_frontend_feature_flag(:suggestions_custom_commit, @project)
record_experiment_user(:invite_members_version_a)
record_experiment_user(:invite_members_version_b)
@@ -53,7 +52,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
push_frontend_feature_flag(:vue_issuable_sidebar, @project.group)
push_frontend_feature_flag(:merge_request_reviewers, @project, default_enabled: true)
push_frontend_feature_flag(:mr_collapsed_approval_rules, @project)
- push_frontend_feature_flag(:reviewer_approval_rules, @project)
+ push_frontend_feature_flag(:reviewer_approval_rules, @project, default_enabled: :yaml)
end
around_action :allow_gitaly_ref_name_caching, only: [:index, :show, :discussions]
@@ -69,8 +68,9 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
:toggle_award_emoji, :toggle_subscription, :update
]
- feature_category :code_testing, [:test_reports, :coverage_reports, :terraform_reports]
+ feature_category :code_testing, [:test_reports, :coverage_reports]
feature_category :accessibility_testing, [:accessibility_reports]
+ feature_category :infrastructure_as_code, [:terraform_reports]
def index
@merge_requests = @issuables
diff --git a/app/controllers/projects/pipeline_schedules_controller.rb b/app/controllers/projects/pipeline_schedules_controller.rb
index 5655d3b4c0d..4af7508b935 100644
--- a/app/controllers/projects/pipeline_schedules_controller.rb
+++ b/app/controllers/projects/pipeline_schedules_controller.rb
@@ -17,7 +17,6 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
@scope = params[:scope]
@all_schedules = Ci::PipelineSchedulesFinder.new(@project).execute
@schedules = Ci::PipelineSchedulesFinder.new(@project).execute(scope: params[:scope])
- .includes(:last_pipeline)
end
# rubocop: enable CodeReuse/ActiveRecord
diff --git a/app/controllers/projects/pipelines/tests_controller.rb b/app/controllers/projects/pipelines/tests_controller.rb
index 1c212964df5..924d52898ea 100644
--- a/app/controllers/projects/pipelines/tests_controller.rb
+++ b/app/controllers/projects/pipelines/tests_controller.rb
@@ -6,6 +6,8 @@ module Projects
before_action :authorize_read_build!
before_action :builds, only: [:show]
+ feature_category :code_testing
+
def summary
respond_to do |format|
format.json do
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb
index 74513da8675..e44c00e501e 100644
--- a/app/controllers/projects/pipelines_controller.rb
+++ b/app/controllers/projects/pipelines_controller.rb
@@ -17,10 +17,10 @@ class Projects::PipelinesController < Projects::ApplicationController
push_frontend_feature_flag(:new_pipeline_form, project, default_enabled: true)
push_frontend_feature_flag(:graphql_pipeline_header, project, type: :development, default_enabled: false)
push_frontend_feature_flag(:graphql_pipeline_details, project, type: :development, default_enabled: false)
- push_frontend_feature_flag(:graphql_pipeline_analytics, project, type: :development)
push_frontend_feature_flag(:new_pipeline_form_prefilled_vars, project, type: :development, default_enabled: true)
end
before_action :ensure_pipeline, only: [:show]
+ before_action :push_experiment_to_gon, only: :index, if: :html_request?
# Will be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/225596
before_action :redirect_for_legacy_scope_filter, only: [:index], if: -> { request.format.html? }
@@ -45,7 +45,11 @@ class Projects::PipelinesController < Projects::ApplicationController
@pipelines_count = limited_pipelines_count(project)
respond_to do |format|
- format.html
+ format.html do
+ record_empty_pipeline_experiment
+
+ render :index
+ end
format.json do
Gitlab::PollingInterval.set_header(response, interval: POLLING_INTERVAL)
@@ -184,23 +188,6 @@ class Projects::PipelinesController < Projects::ApplicationController
end
end
- def charts
- @charts = {}
- @counts = {}
-
- return if Feature.enabled?(:graphql_pipeline_analytics)
-
- @charts[:week] = Gitlab::Ci::Charts::WeekChart.new(project)
- @charts[:month] = Gitlab::Ci::Charts::MonthChart.new(project)
- @charts[:year] = Gitlab::Ci::Charts::YearChart.new(project)
- @charts[:pipeline_times] = Gitlab::Ci::Charts::PipelineTime.new(project)
-
- @counts[:total] = @project.all_pipelines.count(:all)
- @counts[:success] = @project.all_pipelines.success.count(:all)
- @counts[:failed] = @project.all_pipelines.failed.count(:all)
- @counts[:total_duration] = @project.all_pipelines.total_duration
- end
-
def test_report
respond_to do |format|
format.html do
@@ -313,6 +300,20 @@ class Projects::PipelinesController < Projects::ApplicationController
def index_params
params.permit(:scope, :username, :ref, :status)
end
+
+ def record_empty_pipeline_experiment
+ return unless @pipelines_count.to_i == 0
+ return if helpers.has_gitlab_ci?(@project)
+
+ record_experiment_user(:pipelines_empty_state)
+ end
+
+ def push_experiment_to_gon
+ return unless current_user
+
+ push_frontend_experiment(:pipelines_empty_state, subject: current_user)
+ frontend_experimentation_tracking_data(:pipelines_empty_state, 'view', project.namespace_id, subject: current_user)
+ end
end
Projects::PipelinesController.prepend_if_ee('EE::Projects::PipelinesController')
diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb
index 631f627838b..5972b29a298 100644
--- a/app/controllers/projects/project_members_controller.rb
+++ b/app/controllers/projects/project_members_controller.rb
@@ -17,17 +17,18 @@ class Projects::ProjectMembersController < Projects::ApplicationController
@skip_groups += @project.group.self_and_ancestors_ids if @project.group
@group_links = @project.project_group_links
- @group_links = @group_links.search(params[:search]) if params[:search].present?
+ @group_links = @group_links.search(params[:search_groups]) if params[:search_groups].present?
- @project_members = MembersFinder
+ project_members = MembersFinder
.new(@project, current_user, params: filter_params)
.execute(include_relations: requested_relations)
- @project_members = present_members(@project_members.page(params[:page]))
+ if helpers.can_manage_project_members?(@project)
+ @invited_members = present_members(project_members.invite)
+ @requesters = present_members(AccessRequestsFinder.new(@project).execute(current_user))
+ end
- @requesters = present_members(
- AccessRequestsFinder.new(@project).execute(current_user)
- )
+ @project_members = present_members(project_members.non_invite.page(params[:page]))
@project_member = @project.project_members.new
end
diff --git a/app/controllers/projects/usage_ping_controller.rb b/app/controllers/projects/usage_ping_controller.rb
index 9b4ddb326c1..77ee53f2e5d 100644
--- a/app/controllers/projects/usage_ping_controller.rb
+++ b/app/controllers/projects/usage_ping_controller.rb
@@ -3,7 +3,7 @@
class Projects::UsagePingController < Projects::ApplicationController
before_action :authenticate_user!
- feature_category :collection
+ feature_category :usage_ping
def web_ide_clientside_preview
return render_404 unless Gitlab::CurrentSettings.web_ide_clientside_preview_enabled?
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 3744517934a..0c40478d877 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -94,7 +94,7 @@ class ProjectsController < Projects::ApplicationController
redirect_to(edit_project_path(@project, anchor: 'js-general-project-settings'))
end
else
- flash.now[:alert] = result[:message]
+ flash[:alert] = result[:message]
@project.reset
format.html { render_edit }
@@ -197,13 +197,13 @@ class ProjectsController < Projects::ApplicationController
end
def housekeeping
- ::Projects::HousekeepingService.new(@project, :gc).execute
+ ::Repositories::HousekeepingService.new(@project, :gc).execute
redirect_to(
project_path(@project),
notice: _("Housekeeping successfully started")
)
- rescue ::Projects::HousekeepingService::LeaseTaken => ex
+ rescue ::Repositories::HousekeepingService::LeaseTaken => ex
redirect_to(
edit_project_path(@project, anchor: 'js-project-advanced-settings'),
alert: ex.to_s
diff --git a/app/controllers/repositories/lfs_api_controller.rb b/app/controllers/repositories/lfs_api_controller.rb
index 9b7cbcb2dfe..2de29da4b45 100644
--- a/app/controllers/repositories/lfs_api_controller.rb
+++ b/app/controllers/repositories/lfs_api_controller.rb
@@ -103,18 +103,13 @@ module Repositories
end
def upload_headers
- headers = {
+ {
Authorization: authorization_header,
# git-lfs v2.5.0 sets the Content-Type based on the uploaded file. This
# ensures that Workhorse can intercept the request.
- 'Content-Type': LFS_TRANSFER_CONTENT_TYPE
+ 'Content-Type': LFS_TRANSFER_CONTENT_TYPE,
+ 'Transfer-Encoding': 'chunked'
}
-
- if Feature.enabled?(:lfs_chunked_encoding, project, default_enabled: true)
- headers['Transfer-Encoding'] = 'chunked'
- end
-
- headers
end
def lfs_check_batch_operation!
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 46245286820..62208d838c1 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -33,10 +33,8 @@ class UsersController < ApplicationController
end
format.json do
- # In 13.8, this endpoint will be removed:
- # https://gitlab.com/gitlab-org/gitlab/-/issues/289972
- load_events
- pager_json("events/_events", @events.count, events: @events)
+ msg = "This endpoint is deprecated. Use %s instead." % user_activity_path
+ render json: { message: msg }, status: :not_found
end
end
end