diff options
Diffstat (limited to 'app/controllers/projects')
16 files changed, 66 insertions, 53 deletions
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? |