Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/groups')
-rw-r--r--app/controllers/groups/application_controller.rb2
-rw-r--r--app/controllers/groups/autocomplete_sources_controller.rb54
-rw-r--r--app/controllers/groups/boards_controller.rb1
-rw-r--r--app/controllers/groups/email_campaigns_controller.rb6
-rw-r--r--app/controllers/groups/group_members_controller.rb24
-rw-r--r--app/controllers/groups/milestones_controller.rb6
-rw-r--r--app/controllers/groups/runners_controller.rb1
-rw-r--r--app/controllers/groups/settings/ci_cd_controller.rb2
-rw-r--r--app/controllers/groups/settings/integrations_controller.rb6
-rw-r--r--app/controllers/groups/settings/packages_and_registries_controller.rb2
-rw-r--r--app/controllers/groups/variables_controller.rb2
11 files changed, 85 insertions, 21 deletions
diff --git a/app/controllers/groups/application_controller.rb b/app/controllers/groups/application_controller.rb
index a504d2ce991..a3bbfc8be0d 100644
--- a/app/controllers/groups/application_controller.rb
+++ b/app/controllers/groups/application_controller.rb
@@ -72,4 +72,4 @@ class Groups::ApplicationController < ApplicationController
end
end
-Groups::ApplicationController.prepend_if_ee('EE::Groups::ApplicationController')
+Groups::ApplicationController.prepend_mod_with('Groups::ApplicationController')
diff --git a/app/controllers/groups/autocomplete_sources_controller.rb b/app/controllers/groups/autocomplete_sources_controller.rb
new file mode 100644
index 00000000000..5270a718952
--- /dev/null
+++ b/app/controllers/groups/autocomplete_sources_controller.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+class Groups::AutocompleteSourcesController < Groups::ApplicationController
+ feature_category :subgroups, [:members]
+ feature_category :issue_tracking, [:issues, :labels, :milestones, :commands]
+ feature_category :code_review, [:merge_requests]
+
+ def members
+ render json: ::Groups::ParticipantsService.new(@group, current_user).execute(target)
+ end
+
+ def issues
+ render json: issuable_serializer.represent(
+ autocomplete_service.issues(confidential_only: params[:confidential_only], issue_types: params[:issue_types]),
+ parent_group: @group
+ )
+ end
+
+ def merge_requests
+ render json: issuable_serializer.represent(autocomplete_service.merge_requests, parent_group: @group)
+ end
+
+ def labels
+ render json: autocomplete_service.labels_as_hash(target)
+ end
+
+ def commands
+ render json: autocomplete_service.commands(target)
+ end
+
+ def milestones
+ render json: autocomplete_service.milestones
+ end
+
+ private
+
+ def autocomplete_service
+ @autocomplete_service ||= ::Groups::AutocompleteService.new(@group, current_user, params)
+ end
+
+ def issuable_serializer
+ GroupIssuableAutocompleteSerializer.new
+ end
+
+ # rubocop: disable CodeReuse/ActiveRecord
+ def target
+ QuickActions::TargetService
+ .new(nil, current_user, group: @group)
+ .execute(params[:type], params[:type_id])
+ end
+ # rubocop: enable CodeReuse/ActiveRecord
+end
+
+Groups::AutocompleteSourcesController.prepend_mod
diff --git a/app/controllers/groups/boards_controller.rb b/app/controllers/groups/boards_controller.rb
index be38fe25842..e1f09d73739 100644
--- a/app/controllers/groups/boards_controller.rb
+++ b/app/controllers/groups/boards_controller.rb
@@ -5,7 +5,6 @@ class Groups::BoardsController < Groups::ApplicationController
include RecordUserLastActivity
include Gitlab::Utils::StrongMemoize
- before_action :authorize_read_board!, only: [:index, :show]
before_action :assign_endpoint_vars
before_action do
push_frontend_feature_flag(:graphql_board_lists, group, default_enabled: false)
diff --git a/app/controllers/groups/email_campaigns_controller.rb b/app/controllers/groups/email_campaigns_controller.rb
index 4ce7d86be3c..c1e3ce519cc 100644
--- a/app/controllers/groups/email_campaigns_controller.rb
+++ b/app/controllers/groups/email_campaigns_controller.rb
@@ -1,8 +1,6 @@
# frozen_string_literal: true
class Groups::EmailCampaignsController < Groups::ApplicationController
- include InProductMarketingHelper
-
EMAIL_CAMPAIGNS_SCHEMA_URL = 'iglu:com.gitlab/email_campaigns/jsonschema/1-0-0'
feature_category :navigation
@@ -18,11 +16,13 @@ class Groups::EmailCampaignsController < Groups::ApplicationController
def track_click
if Gitlab.com?
+ message = Gitlab::Email::Message::InProductMarketing.for(@track).new(group: group, series: @series)
+
data = {
namespace_id: group.id,
track: @track.to_s,
series: @series,
- subject_line: subject_line(@track, @series)
+ subject_line: message.subject_line
}
context = SnowplowTracker::SelfDescribingJson.new(EMAIL_CAMPAIGNS_SCHEMA_URL, data)
diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb
index 5df7ff0632a..c2ac56ccc63 100644
--- a/app/controllers/groups/group_members_controller.rb
+++ b/app/controllers/groups/group_members_controller.rb
@@ -4,6 +4,7 @@ class Groups::GroupMembersController < Groups::ApplicationController
include MembershipActions
include MembersPresentation
include SortingHelper
+ include Gitlab::Utils::StrongMemoize
MEMBER_PER_PAGE_LIMIT = 50
@@ -21,16 +22,17 @@ class Groups::GroupMembersController < Groups::ApplicationController
feature_category :authentication_and_authorization
+ helper_method :can_manage_members?
+
def index
+ preload_max_access
@sort = params[:sort].presence || sort_value_name
- @project = @group.projects.find(params[:project_id]) if params[:project_id]
-
@members = GroupMembersFinder
.new(@group, current_user, params: filter_params)
.execute(include_relations: requested_relations)
- if can_manage_members
+ if can_manage_members?
@skip_groups = @group.related_group_ids
@invited_members = @members.invite
@@ -52,8 +54,18 @@ class Groups::GroupMembersController < Groups::ApplicationController
private
- def can_manage_members
- can?(current_user, :admin_group_member, @group)
+ 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)
+ end
end
def present_invited_members(invited_members)
@@ -77,4 +89,4 @@ class Groups::GroupMembersController < Groups::ApplicationController
end
end
-Groups::GroupMembersController.prepend_if_ee('EE::Groups::GroupMembersController')
+Groups::GroupMembersController.prepend_mod_with('Groups::GroupMembersController')
diff --git a/app/controllers/groups/milestones_controller.rb b/app/controllers/groups/milestones_controller.rb
index 84dc570a1e9..e9dce3947dd 100644
--- a/app/controllers/groups/milestones_controller.rb
+++ b/app/controllers/groups/milestones_controller.rb
@@ -21,7 +21,7 @@ class Groups::MilestonesController < Groups::ApplicationController
end
def new
- @milestone = Milestone.new
+ @noteable = @milestone = Milestone.new
end
def create
@@ -70,7 +70,7 @@ class Groups::MilestonesController < Groups::ApplicationController
end
def milestone
- @milestone = group.milestones.find_by_iid(params[:id])
+ @noteable = @milestone ||= group.milestones.find_by_iid(params[:id])
render_404 unless @milestone
end
@@ -95,4 +95,4 @@ class Groups::MilestonesController < Groups::ApplicationController
end
end
-Groups::MilestonesController.prepend_if_ee('EE::Groups::MilestonesController')
+Groups::MilestonesController.prepend_mod_with('Groups::MilestonesController')
diff --git a/app/controllers/groups/runners_controller.rb b/app/controllers/groups/runners_controller.rb
index dbfd31ebcad..b02b0e85d38 100644
--- a/app/controllers/groups/runners_controller.rb
+++ b/app/controllers/groups/runners_controller.rb
@@ -10,7 +10,6 @@ class Groups::RunnersController < Groups::ApplicationController
feature_category :continuous_integration
def show
- render 'shared/runners/show'
end
def edit
diff --git a/app/controllers/groups/settings/ci_cd_controller.rb b/app/controllers/groups/settings/ci_cd_controller.rb
index f1a6bcbe825..88c709e3f53 100644
--- a/app/controllers/groups/settings/ci_cd_controller.rb
+++ b/app/controllers/groups/settings/ci_cd_controller.rb
@@ -100,4 +100,4 @@ module Groups
end
end
-Groups::Settings::CiCdController.prepend_if_ee('EE::Groups::Settings::CiCdController')
+Groups::Settings::CiCdController.prepend_mod_with('Groups::Settings::CiCdController')
diff --git a/app/controllers/groups/settings/integrations_controller.rb b/app/controllers/groups/settings/integrations_controller.rb
index c3c93fe238a..8e3b2cb5d1b 100644
--- a/app/controllers/groups/settings/integrations_controller.rb
+++ b/app/controllers/groups/settings/integrations_controller.rb
@@ -12,11 +12,11 @@ module Groups
layout 'group_settings'
def index
- @integrations = Service.find_or_initialize_all_non_project_specific(Service.for_group(group)).sort_by(&:title)
+ @integrations = Integration.find_or_initialize_all_non_project_specific(Integration.for_group(group)).sort_by(&:title)
end
def edit
- @default_integration = Service.default_integration(integration.type, group)
+ @default_integration = Integration.default_integration(integration.type, group)
super
end
@@ -24,7 +24,7 @@ module Groups
private
def find_or_initialize_non_project_specific_integration(name)
- Service.find_or_initialize_non_project_specific_integration(name, group_id: group.id)
+ Integration.find_or_initialize_non_project_specific_integration(name, group_id: group.id)
end
def scoped_edit_integration_path(integration)
diff --git a/app/controllers/groups/settings/packages_and_registries_controller.rb b/app/controllers/groups/settings/packages_and_registries_controller.rb
index 90fb6497e20..c44e0727ff9 100644
--- a/app/controllers/groups/settings/packages_and_registries_controller.rb
+++ b/app/controllers/groups/settings/packages_and_registries_controller.rb
@@ -9,7 +9,7 @@ module Groups
feature_category :package_registry
- def index
+ def show
end
private
diff --git a/app/controllers/groups/variables_controller.rb b/app/controllers/groups/variables_controller.rb
index 75bb6975c6e..00ddb8d736c 100644
--- a/app/controllers/groups/variables_controller.rb
+++ b/app/controllers/groups/variables_controller.rb
@@ -57,4 +57,4 @@ module Groups
end
end
-Groups::VariablesController.prepend_if_ee('EE::Groups::VariablesController')
+Groups::VariablesController.prepend_mod_with('Groups::VariablesController')