diff options
Diffstat (limited to 'app/controllers')
61 files changed, 337 insertions, 165 deletions
diff --git a/app/controllers/abuse_reports_controller.rb b/app/controllers/abuse_reports_controller.rb index 5e613c47fc5..9d1c68eea89 100644 --- a/app/controllers/abuse_reports_controller.rb +++ b/app/controllers/abuse_reports_controller.rb @@ -19,7 +19,7 @@ class AbuseReportsController < ApplicationController @abuse_report.notify message = _("Thank you for your report. A GitLab administrator will look into it shortly.") - redirect_to @abuse_report.user, notice: message + redirect_to root_path, notice: message else render :new end diff --git a/app/controllers/admin/appearances_controller.rb b/app/controllers/admin/application_settings/appearances_controller.rb index c2614a158b7..47b2356a60f 100644 --- a/app/controllers/admin/appearances_controller.rb +++ b/app/controllers/admin/application_settings/appearances_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Admin::AppearancesController < Admin::ApplicationController +class Admin::ApplicationSettings::AppearancesController < Admin::ApplicationController before_action :set_appearance, except: :create feature_category :navigation @@ -16,7 +16,7 @@ class Admin::AppearancesController < Admin::ApplicationController @appearance = Appearance.new(appearance_params) if @appearance.save - redirect_to admin_appearances_path, notice: _('Appearance was successfully created.') + redirect_to admin_application_settings_appearances_path, notice: _('Appearance was successfully created.') else render action: 'show' end @@ -24,7 +24,7 @@ class Admin::AppearancesController < Admin::ApplicationController def update if @appearance.update(appearance_params) - redirect_to admin_appearances_path, notice: _('Appearance was successfully updated.') + redirect_to admin_application_settings_appearances_path, notice: _('Appearance was successfully updated.') else render action: 'show' end @@ -35,21 +35,21 @@ class Admin::AppearancesController < Admin::ApplicationController @appearance.save - redirect_to admin_appearances_path, notice: _('Logo was successfully removed.') + redirect_to admin_application_settings_appearances_path, notice: _('Logo was successfully removed.') end def header_logos @appearance.remove_header_logo! @appearance.save - redirect_to admin_appearances_path, notice: _('Header logo was successfully removed.') + redirect_to admin_application_settings_appearances_path, notice: _('Header logo was successfully removed.') end def favicon @appearance.remove_favicon! @appearance.save - redirect_to admin_appearances_path, notice: _('Favicon was successfully removed.') + redirect_to admin_application_settings_appearances_path, notice: _('Favicon was successfully removed.') end private diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 80cb04ac496..5ddeb9630ba 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -253,7 +253,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController end def perform_update - successful = ApplicationSettings::UpdateService + successful = ::ApplicationSettings::UpdateService .new(@application_setting, current_user, application_setting_params) .execute diff --git a/app/controllers/admin/background_migrations_controller.rb b/app/controllers/admin/background_migrations_controller.rb new file mode 100644 index 00000000000..c1dffbf423d --- /dev/null +++ b/app/controllers/admin/background_migrations_controller.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +class Admin::BackgroundMigrationsController < Admin::ApplicationController + feature_category :database + + def index + @relations_by_tab = { + 'queued' => batched_migration_class.queued.queue_order, + 'failed' => batched_migration_class.failed.queue_order, + 'finished' => batched_migration_class.finished.queue_order.reverse_order + } + + @current_tab = @relations_by_tab.key?(params[:tab]) ? params[:tab] : 'queued' + @migrations = @relations_by_tab[@current_tab].page(params[:page]) + @successful_rows_counts = batched_migration_class.successful_rows_counts(@migrations.map(&:id)) + end + + private + + def batched_migration_class + Gitlab::Database::BackgroundMigration::BatchedMigration + end +end diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 46e5a508a1b..ba24e3e619b 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -15,7 +15,7 @@ class Admin::DashboardController < Admin::ApplicationController @groups = Group.order_id_desc.with_route.limit(10) @notices = Gitlab::ConfigChecker::PumaRuggedChecker.check @notices += Gitlab::ConfigChecker::ExternalDatabaseChecker.check - @redis_versions = [Gitlab::Redis::Queues, Gitlab::Redis::SharedState, Gitlab::Redis::Cache].map(&:version).uniq + @redis_versions = [Gitlab::Redis::Queues, Gitlab::Redis::SharedState, Gitlab::Redis::Cache, Gitlab::Redis::TraceChunks].map(&:version).uniq end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/controllers/admin/groups_controller.rb b/app/controllers/admin/groups_controller.rb index 5b33ee78e8c..9abb244bc92 100644 --- a/app/controllers/admin/groups_controller.rb +++ b/app/controllers/admin/groups_controller.rb @@ -62,7 +62,7 @@ class Admin::GroupsController < Admin::ApplicationController def members_update member_params = params.permit(:user_ids, :access_level, :expires_at) - result = Members::CreateService.new(current_user, member_params.merge(limit: -1, source: @group)).execute + result = Members::CreateService.new(current_user, member_params.merge(limit: -1, source: @group, invite_source: 'admin-group-page')).execute if result[:status] == :success redirect_to [:admin, @group], notice: _('Users were successfully added.') diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index 40ec68c1d46..bf9cfa3acff 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -4,6 +4,9 @@ class Admin::RunnersController < Admin::ApplicationController include RunnerSetupScripts before_action :runner, except: [:index, :tag_list, :runner_setup_scripts] + before_action only: [:index] do + push_frontend_feature_flag(:runner_list_view_vue_ui, current_user, default_enabled: :yaml) + end feature_category :continuous_integration diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 2e9229db56c..e397ecbadaf 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -209,6 +209,9 @@ class Admin::UsersController < Admin::ApplicationController user_params_with_pass.merge!(password_params) end + cc_validation_params = process_credit_card_validation_params(user_params_with_pass.delete(:credit_card_validation_attributes)) + user_params_with_pass.merge!(cc_validation_params) + respond_to do |format| result = Users::UpdateService.new(current_user, user_params_with_pass.merge(user: user)).execute do |user| user.skip_reconfirmation! @@ -253,6 +256,27 @@ class Admin::UsersController < Admin::ApplicationController protected + def process_credit_card_validation_params(cc_validation_params) + return unless cc_validation_params && cc_validation_params[:credit_card_validated_at] + + cc_validation = cc_validation_params[:credit_card_validated_at] + + if cc_validation == "1" && !user.credit_card_validated_at + { + credit_card_validation_attributes: { + credit_card_validated_at: Time.zone.now + } + } + + elsif cc_validation == "0" && user.credit_card_validated_at + { + credit_card_validation_attributes: { + _destroy: true + } + } + end + end + def paginate_without_count? counts = Gitlab::Database::Count.approximate_counts([User]) @@ -330,7 +354,8 @@ class Admin::UsersController < Admin::ApplicationController :twitter, :username, :website_url, - :note + :note, + credit_card_validation_attributes: [:credit_card_validated_at] ] end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 00b9fb1060d..07ecde1181f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -263,7 +263,6 @@ class ApplicationController < ActionController::Base headers['X-XSS-Protection'] = '1; mode=block' headers['X-UA-Compatible'] = 'IE=edge' headers['X-Content-Type-Options'] = 'nosniff' - headers[Gitlab::Metrics::RequestsRackMiddleware::FEATURE_CATEGORY_HEADER] = feature_category end def default_cache_headers @@ -456,19 +455,17 @@ class ApplicationController < ActionController::Base end def set_current_context(&block) - Gitlab::ApplicationContext.with_context( - # Avoid loading the auth_user again after the request. Otherwise calling - # `auth_user` again would also trigger the Warden callbacks again - user: -> { auth_user if strong_memoized?(:auth_user) }, + Gitlab::ApplicationContext.push( + user: -> { context_user }, 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 - @current_context = Gitlab::ApplicationContext.current - end + feature_category: feature_category + ) + yield + ensure + @current_context = Gitlab::ApplicationContext.current end def set_locale(&block) @@ -542,6 +539,12 @@ class ApplicationController < ActionController::Base end end + # Avoid loading the auth_user again after the request. Otherwise calling + # `auth_user` again would also trigger the Warden callbacks again + def context_user + auth_user if strong_memoized?(:auth_user) + end + def caller_id "#{self.class.name}##{action_name}" end diff --git a/app/controllers/clusters/applications_controller.rb b/app/controllers/clusters/applications_controller.rb index c533fe007d7..91003e9580d 100644 --- a/app/controllers/clusters/applications_controller.rb +++ b/app/controllers/clusters/applications_controller.rb @@ -47,7 +47,7 @@ class Clusters::ApplicationsController < Clusters::BaseController end def cluster_application_params - params.permit(:application, :hostname, :pages_domain_id, :email, :stack, :modsecurity_enabled, :modsecurity_mode, :host, :port, :protocol, :waf_log_enabled, :cilium_log_enabled) + params.permit(:application, :hostname, :pages_domain_id, :email, :stack, :host, :port, :protocol) end def cluster_application_destroy_params diff --git a/app/controllers/concerns/creates_commit.rb b/app/controllers/concerns/creates_commit.rb index 7bfcda67aa2..0fb77e2aaf4 100644 --- a/app/controllers/concerns/creates_commit.rb +++ b/app/controllers/concerns/creates_commit.rb @@ -18,7 +18,7 @@ module CreatesCommit @start_branch ||= @ref || @branch_name - start_project = Feature.enabled?(:pick_into_project, @project, default_enabled: :yaml) ? @project_to_commit_into : @project + start_project = @project_to_commit_into commit_params = @commit_params.merge( start_project: start_project, diff --git a/app/controllers/concerns/integrations_actions.rb b/app/controllers/concerns/integrations_actions.rb index 09087257888..f1fa5c845e2 100644 --- a/app/controllers/concerns/integrations_actions.rb +++ b/app/controllers/concerns/integrations_actions.rb @@ -48,12 +48,11 @@ module IntegrationsActions private - # rubocop: disable Gitlab/ModuleWithInstanceVariables + # rubocop:disable Gitlab/ModuleWithInstanceVariables def integration @integration ||= find_or_initialize_non_project_specific_integration(params[:id]) - @service ||= @integration # TODO: remove references to @service https://gitlab.com/gitlab-org/gitlab/-/issues/329759 end - # rubocop: enable Gitlab/ModuleWithInstanceVariables + # rubocop:enable Gitlab/ModuleWithInstanceVariables def success_message if integration.active? diff --git a/app/controllers/concerns/membership_actions.rb b/app/controllers/concerns/membership_actions.rb index 20861afbb88..8fd4e98d557 100644 --- a/app/controllers/concerns/membership_actions.rb +++ b/app/controllers/concerns/membership_actions.rb @@ -6,7 +6,7 @@ module MembershipActions def create create_params = params.permit(:user_ids, :access_level, :expires_at) - result = Members::CreateService.new(current_user, create_params.merge({ source: membershipable })).execute + result = Members::CreateService.new(current_user, create_params.merge({ source: membershipable, invite_source: "#{plain_source_type}-members-page" })).execute if result[:status] == :success redirect_to members_page_url, notice: _('Users were successfully added.') @@ -108,7 +108,7 @@ module MembershipActions respond_to do |format| format.html do - redirect_path = member.request? ? member.source : [:dashboard, membershipable.class.to_s.tableize] + redirect_path = member.request? ? member.source : [:dashboard, membershipable.class.to_s.tableize.to_sym] redirect_to redirect_path, notice: notice end @@ -140,39 +140,19 @@ module MembershipActions end def root_params_key - case membershipable - when Namespace - :group_member - when Project - :project_member - else - raise "Unknown membershipable type: #{membershipable}!" - end + raise NotImplementedError end def members_page_url - case membershipable - when Namespace - polymorphic_url([membershipable, :members]) - when Project - project_project_members_path(membershipable) - else - raise "Unknown membershipable type: #{membershipable}!" - end + raise NotImplementedError end def source_type - @source_type ||= - begin - case membershipable - when Namespace - _("group") - when Project - _("project") - else - raise "Unknown membershipable type: #{membershipable}!" - end - end + raise NotImplementedError + end + + def plain_source_type + raise NotImplementedError end def requested_relations diff --git a/app/controllers/concerns/wiki_actions.rb b/app/controllers/concerns/wiki_actions.rb index fc4f9aa3409..b7f6691ef4b 100644 --- a/app/controllers/concerns/wiki_actions.rb +++ b/app/controllers/concerns/wiki_actions.rb @@ -177,7 +177,7 @@ module WikiActions redirect_to wiki_path(wiki), status: :found else - @error = response + @error = response.message render 'shared/wikis/edit' end end diff --git a/app/controllers/concerns/with_performance_bar.rb b/app/controllers/concerns/with_performance_bar.rb index dc2265e063a..adfad4de4dd 100644 --- a/app/controllers/concerns/with_performance_bar.rb +++ b/app/controllers/concerns/with_performance_bar.rb @@ -20,12 +20,11 @@ module WithPerformanceBar end def cookie_or_default_value - cookie_enabled = if cookies[:perf_bar_enabled].present? - cookies[:perf_bar_enabled] == 'true' - else - cookies[:perf_bar_enabled] = 'true' if Rails.env.development? - end + if cookies[:perf_bar_enabled].blank? && Rails.env.development? + cookies[:perf_bar_enabled] = 'true' + end + cookie_enabled = cookies[:perf_bar_enabled] == 'true' cookie_enabled && Gitlab::PerformanceBar.allowed_for_user?(current_user) end end diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index e82500912fa..560369a8de4 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -13,7 +13,7 @@ class ConfirmationsController < Devise::ConfirmationsController protected def after_resending_confirmation_instructions_path_for(resource) - return users_almost_there_path unless Feature.enabled?(:soft_email_confirmation) + return users_almost_there_path(email: resource.email) unless Feature.enabled?(:soft_email_confirmation) stored_location_for(resource) || dashboard_projects_path end @@ -34,6 +34,10 @@ class ConfirmationsController < Devise::ConfirmationsController def after_sign_in(resource) after_sign_in_path_for(resource) end + + def context_user + resource + end end ConfirmationsController.prepend_mod_with('ConfirmationsController') diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index 7cb39625371..01bb930a51b 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -36,7 +36,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController # rubocop: disable CodeReuse/ActiveRecord def starred @projects = load_projects(params.merge(starred: true)) - .includes(:forked_from_project, :tags) + .includes(:forked_from_project, :topics) @groups = [] diff --git a/app/controllers/groups/boards_controller.rb b/app/controllers/groups/boards_controller.rb index e1f09d73739..3d8cdd766bf 100644 --- a/app/controllers/groups/boards_controller.rb +++ b/app/controllers/groups/boards_controller.rb @@ -8,7 +8,9 @@ class Groups::BoardsController < Groups::ApplicationController before_action :assign_endpoint_vars before_action do push_frontend_feature_flag(:graphql_board_lists, group, default_enabled: false) + push_frontend_feature_flag(:board_multi_select, group, default_enabled: :yaml) push_frontend_feature_flag(:swimlanes_buffered_rendering, group, default_enabled: :yaml) + push_frontend_feature_flag(:iteration_cadences, group, default_enabled: :yaml) end feature_category :boards diff --git a/app/controllers/groups/email_campaigns_controller.rb b/app/controllers/groups/email_campaigns_controller.rb index c1e3ce519cc..d4c7b31c4b8 100644 --- a/app/controllers/groups/email_campaigns_controller.rb +++ b/app/controllers/groups/email_campaigns_controller.rb @@ -16,7 +16,7 @@ class Groups::EmailCampaignsController < Groups::ApplicationController def track_click if Gitlab.com? - message = Gitlab::Email::Message::InProductMarketing.for(@track).new(group: group, series: @series) + message = Gitlab::Email::Message::InProductMarketing.for(@track).new(group: group, user: current_user, series: @series) data = { namespace_id: group.id, @@ -26,7 +26,7 @@ class Groups::EmailCampaignsController < Groups::ApplicationController } context = SnowplowTracker::SelfDescribingJson.new(EMAIL_CAMPAIGNS_SCHEMA_URL, data) - ::Gitlab::Tracking.event(self.class.name, 'click', context: [context]) + ::Gitlab::Tracking.event(self.class.name, 'click', context: [context], user: current_user, namespace: group) else ::Users::InProductMarketingEmail.save_cta_click(current_user, @track, @series) end @@ -58,8 +58,9 @@ class Groups::EmailCampaignsController < Groups::ApplicationController @series = params[:series]&.to_i track_valid = @track.in?(Namespaces::InProductMarketingEmailsService::TRACKS.keys) - series_valid = @series.in?(0..Namespaces::InProductMarketingEmailsService::INTERVAL_DAYS.size - 1) + return render_404 unless track_valid - render_404 unless track_valid && series_valid + series_valid = @series.in?(0..Namespaces::InProductMarketingEmailsService::TRACKS[@track][:interval_days].size - 1) + render_404 unless series_valid end end diff --git a/app/controllers/groups/group_links_controller.rb b/app/controllers/groups/group_links_controller.rb index 3b775af9722..0655d779a4e 100644 --- a/app/controllers/groups/group_links_controller.rb +++ b/app/controllers/groups/group_links_controller.rb @@ -11,8 +11,8 @@ class Groups::GroupLinksController < Groups::ApplicationController if shared_with_group result = Groups::GroupLinks::CreateService - .new(shared_with_group, current_user, group_link_create_params) - .execute(group) + .new(group, shared_with_group, current_user, group_link_create_params) + .execute return render_404 if result[:http_status] == 404 diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index c2ac56ccc63..8d9059d271f 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -25,7 +25,6 @@ class Groups::GroupMembersController < Groups::ApplicationController helper_method :can_manage_members? def index - preload_max_access @sort = params[:sort].presence || sort_value_name @members = GroupMembersFinder @@ -54,14 +53,6 @@ class Groups::GroupMembersController < Groups::ApplicationController private - def preload_max_access - return unless current_user - - # this allows the can? against admin type queries in this action to - # only perform the query once, even if it is cached - current_user.max_access_for_group[@group.id] = @group.max_member_access(current_user) - end - def can_manage_members? strong_memoize(:can_manage_members) do can?(current_user, :admin_group_member, @group) @@ -87,6 +78,22 @@ class Groups::GroupMembersController < Groups::ApplicationController def membershipable_members group.members end + + def plain_source_type + 'group' + end + + def source_type + _("group") + end + + def members_page_url + polymorphic_url([group, :members]) + end + + def root_params_key + :group_member + end end Groups::GroupMembersController.prepend_mod_with('Groups::GroupMembersController') diff --git a/app/controllers/groups/registry/repositories_controller.rb b/app/controllers/groups/registry/repositories_controller.rb index d914e0bffc6..3aaaf6ade6b 100644 --- a/app/controllers/groups/registry/repositories_controller.rb +++ b/app/controllers/groups/registry/repositories_controller.rb @@ -17,7 +17,7 @@ module Groups .execute .with_api_entity_associations - track_package_event(:list_repositories, :container) + track_package_event(:list_repositories, :container, user: current_user, namespace: group) serializer = ContainerRepositoriesSerializer .new(current_user: current_user) diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index a755d242d4a..66816d4c587 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -33,6 +33,7 @@ class GroupsController < Groups::ApplicationController before_action do push_frontend_feature_flag(:vue_issuables_list, @group) + push_frontend_feature_flag(:iteration_cadences, @group, default_enabled: :yaml) end before_action :export_rate_limit, only: [:export, :download_export] @@ -182,7 +183,12 @@ class GroupsController < Groups::ApplicationController def download_export if @group.export_file_exists? - send_upload(@group.export_file, attachment: @group.export_file.filename) + if @group.export_archive_exists? + send_upload(@group.export_file, attachment: @group.export_file.filename) + else + redirect_to edit_group_path(@group), + alert: _('The file containing the export is not available yet; it may still be transferring. Please try again later.') + end else redirect_to edit_group_path(@group), alert: _('Group export link has expired. Please generate a new export from your group settings.') @@ -264,7 +270,8 @@ class GroupsController < Groups::ApplicationController :default_branch_protection, :default_branch_name, :allow_mfa_for_subgroups, - :resource_access_token_creation_allowed + :resource_access_token_creation_allowed, + :prevent_sharing_groups_outside_hierarchy ] end diff --git a/app/controllers/health_controller.rb b/app/controllers/health_controller.rb index c6a02250896..99b0b775217 100644 --- a/app/controllers/health_controller.rb +++ b/app/controllers/health_controller.rb @@ -15,6 +15,7 @@ class HealthController < ActionController::Base Gitlab::HealthChecks::Redis::CacheCheck, Gitlab::HealthChecks::Redis::QueuesCheck, Gitlab::HealthChecks::Redis::SharedStateCheck, + Gitlab::HealthChecks::Redis::TraceChunksCheck, Gitlab::HealthChecks::GitalyCheck ].freeze diff --git a/app/controllers/import/bulk_imports_controller.rb b/app/controllers/import/bulk_imports_controller.rb index 48635c933af..9d6c0a003c4 100644 --- a/app/controllers/import/bulk_imports_controller.rb +++ b/app/controllers/import/bulk_imports_controller.rb @@ -10,7 +10,7 @@ class Import::BulkImportsController < ApplicationController POLLING_INTERVAL = 3_000 - rescue_from BulkImports::Clients::Http::ConnectionError, with: :bulk_import_connection_error + rescue_from BulkImports::Clients::HTTP::ConnectionError, with: :bulk_import_connection_error def configure session[access_token_key] = configure_params[access_token_key]&.strip @@ -78,7 +78,7 @@ class Import::BulkImportsController < ApplicationController def query_params query_params = { top_level_only: true, - min_access_level: Gitlab::Access::MAINTAINER + min_access_level: Gitlab::Access::OWNER } query_params[:search] = sanitized_filter_param if sanitized_filter_param @@ -86,7 +86,7 @@ class Import::BulkImportsController < ApplicationController end def client - @client ||= BulkImports::Clients::Http.new( + @client ||= BulkImports::Clients::HTTP.new( uri: session[url_key], token: session[access_token_key], per_page: params[:per_page], diff --git a/app/controllers/jira_connect/app_descriptor_controller.rb b/app/controllers/jira_connect/app_descriptor_controller.rb index fee8b43aa6b..0de42ad2452 100644 --- a/app/controllers/jira_connect/app_descriptor_controller.rb +++ b/app/controllers/jira_connect/app_descriptor_controller.rb @@ -40,7 +40,7 @@ class JiraConnect::AppDescriptorController < JiraConnect::ApplicationController private HOME_URL = 'https://gitlab.com' - DOC_URL = 'https://docs.gitlab.com/ee/user/project/integrations/jira.html#gitlab-jira-integration' + DOC_URL = 'https://docs.gitlab.com/ee/integration/jira/' def modules modules = { diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 31f404a9974..9d7a1712698 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -287,6 +287,10 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController def fail_admin_mode_invalid_credentials redirect_to new_admin_session_path, alert: _('Invalid login or password') end + + def context_user + current_user + end end OmniauthCallbacksController.prepend_mod_with('OmniauthCallbacksController') diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index 2c0ed825daa..c764f2d0459 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -67,6 +67,10 @@ class PasswordsController < Devise::PasswordsController redirect_to new_user_session_path, notice: I18n.t('devise.passwords.send_paranoid_instructions') end + + def context_user + resource + end end PasswordsController.prepend_mod_with('PasswordsController') diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index afebeafff7c..505608779ec 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -67,7 +67,7 @@ class ProfilesController < Profiles::ApplicationController .order("created_at DESC") .page(params[:page]) - Gitlab::Tracking.event(self.class.name, 'search_audit_event') + Gitlab::Tracking.event(self.class.name, 'search_audit_event', user: current_user) end # rubocop: enable CodeReuse/ActiveRecord @@ -127,6 +127,7 @@ class ProfilesController < Profiles::ApplicationController :include_private_contributions, :timezone, :job_title, + :pronouns, status: [:emoji, :message, :availability] ) end diff --git a/app/controllers/projects/alert_management_controller.rb b/app/controllers/projects/alert_management_controller.rb index ebe867d915d..34f9f361e43 100644 --- a/app/controllers/projects/alert_management_controller.rb +++ b/app/controllers/projects/alert_management_controller.rb @@ -3,6 +3,10 @@ class Projects::AlertManagementController < Projects::ApplicationController before_action :authorize_read_alert_management_alert! + before_action(only: [:index]) do + push_frontend_feature_flag(:managed_alerts_deprecation, @project, default_enabled: :yaml) + end + feature_category :incident_management def index diff --git a/app/controllers/projects/analytics/cycle_analytics/summary_controller.rb b/app/controllers/projects/analytics/cycle_analytics/summary_controller.rb new file mode 100644 index 00000000000..c51a5ac7b88 --- /dev/null +++ b/app/controllers/projects/analytics/cycle_analytics/summary_controller.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class Projects::Analytics::CycleAnalytics::SummaryController < Projects::ApplicationController + include CycleAnalyticsParams + + respond_to :json + + feature_category :planning_analytics + + before_action :authorize_read_cycle_analytics! + + def show + render json: project_level.summary + end + + private + + def project_level + @project_level ||= Analytics::CycleAnalytics::ProjectLevel.new(project: @project, options: options(allowed_params)) + end + + def allowed_params + params.permit(:created_after, :created_before) + end +end + +Projects::Analytics::CycleAnalytics::SummaryController.prepend_mod_with('Projects::Analytics::CycleAnalytics::SummaryController') diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index dbe628cb43a..c6c9237292d 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -39,6 +39,7 @@ class Projects::BlobController < Projects::ApplicationController before_action do push_frontend_feature_flag(:refactor_blob_viewer, @project, default_enabled: :yaml) + push_frontend_feature_flag(:consolidated_edit_button, @project, default_enabled: :yaml) end def new @@ -92,7 +93,7 @@ class Projects::BlobController < Projects::ApplicationController @blob.load_all_data! diffy = Diffy::Diff.new(@blob.data, @content, diff: '-U 3', include_diff_info: true) diff_lines = diffy.diff.scan(/.*\n/)[2..-1] - diff_lines = Gitlab::Diff::Parser.new.parse(diff_lines) + diff_lines = Gitlab::Diff::Parser.new.parse(diff_lines).to_a @diff_lines = Gitlab::Diff::Highlight.new(diff_lines, repository: @repository).highlight render layout: false diff --git a/app/controllers/projects/boards_controller.rb b/app/controllers/projects/boards_controller.rb index 9a3e9437426..43c9046f850 100644 --- a/app/controllers/projects/boards_controller.rb +++ b/app/controllers/projects/boards_controller.rb @@ -9,6 +9,8 @@ class Projects::BoardsController < Projects::ApplicationController before_action do push_frontend_feature_flag(:swimlanes_buffered_rendering, project, default_enabled: :yaml) push_frontend_feature_flag(:graphql_board_lists, project, default_enabled: :yaml) + push_frontend_feature_flag(:board_multi_select, project, default_enabled: :yaml) + push_frontend_feature_flag(:iteration_cadences, project&.group, default_enabled: :yaml) end feature_category :boards diff --git a/app/controllers/projects/branches_controller.rb b/app/controllers/projects/branches_controller.rb index 5006aa75ce5..3be10559e80 100644 --- a/app/controllers/projects/branches_controller.rb +++ b/app/controllers/projects/branches_controller.rb @@ -152,7 +152,7 @@ class Projects::BranchesController < Projects::ApplicationController ref_escaped = strip_tags(sanitize(params[:ref])) Addressable::URI.unescape(ref_escaped) else - @project.default_branch || 'master' + @project.default_branch_or_main end end @@ -185,18 +185,12 @@ class Projects::BranchesController < Projects::ApplicationController # Here we get one more branch to indicate if there are more data we're not showing limit = @overview_max_branches + 1 - if Feature.enabled?(:branch_list_keyset_pagination, project, default_enabled: :yaml) - @active_branches = - BranchesFinder.new(@repository, { per_page: limit, sort: sort_value_recently_updated }) - .execute(gitaly_pagination: true).select(&:active?) - @stale_branches = - BranchesFinder.new(@repository, { per_page: limit, sort: sort_value_oldest_updated }) - .execute(gitaly_pagination: true).select(&:stale?) - else - @active_branches, @stale_branches = BranchesFinder.new(@repository, sort: sort_value_recently_updated).execute.partition(&:active?) - @active_branches = @active_branches.first(limit) - @stale_branches = @stale_branches.first(limit) - end + @active_branches = + BranchesFinder.new(@repository, { per_page: limit, sort: sort_value_recently_updated }) + .execute(gitaly_pagination: true).select(&:active?) + @stale_branches = + BranchesFinder.new(@repository, { per_page: limit, sort: sort_value_oldest_updated }) + .execute(gitaly_pagination: true).select(&:stale?) @branches = @active_branches + @stale_branches end diff --git a/app/controllers/projects/ci/pipeline_editor_controller.rb b/app/controllers/projects/ci/pipeline_editor_controller.rb index 6e31816bc99..ed1d5ca9594 100644 --- a/app/controllers/projects/ci/pipeline_editor_controller.rb +++ b/app/controllers/projects/ci/pipeline_editor_controller.rb @@ -6,6 +6,7 @@ class Projects::Ci::PipelineEditorController < Projects::ApplicationController push_frontend_feature_flag(:pipeline_editor_empty_state_action, @project, default_enabled: :yaml) push_frontend_feature_flag(:pipeline_editor_branch_switcher, @project, default_enabled: :yaml) push_frontend_feature_flag(:pipeline_editor_drawer, @project, default_enabled: :yaml) + push_frontend_feature_flag(:schema_linting, @project, default_enabled: :yaml) end feature_category :pipeline_authoring diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index 863715429ff..3d2398f7ee3 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -19,9 +19,6 @@ class Projects::CommitController < Projects::ApplicationController before_action :define_commit_box_vars, only: [:show, :pipelines] before_action :define_note_vars, only: [:show, :diff_for_path, :diff_files] before_action :authorize_edit_tree!, only: [:revert, :cherry_pick] - before_action do - push_frontend_feature_flag(:pick_into_project, @project, default_enabled: :yaml) - end BRANCH_SEARCH_LIMIT = 1000 COMMIT_DIFFS_PER_PAGE = 20 @@ -220,7 +217,6 @@ class Projects::CommitController < Projects::ApplicationController def find_cherry_pick_target_project return @project if params[:target_project_id].blank? - return @project unless Feature.enabled?(:pick_into_project, @project, default_enabled: :yaml) MergeRequestTargetProjectFinder .new(current_user: current_user, source_project: @project, project_feature: :repository) diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 28a87f83451..edf45e7063a 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -79,11 +79,11 @@ class Projects::CompareController < Projects::ApplicationController private def validate_refs! - valid = [head_ref, start_ref].map { |ref| valid_ref?(ref) } + invalid = [head_ref, start_ref].filter { |ref| !valid_ref?(ref) } - return if valid.all? + return if invalid.empty? - flash[:alert] = "Invalid branch name" + flash[:alert] = "Invalid branch name(s): #{invalid.join(', ')}" redirect_to project_compare_index_path(source_project) end diff --git a/app/controllers/projects/cycle_analytics/events_controller.rb b/app/controllers/projects/cycle_analytics/events_controller.rb index 3a5dd23047c..a1da8d4e91f 100644 --- a/app/controllers/projects/cycle_analytics/events_controller.rb +++ b/app/controllers/projects/cycle_analytics/events_controller.rb @@ -53,7 +53,7 @@ module Projects end def cycle_analytics - @cycle_analytics ||= ::CycleAnalytics::ProjectLevel.new(project, options: options(cycle_analytics_project_params)) + @cycle_analytics ||= ::Analytics::CycleAnalytics::ProjectLevel.new(project: project, options: options(cycle_analytics_project_params)) end end end diff --git a/app/controllers/projects/cycle_analytics_controller.rb b/app/controllers/projects/cycle_analytics_controller.rb index 5c15a5d246c..d1d27286c68 100644 --- a/app/controllers/projects/cycle_analytics_controller.rb +++ b/app/controllers/projects/cycle_analytics_controller.rb @@ -14,7 +14,7 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController feature_category :planning_analytics def show - @cycle_analytics = ::CycleAnalytics::ProjectLevel.new(@project, options: options(cycle_analytics_project_params)) + @cycle_analytics = Analytics::CycleAnalytics::ProjectLevel.new(project: @project, options: options(cycle_analytics_project_params)) respond_to do |format| format.html do diff --git a/app/controllers/projects/feature_flags_controller.rb b/app/controllers/projects/feature_flags_controller.rb index 6b6606c4f41..a59824b1085 100644 --- a/app/controllers/projects/feature_flags_controller.rb +++ b/app/controllers/projects/feature_flags_controller.rb @@ -11,6 +11,7 @@ class Projects::FeatureFlagsController < Projects::ApplicationController before_action :feature_flag, only: [:edit, :update, :destroy] before_action :ensure_flag_writable!, only: [:update] + before_action :exclude_legacy_flags_check, only: [:edit] before_action do push_frontend_feature_flag(:feature_flag_permissions) @@ -107,6 +108,12 @@ class Projects::FeatureFlagsController < Projects::ApplicationController end end + def exclude_legacy_flags_check + if feature_flag.legacy_flag? + not_found + end + end + def create_params params.require(:operations_feature_flag) .permit(:name, :description, :active, :version, diff --git a/app/controllers/projects/feature_flags_user_lists_controller.rb b/app/controllers/projects/feature_flags_user_lists_controller.rb index 7be3254e966..fd81321924a 100644 --- a/app/controllers/projects/feature_flags_user_lists_controller.rb +++ b/app/controllers/projects/feature_flags_user_lists_controller.rb @@ -6,6 +6,9 @@ class Projects::FeatureFlagsUserListsController < Projects::ApplicationControlle feature_category :feature_flags + def index + end + def new end diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index 8fa3635a737..9e42d218ceb 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -56,7 +56,13 @@ class Projects::ForksController < Projects::ApplicationController can_fork_to?(current_user.namespace) render json: { - namespaces: ForkNamespaceSerializer.new.represent(namespaces, project: project, current_user: current_user, memberships: memberships_hash) + namespaces: ForkNamespaceSerializer.new.represent( + namespaces, + project: project, + current_user: current_user, + memberships: memberships_hash, + forked_projects: forked_projects_by_namespace(namespaces) + ) } end end @@ -129,6 +135,10 @@ class Projects::ForksController < Projects::ApplicationController def memberships_hash current_user.members.where(source: load_namespaces_with_associations).index_by(&:source_id) end + + def forked_projects_by_namespace(namespaces) + project.forks.where(namespace: namespaces).includes(:namespace).index_by(&:namespace_id) + end end Projects::ForksController.prepend_mod_with('Projects::ForksController') diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 01a6de76ba5..295213bd38c 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -46,6 +46,7 @@ class Projects::IssuesController < Projects::ApplicationController push_frontend_feature_flag(:usage_data_design_action, project, default_enabled: true) push_frontend_feature_flag(:improved_emoji_picker, project, default_enabled: :yaml) push_frontend_feature_flag(:vue_issues_list, project) + push_frontend_feature_flag(:iteration_cadences, project&.group, default_enabled: :yaml) end before_action only: :show do @@ -55,6 +56,7 @@ class Projects::IssuesController < Projects::ApplicationController push_to_gon_attributes(:features, real_time_feature_flag, real_time_enabled) push_frontend_feature_flag(:confidential_notes, @project, default_enabled: :yaml) push_frontend_feature_flag(:issue_assignees_widget, @project, default_enabled: :yaml) + push_frontend_feature_flag(:labels_widget, @project, default_enabled: :yaml) experiment(:invite_members_in_comment, namespace: @project.root_ancestor) do |experiment_instance| experiment_instance.exclude! unless helpers.can_import_members? @@ -160,7 +162,7 @@ class Projects::IssuesController < Projects::ApplicationController new_project = Project.find(params[:move_to_project_id]) return render_404 unless issue.can_move?(current_user, new_project) - @issue = ::Issues::UpdateService.new(project: project, current_user: current_user, params: { target_project: new_project }).execute(issue) + @issue = ::Issues::MoveService.new(project: project, current_user: current_user).execute(issue, new_project) end respond_to do |format| diff --git a/app/controllers/projects/merge_requests/conflicts_controller.rb b/app/controllers/projects/merge_requests/conflicts_controller.rb index 011ac9a42f8..a8038878504 100644 --- a/app/controllers/projects/merge_requests/conflicts_controller.rb +++ b/app/controllers/projects/merge_requests/conflicts_controller.rb @@ -9,6 +9,7 @@ class Projects::MergeRequests::ConflictsController < Projects::MergeRequests::Ap respond_to do |format| format.html do @issuable_sidebar = serializer.represent(@merge_request, serializer: 'sidebar') + Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_loading_conflict_ui_action(user: current_user) end format.json do @@ -42,6 +43,8 @@ class Projects::MergeRequests::ConflictsController < Projects::MergeRequests::Ap def resolve_conflicts return render_404 unless @conflicts_list.can_be_resolved_in_ui? + Gitlab::UsageDataCounters::MergeRequestActivityUniqueCounter.track_resolve_conflict_action(user: current_user) + if @merge_request.can_be_merged? render status: :bad_request, json: { message: _('The merge conflicts for this merge request have already been resolved.') } return diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 613faa200d1..5958c7f66e5 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -43,6 +43,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo push_frontend_feature_flag(:usage_data_i_testing_summary_widget_total, @project, default_enabled: :yaml) push_frontend_feature_flag(:improved_emoji_picker, project, default_enabled: :yaml) push_frontend_feature_flag(:diffs_virtual_scrolling, project, default_enabled: :yaml) + push_frontend_feature_flag(:codequality_mr_diff_annotations, project, default_enabled: :yaml) # Usage data feature flags push_frontend_feature_flag(:users_expanding_widgets_usage_data, @project, default_enabled: :yaml) diff --git a/app/controllers/projects/metrics_dashboard_controller.rb b/app/controllers/projects/metrics_dashboard_controller.rb index 3f10749602e..89c99a5fd5a 100644 --- a/app/controllers/projects/metrics_dashboard_controller.rb +++ b/app/controllers/projects/metrics_dashboard_controller.rb @@ -12,6 +12,7 @@ module Projects before_action do push_frontend_feature_flag(:prometheus_computed_alerts) push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate) + push_frontend_feature_flag(:managed_alerts_deprecation, @project, default_enabled: :yaml) end feature_category :metrics diff --git a/app/controllers/projects/packages/infrastructure_registry_controller.rb b/app/controllers/projects/packages/infrastructure_registry_controller.rb index 22ae1d65013..ee04cbb0062 100644 --- a/app/controllers/projects/packages/infrastructure_registry_controller.rb +++ b/app/controllers/projects/packages/infrastructure_registry_controller.rb @@ -3,7 +3,19 @@ module Projects module Packages class InfrastructureRegistryController < Projects::ApplicationController + before_action :verify_feature_enabled! feature_category :infrastructure_as_code + + def show + @package = project.packages.find(params[:id]) + @package_files = @package.package_files.recent + end + + private + + def verify_feature_enabled! + render_404 unless Feature.enabled?(:infrastructure_registry_page, default_enabled: :yaml) + end end end end diff --git a/app/controllers/projects/pipeline_schedules_controller.rb b/app/controllers/projects/pipeline_schedules_controller.rb index 4af7508b935..006cb8a2201 100644 --- a/app/controllers/projects/pipeline_schedules_controller.rb +++ b/app/controllers/projects/pipeline_schedules_controller.rb @@ -10,6 +10,10 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController before_action :authorize_update_pipeline_schedule!, except: [:index, :new, :create, :play] before_action :authorize_admin_pipeline_schedule!, only: [:destroy] + before_action do + push_frontend_feature_flag(:ci_daily_limit_for_pipeline_schedules, @project, default_enabled: :yaml) + end + feature_category :continuous_integration # rubocop: disable CodeReuse/ActiveRecord diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index 0de8dc597ae..7779f3c3b65 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -49,26 +49,9 @@ class Projects::PipelinesController < Projects::ApplicationController respond_to do |format| format.html do - experiment(:pipeline_empty_state_templates, actor: current_user) do |e| - e.exclude! unless current_user - e.exclude! if @pipelines_count.to_i > 0 - e.exclude! if helpers.has_gitlab_ci?(project) - - e.use {} - e.try {} - e.track(:view, value: project.namespace_id) - end - experiment(:code_quality_walkthrough, namespace: project.root_ancestor) do |e| - e.exclude! unless current_user - e.exclude! unless can?(current_user, :create_pipeline, project) - e.exclude! unless project.root_ancestor.recent? - e.exclude! if @pipelines_count.to_i > 0 - e.exclude! if helpers.has_gitlab_ci?(project) - - e.use {} - e.try {} - e.track(:view, property: project.root_ancestor.id.to_s) - end + enable_pipeline_empty_state_templates_experiment + enable_code_quality_walkthrough_experiment + enable_ci_runner_templates_experiment end format.json do Gitlab::PollingInterval.set_header(response, interval: POLLING_INTERVAL) @@ -176,11 +159,7 @@ class Projects::PipelinesController < Projects::ApplicationController end def retry - if Gitlab::Ci::Features.background_pipeline_retry_endpoint?(@project) - ::Ci::RetryPipelineWorker.perform_async(pipeline.id, current_user.id) # rubocop:disable CodeReuse/Worker - else - pipeline.retry_failed(current_user) - end + ::Ci::RetryPipelineWorker.perform_async(pipeline.id, current_user.id) # rubocop:disable CodeReuse/Worker respond_to do |format| format.html do @@ -321,6 +300,45 @@ class Projects::PipelinesController < Projects::ApplicationController def index_params params.permit(:scope, :username, :ref, :status) end + + def enable_pipeline_empty_state_templates_experiment + experiment(:pipeline_empty_state_templates, namespace: project.root_ancestor) do |e| + e.exclude! unless current_user + e.exclude! if @pipelines_count.to_i > 0 + e.exclude! if helpers.has_gitlab_ci?(project) + + e.control {} + e.candidate {} + e.record! + end + end + + def enable_code_quality_walkthrough_experiment + experiment(:code_quality_walkthrough, namespace: project.root_ancestor) do |e| + e.exclude! unless current_user + e.exclude! unless can?(current_user, :create_pipeline, project) + e.exclude! unless project.root_ancestor.recent? + e.exclude! if @pipelines_count.to_i > 0 + e.exclude! if helpers.has_gitlab_ci?(project) + + e.control {} + e.candidate {} + e.record! + end + end + + def enable_ci_runner_templates_experiment + experiment(:ci_runner_templates, namespace: project.root_ancestor) do |e| + e.exclude! unless current_user + e.exclude! unless can?(current_user, :create_pipeline, project) + e.exclude! if @pipelines_count.to_i > 0 + e.exclude! if helpers.has_gitlab_ci?(project) + + e.control {} + e.candidate {} + e.record! + end + end end Projects::PipelinesController.prepend_mod_with('Projects::PipelinesController') diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb index cc2157a7d51..370cd2b02a1 100644 --- a/app/controllers/projects/project_members_controller.rb +++ b/app/controllers/projects/project_members_controller.rb @@ -62,6 +62,22 @@ class Projects::ProjectMembersController < Projects::ApplicationController def membershipable_members project.members end + + def plain_source_type + 'project' + end + + def source_type + _("project") + end + + def members_page_url + project_project_members_path(project) + end + + def root_params_key + :project_member + end end Projects::ProjectMembersController.prepend_mod_with('Projects::ProjectMembersController') diff --git a/app/controllers/projects/releases_controller.rb b/app/controllers/projects/releases_controller.rb index 1bb50eabd1d..f01d10f4afa 100644 --- a/app/controllers/projects/releases_controller.rb +++ b/app/controllers/projects/releases_controller.rb @@ -10,6 +10,9 @@ class Projects::ReleasesController < Projects::ApplicationController before_action :authorize_download_code!, except: [:index] before_action :authorize_update_release!, only: %i[edit update] before_action :authorize_create_release!, only: :new + before_action only: :index do + push_frontend_feature_flag(:releases_index_apollo_client, project, default_enabled: :yaml) + end feature_category :release_orchestration diff --git a/app/controllers/projects/security/configuration_controller.rb b/app/controllers/projects/security/configuration_controller.rb index 19de157357a..3a473bb67e0 100644 --- a/app/controllers/projects/security/configuration_controller.rb +++ b/app/controllers/projects/security/configuration_controller.rb @@ -7,6 +7,10 @@ module Projects feature_category :static_application_security_testing + before_action only: [:show] do + push_frontend_feature_flag(:security_configuration_redesign, project, default_enabled: :yaml) + end + def show render_403 unless can?(current_user, :read_security_configuration, project) end diff --git a/app/controllers/projects/services_controller.rb b/app/controllers/projects/services_controller.rb index 74145a70b95..cad13d7e708 100644 --- a/app/controllers/projects/services_controller.rb +++ b/app/controllers/projects/services_controller.rb @@ -85,14 +85,13 @@ class Projects::ServicesController < Projects::ApplicationController def integration @integration ||= @project.find_or_initialize_service(params[:id]) - @service ||= @integration # TODO: remove references to @service end alias_method :service, :integration def web_hook_logs - return unless @service.service_hook.present? + return unless integration.service_hook.present? - @web_hook_logs ||= @service.service_hook.web_hook_logs.recent.page(params[:page]) + @web_hook_logs ||= integration.service_hook.web_hook_logs.recent.page(params[:page]) end def ensure_service_enabled @@ -101,8 +100,8 @@ class Projects::ServicesController < Projects::ApplicationController def serialize_as_json integration - .as_json(only: @service.json_fields) - .merge(errors: @service.errors.as_json) + .as_json(only: integration.json_fields) + .merge(errors: integration.errors.as_json) end def redirect_deprecated_prometheus_service diff --git a/app/controllers/projects/settings/integrations_controller.rb b/app/controllers/projects/settings/integrations_controller.rb index fba11ff1497..e54f4c511db 100644 --- a/app/controllers/projects/settings/integrations_controller.rb +++ b/app/controllers/projects/settings/integrations_controller.rb @@ -9,7 +9,7 @@ module Projects feature_category :integrations def show - @services = @project.find_or_initialize_services + @integrations = @project.find_or_initialize_services end end end diff --git a/app/controllers/projects/settings/operations_controller.rb b/app/controllers/projects/settings/operations_controller.rb index a357227c870..e32815b6239 100644 --- a/app/controllers/projects/settings/operations_controller.rb +++ b/app/controllers/projects/settings/operations_controller.rb @@ -65,7 +65,7 @@ module Projects return unless external_url_previous_change return unless external_url_previous_change[0].blank? && external_url_previous_change[1].present? - ::Gitlab::Tracking.event('project:operations:tracing', 'external_url_populated') + ::Gitlab::Tracking.event('project:operations:tracing', 'external_url_populated', user: current_user, project: project, namespace: project.namespace) end def alerting_params diff --git a/app/controllers/projects/templates_controller.rb b/app/controllers/projects/templates_controller.rb index b4b8fb97049..df945a99c73 100644 --- a/app/controllers/projects/templates_controller.rb +++ b/app/controllers/projects/templates_controller.rb @@ -25,7 +25,7 @@ class Projects::TemplatesController < Projects::ApplicationController def names respond_to do |format| - format.json { render json: TemplateFinder.all_template_names_hash_or_array(project, params[:template_type].to_s) } + format.json { render json: TemplateFinder.all_template_names(project, params[:template_type].to_s.pluralize) } end end diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index a1493a25a1a..d1486f765e4 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -6,8 +6,4 @@ class Projects::WikisController < Projects::ApplicationController alias_method :container, :project feature_category :wiki - - before_action do - push_frontend_feature_flag(:wiki_content_editor, project, default_enabled: :yaml) - end end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index fb977a5ee42..53d80b8be58 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -39,6 +39,11 @@ class ProjectsController < Projects::ApplicationController push_frontend_feature_flag(:refactor_blob_viewer, @project, default_enabled: :yaml) end + before_action only: [:new] do + # Run experiment before render so it will be written to the `gon` for FE + helpers.new_repo_experiment_text + end + layout :determine_layout feature_category :projects, [ @@ -221,7 +226,14 @@ class ProjectsController < Projects::ApplicationController def download_export if @project.export_file_exists? - send_upload(@project.export_file, attachment: @project.export_file.filename) + if @project.export_archive_exists? + send_upload(@project.export_file, attachment: @project.export_file.filename) + else + redirect_to( + edit_project_path(@project, anchor: 'js-export-project'), + alert: _("The file containing the export is not available yet; it may still be transferring. Please try again later.") + ) + end else redirect_to( edit_project_path(@project, anchor: 'js-export-project'), @@ -330,11 +342,7 @@ class ProjectsController < Projects::ApplicationController experiment(:empty_repo_upload, project: @project).track(:view_project_show, property: property) end - if @project.empty_repo? - record_experiment_user(:invite_members_empty_project_version_a) - - render 'projects/empty' - end + render 'projects/empty' if @project.empty_repo? else if can?(current_user, :read_wiki, @project) @wiki = @project.wiki @@ -435,6 +443,7 @@ class ProjectsController < Projects::ApplicationController :request_access_enabled, :runners_token, :tag_list, + :topics, :visibility_level, :template_name, :template_project_id, diff --git a/app/controllers/registrations/welcome_controller.rb b/app/controllers/registrations/welcome_controller.rb index 87465f8714d..34283cc8db7 100644 --- a/app/controllers/registrations/welcome_controller.rb +++ b/app/controllers/registrations/welcome_controller.rb @@ -52,7 +52,7 @@ module Registrations end def path_for_signed_in_user(user) - return users_almost_there_path if requires_confirmation?(user) + return users_almost_there_path(email: user.email) if requires_confirmation?(user) stored_location_for(user) || members_activity_path(user.members) end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 0f29f6f608f..cacd3c2da64 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -101,7 +101,7 @@ class RegistrationsController < Devise::RegistrationsController Gitlab::AppLogger.info(user_created_message) return new_user_session_path(anchor: 'login-pane') if resource.blocked_pending_approval? - Feature.enabled?(:soft_email_confirmation) ? dashboard_projects_path : users_almost_there_path + Feature.enabled?(:soft_email_confirmation) ? dashboard_projects_path : users_almost_there_path(email: resource.email) end private @@ -202,6 +202,10 @@ class RegistrationsController < Devise::RegistrationsController experiment(:invite_signup_page_interaction, actor: member).track(:form_submission) experiment('members/invite_email', actor: member).track(:accepted) end + + def context_user + current_user + end end RegistrationsController.prepend_mod_with('RegistrationsController') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 287ee2d5ab8..7282fc26121 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -20,7 +20,7 @@ class UsersController < ApplicationController skip_before_action :authenticate_user! prepend_before_action(only: [:show]) { authenticate_sessionless_user!(:rss) } - before_action :user, except: [:exists, :suggests, :ssh_keys] + before_action :user, except: [:exists, :ssh_keys] before_action :authorize_read_user_profile!, only: [:calendar, :calendar_activities, :groups, :projects, :contributed, :starred, :snippets, :followers, :following] @@ -153,14 +153,6 @@ class UsersController < ApplicationController render json: { exists: !!Namespace.find_by_path_or_name(params[:username]) } end - def suggests - namespace_path = params[:username] - exists = !!Namespace.find_by_path_or_name(namespace_path) - suggestions = exists ? [Namespace.clean_path(namespace_path)] : [] - - render json: { exists: exists, suggests: suggestions } - end - def follow current_user.follow(user) |