diff options
Diffstat (limited to 'app/controllers/projects')
27 files changed, 252 insertions, 74 deletions
diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb index fef3c6cf424..652687932fd 100644 --- a/app/controllers/projects/artifacts_controller.rb +++ b/app/controllers/projects/artifacts_controller.rb @@ -108,7 +108,7 @@ class Projects::ArtifactsController < Projects::ApplicationController end def validate_artifacts! - render_404 unless build&.artifacts? + render_404 unless build&.available_artifacts? end def build diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 7f14522e61b..d969e7bf771 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -257,5 +257,3 @@ class Projects::BlobController < Projects::ApplicationController params.permit(:full, :since, :to, :bottom, :unfold, :offset, :indent) end end - -Projects::BlobController.prepend_if_ee('EE::Projects::BlobController') diff --git a/app/controllers/projects/ci/lints_controller.rb b/app/controllers/projects/ci/lints_controller.rb index 73b3eb9c205..c13baaea8c6 100644 --- a/app/controllers/projects/ci/lints_controller.rb +++ b/app/controllers/projects/ci/lints_controller.rb @@ -8,16 +8,30 @@ class Projects::Ci::LintsController < Projects::ApplicationController def create @content = params[:content] - result = Gitlab::Ci::YamlProcessor.new_with_validation_errors(@content, yaml_processor_options) - - @status = result.valid? - @errors = result.errors - - if result.valid? - @config_processor = result.config - @stages = @config_processor.stages - @builds = @config_processor.builds - @jobs = @config_processor.jobs + @dry_run = params[:dry_run] + + if @dry_run && Gitlab::Ci::Features.lint_creates_pipeline_with_dry_run?(@project) + pipeline = Ci::CreatePipelineService + .new(@project, current_user, ref: @project.default_branch) + .execute(:push, dry_run: true, content: @content) + + @status = pipeline.error_messages.empty? + @stages = pipeline.stages + @errors = pipeline.error_messages.map(&:content) + @warnings = pipeline.warning_messages.map(&:content) + else + result = Gitlab::Ci::YamlProcessor.new_with_validation_errors(@content, yaml_processor_options) + + @status = result.valid? + @errors = result.errors + @warnings = result.warnings + + if result.valid? + @config_processor = result.config + @stages = @config_processor.stages + @builds = @config_processor.builds + @jobs = @config_processor.jobs + end end render :show diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index 3f2dc9b09fa..b0c6f3cc6a1 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -15,8 +15,8 @@ class Projects::CommitController < Projects::ApplicationController before_action :authorize_download_code! before_action :authorize_read_pipeline!, only: [:pipelines] before_action :commit - before_action :define_commit_vars, only: [:show, :diff_for_path, :pipelines, :merge_requests] - before_action :define_note_vars, only: [:show, :diff_for_path] + before_action :define_commit_vars, only: [:show, :diff_for_path, :diff_files, :pipelines, :merge_requests] + before_action :define_note_vars, only: [:show, :diff_for_path, :diff_files] before_action :authorize_edit_tree!, only: [:revert, :cherry_pick] BRANCH_SEARCH_LIMIT = 1000 @@ -41,6 +41,10 @@ class Projects::CommitController < Projects::ApplicationController render_diff_for_path(@commit.diffs(diff_options)) end + def diff_files + render json: { html: view_to_html_string('projects/commit/diff_files', diffs: @diffs, environment: @environment) } + end + # rubocop: disable CodeReuse/ActiveRecord def pipelines @pipelines = @commit.pipelines.order(id: :desc) diff --git a/app/controllers/projects/cycle_analytics/events_controller.rb b/app/controllers/projects/cycle_analytics/events_controller.rb index 673f53c221b..c69bf029c73 100644 --- a/app/controllers/projects/cycle_analytics/events_controller.rb +++ b/app/controllers/projects/cycle_analytics/events_controller.rb @@ -4,6 +4,7 @@ module Projects module CycleAnalytics class EventsController < Projects::ApplicationController include CycleAnalyticsParams + include GracefulTimeoutHandling before_action :authorize_read_cycle_analytics! before_action :authorize_read_build!, only: [:test, :staging] diff --git a/app/controllers/projects/cycle_analytics_controller.rb b/app/controllers/projects/cycle_analytics_controller.rb index 898d888c978..ef97bc795f9 100644 --- a/app/controllers/projects/cycle_analytics_controller.rb +++ b/app/controllers/projects/cycle_analytics_controller.rb @@ -5,6 +5,7 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController include ActionView::Helpers::TextHelper include CycleAnalyticsParams include Analytics::UniqueVisitsHelper + include GracefulTimeoutHandling before_action :whitelist_query_limiting, only: [:show] before_action :authorize_read_cycle_analytics! diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index d5da24a76de..71195fdb892 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -13,6 +13,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController authorize_metrics_dashboard! push_frontend_feature_flag(:prometheus_computed_alerts) + push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate) end before_action :authorize_read_environment!, except: [:metrics, :additional_metrics, :metrics_dashboard, :metrics_redirect] before_action :authorize_create_environment!, only: [:new, :create] @@ -104,7 +105,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController action_or_env_url = if stop_action - polymorphic_url([project.namespace.becomes(Namespace), project, stop_action]) + polymorphic_url([project, stop_action]) else project_environment_url(project, @environment) end @@ -158,18 +159,14 @@ class Projects::EnvironmentsController < Projects::ApplicationController end def metrics_redirect - environment = project.default_environment - - if environment - redirect_to environment_metrics_path(environment) - else - render :empty_metrics - end + redirect_to project_metrics_dashboard_path(project) end def metrics respond_to do |format| - format.html + format.html do + redirect_to project_metrics_dashboard_path(project, environment: environment ) + end format.json do # Currently, this acts as a hint to load the metrics details into the cache # if they aren't there already diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index b93f6384e0c..41631aea620 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -36,7 +36,19 @@ class Projects::ForksController < Projects::ApplicationController end def new - @namespaces = fork_service.valid_fork_targets - [project.namespace] + respond_to do |format| + format.html do + @own_namespace = current_user.namespace if fork_service.valid_fork_targets.include?(current_user.namespace) + @project = project + end + + format.json do + namespaces = fork_service.valid_fork_targets - [current_user.namespace, project.namespace] + render json: { + namespaces: ForkNamespaceSerializer.new.represent(namespaces, project: project, current_user: current_user) + } + end + end end # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/controllers/projects/incidents_controller.rb b/app/controllers/projects/incidents_controller.rb new file mode 100644 index 00000000000..12cc4dde1f4 --- /dev/null +++ b/app/controllers/projects/incidents_controller.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +class Projects::IncidentsController < Projects::ApplicationController + before_action :authorize_read_incidents! + + def index + end +end diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 12b5a538bc9..2200860a184 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -51,8 +51,10 @@ class Projects::IssuesController < Projects::ApplicationController end before_action only: :show do - push_frontend_feature_flag(:real_time_issue_sidebar, @project) - push_frontend_feature_flag(:confidential_apollo_sidebar, @project) + real_time_feature_flag = :real_time_issue_sidebar + real_time_enabled = Gitlab::ActionCable::Config.in_app? || Feature.enabled?(real_time_feature_flag, @project) + + gon.push({ features: { real_time_feature_flag.to_s.camelize(:lower) => real_time_enabled } }, true) end before_action only: :index do @@ -88,7 +90,7 @@ class Projects::IssuesController < Projects::ApplicationController params[:issue] ||= ActionController::Parameters.new( assignee_ids: "" ) - build_params = issue_params.merge( + build_params = issue_create_params.merge( merge_request_to_resolve_discussions_of: params[:merge_request_to_resolve_discussions_of], discussion_to_resolve: params[:discussion_to_resolve], confidential: !!Gitlab::Utils.to_boolean(params[:issue][:confidential]) @@ -108,7 +110,7 @@ class Projects::IssuesController < Projects::ApplicationController end def create - create_params = issue_params.merge(spammable_params).merge( + create_params = issue_create_params.merge(spammable_params).merge( merge_request_to_resolve_discussions_of: params[:merge_request_to_resolve_discussions_of], discussion_to_resolve: params[:discussion_to_resolve] ) @@ -291,6 +293,16 @@ class Projects::IssuesController < Projects::ApplicationController ] + [{ label_ids: [], assignee_ids: [], update_task: [:index, :checked, :line_number, :line_source] }] end + def issue_create_params + create_params = %i[ + issue_type + ] + + params.require(:issue).permit( + *create_params + ).merge(issue_params) + end + def reorder_params params.permit(:move_before_id, :move_after_id, :group_full_path) end diff --git a/app/controllers/projects/merge_requests/diffs_controller.rb b/app/controllers/projects/merge_requests/diffs_controller.rb index 98b0abc89e9..bceccc7063b 100644 --- a/app/controllers/projects/merge_requests/diffs_controller.rb +++ b/app/controllers/projects/merge_requests/diffs_controller.rb @@ -41,7 +41,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic def diffs_metadata diffs = @compare.diffs(diff_options) - render json: DiffsMetadataSerializer.new(project: @merge_request.project) + render json: DiffsMetadataSerializer.new(project: @merge_request.project, current_user: current_user) .represent(diffs, additional_attributes) end diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 5d4514be838..e77d2f0f5ee 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -31,16 +31,19 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo push_frontend_feature_flag(:suggest_pipeline) if experiment_enabled?(:suggest_pipeline) push_frontend_feature_flag(:code_navigation, @project, default_enabled: true) push_frontend_feature_flag(:widget_visibility_polling, @project, default_enabled: true) - push_frontend_feature_flag(:merge_ref_head_comments, @project) + push_frontend_feature_flag(:merge_ref_head_comments, @project, default_enabled: true) push_frontend_feature_flag(:mr_commit_neighbor_nav, @project, default_enabled: true) - push_frontend_feature_flag(:multiline_comments, @project) + 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(:auto_expand_collapsed_diffs, @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) end before_action do push_frontend_feature_flag(:vue_issuable_sidebar, @project.group) - push_frontend_feature_flag(:junit_pipeline_view, @project.group) end around_action :allow_gitaly_ref_name_caching, only: [:index, :show, :discussions] @@ -80,7 +83,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo @note = @project.notes.new(noteable: @merge_request) @noteable = @merge_request - @commits_count = @merge_request.commits_count + @commits_count = @merge_request.commits_count + @merge_request.context_commits_count @issuable_sidebar = serializer.represent(@merge_request, serializer: 'sidebar') @current_user_data = UserSerializer.new(project: @project).represent(current_user, {}, MergeRequestUserEntity).to_json @show_whitespace_default = current_user.nil? || current_user.show_whitespace_in_diffs @@ -114,6 +117,12 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo end def commits + # Get context commits from repository + @context_commits = + set_commits_for_rendering( + @merge_request.recent_context_commits + ) + # Get commits from repository # or from cache if already merged @commits = @@ -403,7 +412,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo return access_denied! unless @merge_request.source_branch_exists? access_check = ::Gitlab::UserAccess - .new(current_user, project: @merge_request.source_project) + .new(current_user, container: @merge_request.source_project) .can_push_to_branch?(@merge_request.source_branch) access_denied! unless access_check diff --git a/app/controllers/projects/metrics/dashboards/builder_controller.rb b/app/controllers/projects/metrics/dashboards/builder_controller.rb new file mode 100644 index 00000000000..2ab574d7d10 --- /dev/null +++ b/app/controllers/projects/metrics/dashboards/builder_controller.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +module Projects + module Metrics + module Dashboards + class BuilderController < Projects::ApplicationController + before_action :authorize_metrics_dashboard! + + def panel_preview + respond_to do |format| + format.json do + if rendered_panel.success? + render json: rendered_panel.payload + else + render json: { message: rendered_panel.message }, status: :unprocessable_entity + end + end + end + end + + private + + def rendered_panel + @panel_preview ||= ::Metrics::Dashboard::PanelPreviewService.new(project, panel_yaml, environment).execute + end + + def panel_yaml + params.require(:panel_yaml) + end + + def environment + @environment ||= + if params[:environment] + project.environments.find(params[:environment]) + else + project.default_environment + end + end + end + end + end +end diff --git a/app/controllers/projects/metrics_dashboard_controller.rb b/app/controllers/projects/metrics_dashboard_controller.rb index 235ee1dfbf2..51307c3665c 100644 --- a/app/controllers/projects/metrics_dashboard_controller.rb +++ b/app/controllers/projects/metrics_dashboard_controller.rb @@ -9,13 +9,14 @@ module Projects before_action :authorize_metrics_dashboard! before_action do push_frontend_feature_flag(:prometheus_computed_alerts) + push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate) end def show if environment render 'projects/environments/metrics' else - render_404 + render 'projects/environments/empty_metrics' end end diff --git a/app/controllers/projects/packages/package_files_controller.rb b/app/controllers/projects/packages/package_files_controller.rb new file mode 100644 index 00000000000..dd6d875cd1e --- /dev/null +++ b/app/controllers/projects/packages/package_files_controller.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Projects + module Packages + class PackageFilesController < ApplicationController + include PackagesAccess + include SendFileUpload + + def download + package_file = project.package_files.find(params[:id]) + + send_upload(package_file.file, attachment: package_file.file_name) + end + end + end +end diff --git a/app/controllers/projects/packages/packages_controller.rb b/app/controllers/projects/packages/packages_controller.rb new file mode 100644 index 00000000000..fc4ef7a01dc --- /dev/null +++ b/app/controllers/projects/packages/packages_controller.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Projects + module Packages + class PackagesController < Projects::ApplicationController + include PackagesAccess + + before_action :authorize_destroy_package!, only: [:destroy] + + def show + @package = project.packages.find(params[:id]) + @package_files = @package.package_files.recent + @maven_metadatum = @package.maven_metadatum + end + + def destroy + @package = project.packages.find(params[:id]) + @package.destroy + + redirect_to project_packages_path(@project), status: :found, notice: _('Package was removed') + end + end + end +end diff --git a/app/controllers/projects/pipelines/tests_controller.rb b/app/controllers/projects/pipelines/tests_controller.rb index f03274bf32e..1c212964df5 100644 --- a/app/controllers/projects/pipelines/tests_controller.rb +++ b/app/controllers/projects/pipelines/tests_controller.rb @@ -3,7 +3,6 @@ module Projects module Pipelines class TestsController < Projects::Pipelines::ApplicationController - before_action :validate_feature_flag! before_action :authorize_read_build! before_action :builds, only: [:show] @@ -29,29 +28,21 @@ module Projects private - def validate_feature_flag! - render_404 unless Feature.enabled?(:build_report_summary, project) - end - # rubocop: disable CodeReuse/ActiveRecord def builds - pipeline.latest_builds.where(id: build_params) + @builds ||= pipeline.latest_builds.for_ids(build_ids).presence || render_404 end - def build_params + def build_ids return [] unless params[:build_ids] params[:build_ids].split(",") end def test_suite - if builds.present? - builds.map do |build| - build.collect_test_reports!(Gitlab::Ci::Reports::TestReports.new) - end.sum - else - render_404 - end + builds.map do |build| + build.collect_test_reports!(Gitlab::Ci::Reports::TestReports.new) + end.sum end # rubocop: enable CodeReuse/ActiveRecord end diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index d8e11ddd423..bfe23eb1035 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -12,11 +12,10 @@ class Projects::PipelinesController < Projects::ApplicationController before_action :authorize_create_pipeline!, only: [:new, :create] before_action :authorize_update_pipeline!, only: [:retry, :cancel] before_action do - push_frontend_feature_flag(:junit_pipeline_view, project) - push_frontend_feature_flag(:build_report_summary, project) push_frontend_feature_flag(:filter_pipelines_search, project, default_enabled: true) push_frontend_feature_flag(:dag_pipeline_tab, project, default_enabled: true) push_frontend_feature_flag(:pipelines_security_report_summary, project) + push_frontend_feature_flag(:new_pipeline_form) end before_action :ensure_pipeline, only: [:show] @@ -177,8 +176,6 @@ class Projects::PipelinesController < Projects::ApplicationController end def test_report - return unless Feature.enabled?(:junit_pipeline_view, project) - respond_to do |format| format.html do render 'show' @@ -192,12 +189,6 @@ class Projects::PipelinesController < Projects::ApplicationController end end - def test_reports_count - return unless Feature.enabled?(:junit_pipeline_view, project) - - render json: { total_count: pipeline.test_reports_count }.to_json - end - private def serialize_pipelines diff --git a/app/controllers/projects/product_analytics_controller.rb b/app/controllers/projects/product_analytics_controller.rb new file mode 100644 index 00000000000..badd7671dcf --- /dev/null +++ b/app/controllers/projects/product_analytics_controller.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +class Projects::ProductAnalyticsController < Projects::ApplicationController + before_action :feature_enabled! + before_action :authorize_read_product_analytics! + before_action :tracker_variables, only: [:setup, :test] + + def index + @events = product_analytics_events.order_by_time.page(params[:page]) + end + + def setup + end + + def test + @event = product_analytics_events.try(:first) + end + + def graphs + @graphs = [] + @timerange = 30 + + requested_graphs = %w(platform os_timezone br_lang doc_charset) + + requested_graphs.each do |graph| + @graphs << ProductAnalytics::BuildGraphService + .new(project, { graph: graph, timerange: @timerange }) + .execute + end + end + + private + + def product_analytics_events + @project.product_analytics_events + end + + def tracker_variables + # We use project id as Snowplow appId + @project_id = @project.id.to_s + + # Snowplow remembers values like appId and platform between reloads. + # That is why we have to rename the tracker with a random integer. + @random = rand(999999) + + # Generate random platform every time a tracker is rendered. + @platform = %w(web mob app)[(@random % 3)] + end + + def feature_enabled! + render_404 unless Feature.enabled?(:product_analytics, @project, default_enabled: false) + end +end diff --git a/app/controllers/projects/prometheus/alerts_controller.rb b/app/controllers/projects/prometheus/alerts_controller.rb index 2c0521edece..c6ae65f7832 100644 --- a/app/controllers/projects/prometheus/alerts_controller.rb +++ b/app/controllers/projects/prometheus/alerts_controller.rb @@ -39,7 +39,7 @@ module Projects render json: serialize_as_json(@alert) else - head :no_content + head :bad_request end end @@ -49,7 +49,7 @@ module Projects render json: serialize_as_json(alert) else - head :no_content + head :bad_request end end @@ -59,14 +59,14 @@ module Projects head :ok else - head :no_content + head :bad_request end end private def alerts_params - params.permit(:operator, :threshold, :environment_id, :prometheus_metric_id) + params.permit(:operator, :threshold, :environment_id, :prometheus_metric_id, :runbook_url) end def notify_service diff --git a/app/controllers/projects/protected_refs_controller.rb b/app/controllers/projects/protected_refs_controller.rb index d9921757502..060403a9cd9 100644 --- a/app/controllers/projects/protected_refs_controller.rb +++ b/app/controllers/projects/protected_refs_controller.rb @@ -62,7 +62,7 @@ class Projects::ProtectedRefsController < Projects::ApplicationController end def access_level_attributes - %i[access_level id] + %i[access_level id _destroy] end end diff --git a/app/controllers/projects/releases_controller.rb b/app/controllers/projects/releases_controller.rb index d58755c2655..c48d573edbf 100644 --- a/app/controllers/projects/releases_controller.rb +++ b/app/controllers/projects/releases_controller.rb @@ -29,7 +29,7 @@ class Projects::ReleasesController < Projects::ApplicationController end def new - unless Feature.enabled?(:new_release_page, project) + unless Feature.enabled?(:new_release_page, project, default_enabled: true) redirect_to(new_project_tag_path(@project)) end end diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index 6b7e253595c..ca2a19e67b0 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -12,7 +12,6 @@ class Projects::ServicesController < Projects::ApplicationController before_action :set_deprecation_notice_for_prometheus_service, only: [:edit, :update] before_action :redirect_deprecated_prometheus_service, only: [:update] before_action only: :edit do - push_frontend_feature_flag(:integration_form_refactor, default_enabled: true) push_frontend_feature_flag(:jira_issues_integration, @project, { default_enabled: true }) end diff --git a/app/controllers/projects/settings/operations_controller.rb b/app/controllers/projects/settings/operations_controller.rb index d7a6f1b0139..781b850ddfe 100644 --- a/app/controllers/projects/settings/operations_controller.rb +++ b/app/controllers/projects/settings/operations_controller.rb @@ -6,10 +6,6 @@ module Projects before_action :authorize_admin_operations! before_action :authorize_read_prometheus_alerts!, only: [:reset_alerting_token] - before_action do - push_frontend_feature_flag(:pagerduty_webhook, project) - end - respond_to :json, only: [:reset_alerting_token, :reset_pagerduty_token] helper_method :error_tracking_setting @@ -49,7 +45,7 @@ module Projects if result[:status] == :success pagerduty_token = project.incident_management_setting&.pagerduty_token - webhook_url = project_incidents_pagerduty_url(project, token: pagerduty_token) + webhook_url = project_incidents_integrations_pagerduty_url(project, token: pagerduty_token) render json: { pagerduty_webhook_url: webhook_url, pagerduty_token: pagerduty_token } else diff --git a/app/controllers/projects/snippets/blobs_controller.rb b/app/controllers/projects/snippets/blobs_controller.rb index 148fc7c96f8..eaec8600d77 100644 --- a/app/controllers/projects/snippets/blobs_controller.rb +++ b/app/controllers/projects/snippets/blobs_controller.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true class Projects::Snippets::BlobsController < Projects::Snippets::ApplicationController - include Snippets::BlobsActions + include ::Snippets::BlobsActions end diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb index 49840e847f2..632e8db9796 100644 --- a/app/controllers/projects/snippets_controller.rb +++ b/app/controllers/projects/snippets_controller.rb @@ -14,6 +14,10 @@ class Projects::SnippetsController < Projects::Snippets::ApplicationController before_action :authorize_update_snippet!, only: [:edit, :update] before_action :authorize_admin_snippet!, only: [:destroy] + before_action do + push_frontend_feature_flag(:snippet_multiple_files, current_user) + end + def index @snippet_counts = ::Snippets::CountService .new(current_user, project: @project) diff --git a/app/controllers/projects/variables_controller.rb b/app/controllers/projects/variables_controller.rb index 2cc030d18fc..0fd047f90cf 100644 --- a/app/controllers/projects/variables_controller.rb +++ b/app/controllers/projects/variables_controller.rb @@ -12,7 +12,12 @@ class Projects::VariablesController < Projects::ApplicationController end def update - if @project.update(variables_params) + update_result = Ci::ChangeVariablesService.new( + container: @project, current_user: current_user, + params: variables_params + ).execute + + if update_result respond_to do |format| format.json { render_variables } end |