diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /app/controllers/groups | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'app/controllers/groups')
3 files changed, 93 insertions, 2 deletions
diff --git a/app/controllers/groups/boards_controller.rb b/app/controllers/groups/boards_controller.rb index 093cdf258b2..fa109021b7d 100644 --- a/app/controllers/groups/boards_controller.rb +++ b/app/controllers/groups/boards_controller.rb @@ -3,6 +3,7 @@ class Groups::BoardsController < Groups::ApplicationController include BoardsActions include RecordUserLastActivity + include Gitlab::Utils::StrongMemoize before_action :authorize_read_board!, only: [:index, :show] before_action :assign_endpoint_vars @@ -14,10 +15,32 @@ class Groups::BoardsController < Groups::ApplicationController private + def board_klass + Board + end + + def boards_finder + strong_memoize :boards_finder do + Boards::ListService.new(parent, current_user) + end + end + + def board_finder + strong_memoize :board_finder do + Boards::ListService.new(parent, current_user, board_id: params[:id]) + end + end + + def board_create_service + strong_memoize :board_create_service do + Boards::CreateService.new(parent, current_user) + end + end + def assign_endpoint_vars - @boards_endpoint = group_boards_url(group) + @boards_endpoint = group_boards_path(group) @namespace_path = group.to_param - @labels_endpoint = group_labels_url(group) + @labels_endpoint = group_labels_path(group) end def authorize_read_board! diff --git a/app/controllers/groups/email_campaigns_controller.rb b/app/controllers/groups/email_campaigns_controller.rb new file mode 100644 index 00000000000..cbb0176ea7b --- /dev/null +++ b/app/controllers/groups/email_campaigns_controller.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +class Groups::EmailCampaignsController < Groups::ApplicationController + include InProductMarketingHelper + include Gitlab::Tracking::ControllerConcern + + EMAIL_CAMPAIGNS_SCHEMA_URL = 'iglu:com.gitlab/email_campaigns/jsonschema/1-0-0' + + feature_category :navigation + + before_action :check_params + + def index + track_click + redirect_to redirect_link + end + + 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) + end + + def redirect_link + case @track + when :create + create_track_url + when :verify + project_pipelines_url(group.projects.first) + when :trial + 'https://about.gitlab.com/free-trial/' + when :team + group_group_members_url(group) + end + end + + def create_track_url + [ + new_project_url, + new_project_url(anchor: 'import_project'), + help_page_url('user/project/repository/repository_mirroring') + ][@series] + end + + def check_params + @track = params[:track]&.to_sym + @series = params[:series]&.to_i + + track_valid = @track.in?(Namespaces::InProductMarketingEmailsService::TRACKS.keys) + series_valid = @series.in?(0..Namespaces::InProductMarketingEmailsService::INTERVAL_DAYS.size - 1) + + render_404 unless track_valid && series_valid + end +end diff --git a/app/controllers/groups/settings/packages_and_registries_controller.rb b/app/controllers/groups/settings/packages_and_registries_controller.rb index dbc1e68742b..0135c03026c 100644 --- a/app/controllers/groups/settings/packages_and_registries_controller.rb +++ b/app/controllers/groups/settings/packages_and_registries_controller.rb @@ -4,11 +4,18 @@ module Groups module Settings class PackagesAndRegistriesController < Groups::ApplicationController before_action :authorize_admin_group! + before_action :verify_packages_enabled! feature_category :package_registry def index end + + private + + def verify_packages_enabled! + render_404 unless group.packages_feature_enabled? + end end end end |