From 48aff82709769b098321c738f3444b9bdaa694c6 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 21 Oct 2020 07:08:36 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-5-stable-ee --- app/controllers/groups/avatars_controller.rb | 2 ++ app/controllers/groups/boards_controller.rb | 2 ++ app/controllers/groups/children_controller.rb | 2 ++ app/controllers/groups/deploy_tokens_controller.rb | 2 ++ app/controllers/groups/group_links_controller.rb | 11 ++++++++ app/controllers/groups/group_members_controller.rb | 6 +++++ app/controllers/groups/imports_controller.rb | 2 ++ app/controllers/groups/labels_controller.rb | 30 +++++++++++----------- app/controllers/groups/milestones_controller.rb | 4 ++- app/controllers/groups/packages_controller.rb | 2 ++ .../groups/registry/repositories_controller.rb | 6 ++++- app/controllers/groups/releases_controller.rb | 2 ++ app/controllers/groups/runners_controller.rb | 2 ++ .../groups/settings/ci_cd_controller.rb | 8 ++++++ .../groups/settings/integrations_controller.rb | 2 ++ .../groups/settings/repository_controller.rb | 2 ++ .../groups/shared_projects_controller.rb | 2 ++ app/controllers/groups/uploads_controller.rb | 2 ++ app/controllers/groups/variables_controller.rb | 2 ++ 19 files changed, 74 insertions(+), 17 deletions(-) (limited to 'app/controllers/groups') diff --git a/app/controllers/groups/avatars_controller.rb b/app/controllers/groups/avatars_controller.rb index 8e4dc2bb6e9..1f13be449a9 100644 --- a/app/controllers/groups/avatars_controller.rb +++ b/app/controllers/groups/avatars_controller.rb @@ -5,6 +5,8 @@ class Groups::AvatarsController < Groups::ApplicationController skip_cross_project_access_check :destroy + feature_category :subgroups + def destroy @group.remove_avatar! @group.save diff --git a/app/controllers/groups/boards_controller.rb b/app/controllers/groups/boards_controller.rb index ea7e83a2caf..b971c5783a8 100644 --- a/app/controllers/groups/boards_controller.rb +++ b/app/controllers/groups/boards_controller.rb @@ -12,6 +12,8 @@ class Groups::BoardsController < Groups::ApplicationController push_frontend_feature_flag(:boards_with_swimlanes, group, default_enabled: false) end + feature_category :boards + private def assign_endpoint_vars diff --git a/app/controllers/groups/children_controller.rb b/app/controllers/groups/children_controller.rb index 236a19a8dc4..718914dea35 100644 --- a/app/controllers/groups/children_controller.rb +++ b/app/controllers/groups/children_controller.rb @@ -5,6 +5,8 @@ module Groups before_action :group skip_cross_project_access_check :index + feature_category :subgroups + def index parent = if params[:parent_id].present? GroupFinder.new(current_user).execute(id: params[:parent_id]) diff --git a/app/controllers/groups/deploy_tokens_controller.rb b/app/controllers/groups/deploy_tokens_controller.rb index de951f2cb9f..79152bf2695 100644 --- a/app/controllers/groups/deploy_tokens_controller.rb +++ b/app/controllers/groups/deploy_tokens_controller.rb @@ -3,6 +3,8 @@ class Groups::DeployTokensController < Groups::ApplicationController before_action :authorize_destroy_deploy_token! + feature_category :continuous_delivery + def revoke @token = @group.deploy_tokens.find(params[:id]) @token.revoke! diff --git a/app/controllers/groups/group_links_controller.rb b/app/controllers/groups/group_links_controller.rb index c395b93f4e7..3b775af9722 100644 --- a/app/controllers/groups/group_links_controller.rb +++ b/app/controllers/groups/group_links_controller.rb @@ -4,6 +4,8 @@ class Groups::GroupLinksController < Groups::ApplicationController before_action :authorize_admin_group! before_action :group_link, only: [:update, :destroy] + feature_category :subgroups + def create shared_with_group = Group.find(params[:shared_with_group_id]) if params[:shared_with_group_id].present? @@ -24,6 +26,15 @@ class Groups::GroupLinksController < Groups::ApplicationController def update Groups::GroupLinks::UpdateService.new(@group_link).execute(group_link_params) + + if @group_link.expires? + render json: { + expires_in: helpers.distance_of_time_in_words_to_now(@group_link.expires_at), + expires_soon: @group_link.expires_soon? + } + else + render json: {} + end end def destroy diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index 63311ab983b..5df7ff0632a 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -19,6 +19,8 @@ class Groups::GroupMembersController < Groups::ApplicationController :approve_access_request, :leave, :resend_invite, :override + feature_category :authentication_and_authorization + def index @sort = params[:sort].presence || sort_value_name @@ -69,6 +71,10 @@ class Groups::GroupMembersController < Groups::ApplicationController def filter_params params.permit(:two_factor, :search).merge(sort: @sort) end + + def membershipable_members + group.members + end end Groups::GroupMembersController.prepend_if_ee('EE::Groups::GroupMembersController') diff --git a/app/controllers/groups/imports_controller.rb b/app/controllers/groups/imports_controller.rb index b611685f9bc..7cf39e378db 100644 --- a/app/controllers/groups/imports_controller.rb +++ b/app/controllers/groups/imports_controller.rb @@ -3,6 +3,8 @@ class Groups::ImportsController < Groups::ApplicationController include ContinueParams + feature_category :importers + def show if @group.import_state.nil? || @group.import_state.finished? if continue_params[:to] diff --git a/app/controllers/groups/labels_controller.rb b/app/controllers/groups/labels_controller.rb index 1034ca6cd7b..34856f8d84e 100644 --- a/app/controllers/groups/labels_controller.rb +++ b/app/controllers/groups/labels_controller.rb @@ -2,6 +2,7 @@ class Groups::LabelsController < Groups::ApplicationController include ToggleSubscriptionAction + include ShowInheritedLabelsChecker before_action :label, only: [:edit, :update, :destroy] before_action :authorize_admin_labels!, only: [:new, :create, :edit, :update, :destroy] @@ -9,11 +10,14 @@ class Groups::LabelsController < Groups::ApplicationController respond_to :html + feature_category :issue_tracking + def index respond_to do |format| format.html do - @labels = GroupLabelsFinder - .new(current_user, @group, params.merge(sort: sort)).execute + # 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]) end format.json do render json: LabelSerializer.new.represent_appearance(available_labels) @@ -60,13 +64,7 @@ class Groups::LabelsController < Groups::ApplicationController def destroy @label.destroy - - respond_to do |format| - format.html do - redirect_to group_labels_path(@group), status: :found, notice: "#{@label.name} deleted permanently" - end - format.js - end + redirect_to group_labels_path(@group), status: :found, notice: "#{@label.name} deleted permanently" end protected @@ -80,7 +78,7 @@ class Groups::LabelsController < Groups::ApplicationController end def label - @label ||= @group.labels.find(params[:id]) + @label ||= available_labels(params.merge(only_group_labels: true)).find(params[:id]) end alias_method :subscribable_resource, :label @@ -108,15 +106,17 @@ class Groups::LabelsController < Groups::ApplicationController session[:previous_labels_path] = URI(request.referer || '').path end - def available_labels + def available_labels(options = params) @available_labels ||= LabelsFinder.new( current_user, group_id: @group.id, - only_group_labels: params[:only_group_labels], - include_ancestor_groups: params[:include_ancestor_groups], - include_descendant_groups: params[:include_descendant_groups], - search: params[:search]).execute + only_group_labels: options[:only_group_labels], + include_ancestor_groups: show_inherited_labels?(params[:include_ancestor_groups]), + sort: sort, + subscribed: options[:subscribed], + include_descendant_groups: options[:include_descendant_groups], + search: options[:search]).execute end def sort diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb index df3fb6b67c2..173a24ceb74 100644 --- a/app/controllers/groups/milestones_controller.rb +++ b/app/controllers/groups/milestones_controller.rb @@ -3,12 +3,14 @@ class Groups::MilestonesController < Groups::ApplicationController include MilestoneActions - before_action :milestone, only: [:edit, :show, :update, :merge_requests, :participants, :labels, :destroy] + before_action :milestone, only: [:edit, :show, :update, :issues, :merge_requests, :participants, :labels, :destroy] before_action :authorize_admin_milestones!, only: [:edit, :new, :create, :update, :destroy] before_action do push_frontend_feature_flag(:burnup_charts, @group) end + feature_category :issue_tracking + def index respond_to do |format| format.html do diff --git a/app/controllers/groups/packages_controller.rb b/app/controllers/groups/packages_controller.rb index 600acc72e67..47f1816cc4c 100644 --- a/app/controllers/groups/packages_controller.rb +++ b/app/controllers/groups/packages_controller.rb @@ -4,6 +4,8 @@ module Groups class PackagesController < Groups::ApplicationController before_action :verify_packages_enabled! + feature_category :package_registry + private def verify_packages_enabled! diff --git a/app/controllers/groups/registry/repositories_controller.rb b/app/controllers/groups/registry/repositories_controller.rb index 14651e0794a..d914e0bffc6 100644 --- a/app/controllers/groups/registry/repositories_controller.rb +++ b/app/controllers/groups/registry/repositories_controller.rb @@ -2,9 +2,13 @@ module Groups module Registry class RepositoriesController < Groups::ApplicationController + include PackagesHelper + before_action :verify_container_registry_enabled! before_action :authorize_read_container_image! + feature_category :package_registry + def index respond_to do |format| format.html @@ -13,7 +17,7 @@ module Groups .execute .with_api_entity_associations - track_event(:list_repositories) + track_package_event(:list_repositories, :container) serializer = ContainerRepositoriesSerializer .new(current_user: current_user) diff --git a/app/controllers/groups/releases_controller.rb b/app/controllers/groups/releases_controller.rb index 500c57a6f3e..6a42f30b847 100644 --- a/app/controllers/groups/releases_controller.rb +++ b/app/controllers/groups/releases_controller.rb @@ -2,6 +2,8 @@ module Groups class ReleasesController < Groups::ApplicationController + feature_category :release_evidence + def index respond_to do |format| format.json do diff --git a/app/controllers/groups/runners_controller.rb b/app/controllers/groups/runners_controller.rb index edebffe2912..dbfd31ebcad 100644 --- a/app/controllers/groups/runners_controller.rb +++ b/app/controllers/groups/runners_controller.rb @@ -7,6 +7,8 @@ class Groups::RunnersController < Groups::ApplicationController before_action :runner, only: [:edit, :update, :destroy, :pause, :resume, :show] + feature_category :continuous_integration + def show render 'shared/runners/show' end diff --git a/app/controllers/groups/settings/ci_cd_controller.rb b/app/controllers/groups/settings/ci_cd_controller.rb index bf3a38ce57b..0c72c8a037b 100644 --- a/app/controllers/groups/settings/ci_cd_controller.rb +++ b/app/controllers/groups/settings/ci_cd_controller.rb @@ -3,6 +3,8 @@ module Groups module Settings class CiCdController < Groups::ApplicationController + include RunnerSetupScripts + skip_cross_project_access_check :show before_action :authorize_admin_group! before_action :authorize_update_max_artifacts_size!, only: [:update] @@ -11,6 +13,8 @@ module Groups end before_action :define_variables, only: [:show] + feature_category :continuous_integration + NUMBER_OF_RUNNERS_PER_PAGE = 4 def show @@ -49,6 +53,10 @@ module Groups redirect_to group_settings_ci_cd_path end + def runner_setup_scripts + private_runner_setup_scripts(group: group) + end + private def define_variables diff --git a/app/controllers/groups/settings/integrations_controller.rb b/app/controllers/groups/settings/integrations_controller.rb index e8551a7f270..b089cfdf341 100644 --- a/app/controllers/groups/settings/integrations_controller.rb +++ b/app/controllers/groups/settings/integrations_controller.rb @@ -7,6 +7,8 @@ module Groups before_action :authorize_admin_group! + feature_category :integrations + def index @integrations = Service.find_or_initialize_all(Service.for_group(group)).sort_by(&:title) end diff --git a/app/controllers/groups/settings/repository_controller.rb b/app/controllers/groups/settings/repository_controller.rb index e2fbdc39692..ccc1fa12458 100644 --- a/app/controllers/groups/settings/repository_controller.rb +++ b/app/controllers/groups/settings/repository_controller.rb @@ -10,6 +10,8 @@ module Groups push_frontend_feature_flag(:ajax_new_deploy_token, @group) end + feature_category :continuous_delivery + def create_deploy_token result = Groups::DeployTokens::CreateService.new(@group, current_user, deploy_token_params).execute @new_deploy_token = result[:deploy_token] diff --git a/app/controllers/groups/shared_projects_controller.rb b/app/controllers/groups/shared_projects_controller.rb index 30b7bfc70ae..90ec64d4768 100644 --- a/app/controllers/groups/shared_projects_controller.rb +++ b/app/controllers/groups/shared_projects_controller.rb @@ -6,6 +6,8 @@ module Groups before_action :group skip_cross_project_access_check :index + feature_category :subgroups + def index shared_projects = GroupProjectsFinder.new( group: group, diff --git a/app/controllers/groups/uploads_controller.rb b/app/controllers/groups/uploads_controller.rb index 3ae7e36c740..49249f87d31 100644 --- a/app/controllers/groups/uploads_controller.rb +++ b/app/controllers/groups/uploads_controller.rb @@ -9,6 +9,8 @@ class Groups::UploadsController < Groups::ApplicationController before_action :authorize_upload_file!, only: [:create, :authorize] before_action :verify_workhorse_api!, only: [:authorize] + feature_category :subgroups + private def upload_model_class diff --git a/app/controllers/groups/variables_controller.rb b/app/controllers/groups/variables_controller.rb index fb639f6e472..51670325ce3 100644 --- a/app/controllers/groups/variables_controller.rb +++ b/app/controllers/groups/variables_controller.rb @@ -6,6 +6,8 @@ module Groups skip_cross_project_access_check :show, :update + feature_category :continuous_integration + def show respond_to do |format| format.json do -- cgit v1.2.1