diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /app/controllers/groups | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) | |
download | gitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'app/controllers/groups')
11 files changed, 131 insertions, 19 deletions
diff --git a/app/controllers/groups/boards_controller.rb b/app/controllers/groups/boards_controller.rb index 3354c0a5c9f..be38fe25842 100644 --- a/app/controllers/groups/boards_controller.rb +++ b/app/controllers/groups/boards_controller.rb @@ -9,7 +9,7 @@ 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(:boards_filtered_search, group) + push_frontend_feature_flag(:swimlanes_buffered_rendering, group, default_enabled: :yaml) end feature_category :boards diff --git a/app/controllers/groups/clusters/integrations_controller.rb b/app/controllers/groups/clusters/integrations_controller.rb new file mode 100644 index 00000000000..e8c8a14c164 --- /dev/null +++ b/app/controllers/groups/clusters/integrations_controller.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class Groups::Clusters::IntegrationsController < Clusters::IntegrationsController + include ControllerWithCrossProjectAccessCheck + + prepend_before_action :group + requires_cross_project_access + + private + + def clusterable + @clusterable ||= ClusterablePresenter.fabricate(group, current_user: current_user) + end + + def group + @group ||= find_routable!(Group, params[:group_id] || params[:id]) + end +end diff --git a/app/controllers/groups/email_campaigns_controller.rb b/app/controllers/groups/email_campaigns_controller.rb index cbb0176ea7b..4ce7d86be3c 100644 --- a/app/controllers/groups/email_campaigns_controller.rb +++ b/app/controllers/groups/email_campaigns_controller.rb @@ -2,7 +2,6 @@ class Groups::EmailCampaignsController < Groups::ApplicationController include InProductMarketingHelper - include Gitlab::Tracking::ControllerConcern EMAIL_CAMPAIGNS_SCHEMA_URL = 'iglu:com.gitlab/email_campaigns/jsonschema/1-0-0' @@ -18,14 +17,19 @@ class Groups::EmailCampaignsController < Groups::ApplicationController private def track_click - data = { - namespace_id: group.id, - track: @track, - series: @series, - subject_line: subject_line(@track, @series) - } - - track_self_describing_event(EMAIL_CAMPAIGNS_SCHEMA_URL, data: data) + if Gitlab.com? + data = { + namespace_id: group.id, + track: @track.to_s, + series: @series, + subject_line: subject_line(@track, @series) + } + context = SnowplowTracker::SelfDescribingJson.new(EMAIL_CAMPAIGNS_SCHEMA_URL, data) + + ::Gitlab::Tracking.event(self.class.name, 'click', context: [context]) + else + ::Users::InProductMarketingEmail.save_cta_click(current_user, @track, @series) + end end def redirect_link diff --git a/app/controllers/groups/labels_controller.rb b/app/controllers/groups/labels_controller.rb index c5dd3e1df35..86dde454cbc 100644 --- a/app/controllers/groups/labels_controller.rb +++ b/app/controllers/groups/labels_controller.rb @@ -16,7 +16,8 @@ class Groups::LabelsController < Groups::ApplicationController format.html do # at group level we do not want to list project labels, # we only want `only_group_labels = false` when pulling labels for label filter dropdowns, fetched through json - @labels = available_labels(params.merge(only_group_labels: true)).page(params[:page]) + @labels = available_labels(params.merge(only_group_labels: true)).page(params[:page]) # rubocop: disable CodeReuse/ActiveRecord + Preloaders::LabelsPreloader.new(@labels, current_user).preload_all end format.json do render json: LabelSerializer.new.represent_appearance(available_labels) diff --git a/app/controllers/groups/settings/applications_controller.rb b/app/controllers/groups/settings/applications_controller.rb new file mode 100644 index 00000000000..cefb5425867 --- /dev/null +++ b/app/controllers/groups/settings/applications_controller.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +module Groups + module Settings + class ApplicationsController < Groups::ApplicationController + include OauthApplications + + prepend_before_action :authorize_admin_group! + before_action :set_application, only: [:show, :edit, :update, :destroy] + before_action :load_scopes, only: [:index, :create, :edit, :update] + + feature_category :authentication_and_authorization + + def index + set_index_vars + end + + def show + end + + def edit + end + + def create + @application = Applications::CreateService.new(current_user, application_params).execute(request) + + if @application.persisted? + flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create]) + + redirect_to group_settings_application_url(@group, @application) + else + set_index_vars + render :index + end + end + + def update + if @application.update(application_params) + redirect_to group_settings_application_path(@group, @application), notice: _('Application was successfully updated.') + else + render :edit + end + end + + def destroy + @application.destroy + redirect_to group_settings_applications_url(@group), status: :found, notice: _('Application was successfully destroyed.') + end + + private + + def set_index_vars + # TODO: Remove limit(100) and implement pagination + # https://gitlab.com/gitlab-org/gitlab/-/issues/324187 + @applications = @group.oauth_applications.limit(100) + + # Don't overwrite a value possibly set by `create` + @application ||= Doorkeeper::Application.new + end + + def set_application + @application = @group.oauth_applications.find(params[:id]) + end + + def application_params + params + .require(:doorkeeper_application) + .permit(:name, :redirect_uri, :scopes, :confidential) + .tap do |params| + params[:owner] = @group + end + end + end + end +end diff --git a/app/controllers/groups/settings/ci_cd_controller.rb b/app/controllers/groups/settings/ci_cd_controller.rb index 723edc4b7e9..f1a6bcbe825 100644 --- a/app/controllers/groups/settings/ci_cd_controller.rb +++ b/app/controllers/groups/settings/ci_cd_controller.rb @@ -5,10 +5,12 @@ module Groups class CiCdController < Groups::ApplicationController include RunnerSetupScripts + layout 'group_settings' skip_cross_project_access_check :show before_action :authorize_admin_group! before_action :authorize_update_max_artifacts_size!, only: [:update] before_action :define_variables, only: [:show] + before_action :push_licensed_features, only: [:show] feature_category :continuous_integration @@ -51,7 +53,7 @@ module Groups end def runner_setup_scripts - private_runner_setup_scripts(group: group) + private_runner_setup_scripts end private @@ -90,6 +92,12 @@ module Groups def update_group_params params.require(:group).permit(:max_artifacts_size) end + + # Overridden in EE + def push_licensed_features + end end end end + +Groups::Settings::CiCdController.prepend_if_ee('EE::Groups::Settings::CiCdController') diff --git a/app/controllers/groups/settings/integrations_controller.rb b/app/controllers/groups/settings/integrations_controller.rb index 8903feaff04..c3c93fe238a 100644 --- a/app/controllers/groups/settings/integrations_controller.rb +++ b/app/controllers/groups/settings/integrations_controller.rb @@ -9,6 +9,8 @@ module Groups feature_category :integrations + layout 'group_settings' + def index @integrations = Service.find_or_initialize_all_non_project_specific(Service.for_group(group)).sort_by(&:title) end diff --git a/app/controllers/groups/settings/packages_and_registries_controller.rb b/app/controllers/groups/settings/packages_and_registries_controller.rb index 0135c03026c..90fb6497e20 100644 --- a/app/controllers/groups/settings/packages_and_registries_controller.rb +++ b/app/controllers/groups/settings/packages_and_registries_controller.rb @@ -3,6 +3,7 @@ module Groups module Settings class PackagesAndRegistriesController < Groups::ApplicationController + layout 'group_settings' before_action :authorize_admin_group! before_action :verify_packages_enabled! diff --git a/app/controllers/groups/settings/repository_controller.rb b/app/controllers/groups/settings/repository_controller.rb index ccc1fa12458..7404075985b 100644 --- a/app/controllers/groups/settings/repository_controller.rb +++ b/app/controllers/groups/settings/repository_controller.rb @@ -3,6 +3,7 @@ module Groups module Settings class RepositoryController < Groups::ApplicationController + layout 'group_settings' skip_cross_project_access_check :show before_action :authorize_create_deploy_token! before_action :define_deploy_token_variables diff --git a/app/controllers/groups/shared_projects_controller.rb b/app/controllers/groups/shared_projects_controller.rb index 90ec64d4768..7acdacc2d46 100644 --- a/app/controllers/groups/shared_projects_controller.rb +++ b/app/controllers/groups/shared_projects_controller.rb @@ -25,13 +25,13 @@ module Groups def finder_params @finder_params ||= begin - # Make the `search` param consistent for the frontend, - # which will be using `filter`. - params[:search] ||= params[:filter] if params[:filter] - # Don't show archived projects - params[:non_archived] = true - params.permit(:sort, :search, :non_archived) - end + # Make the `search` param consistent for the frontend, + # which will be using `filter`. + params[:search] ||= params[:filter] if params[:filter] + # Don't show archived projects + params[:non_archived] = true + params.permit(:sort, :search, :non_archived) + end end end end diff --git a/app/controllers/groups/variables_controller.rb b/app/controllers/groups/variables_controller.rb index a2289b540ec..75bb6975c6e 100644 --- a/app/controllers/groups/variables_controller.rb +++ b/app/controllers/groups/variables_controller.rb @@ -56,3 +56,5 @@ module Groups end end end + +Groups::VariablesController.prepend_if_ee('EE::Groups::VariablesController') |