From 2e31c85a97183814ffa7ba5cc58f7bbad668fb2b Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 18 Mar 2020 00:09:16 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/controllers/application_controller.rb | 3 ++- app/controllers/sessions_controller.rb | 9 --------- app/helpers/broadcast_messages_helper.rb | 10 +++++++++- app/services/labels/transfer_service.rb | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'app') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3c03c387dba..c5c586ea489 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -35,8 +35,9 @@ class ApplicationController < ActionController::Base before_action :check_impersonation_availability before_action :required_signup_info + prepend_around_action :set_current_context + around_action :sessionless_bypass_admin_mode!, if: :sessionless_user? - around_action :set_current_context around_action :set_locale around_action :set_session_storage around_action :set_current_admin diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 2d1c1eeeea0..2c87c3c890f 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -26,8 +26,6 @@ class SessionsController < Devise::SessionsController before_action :load_recaptcha before_action :frontend_tracking_data, only: [:new] - around_action :set_current_context - after_action :log_failed_login, if: :action_new_and_failed_login? helper_method :captcha_enabled?, :captcha_on_login_required? @@ -307,13 +305,6 @@ class SessionsController < Devise::SessionsController # We want tracking data pushed to the frontend when the user is _in_ the control group frontend_experimentation_tracking_data(:signup_flow, 'start') unless experiment_enabled?(:signup_flow) end - - def set_current_context(&block) - Gitlab::ApplicationContext.with_context( - user: -> { current_user }, - caller_id: "#{self.class.name}##{action_name}", - &block) - end end SessionsController.prepend_if_ee('EE::SessionsController') diff --git a/app/helpers/broadcast_messages_helper.rb b/app/helpers/broadcast_messages_helper.rb index 7638710a7c2..73c68dd9e18 100644 --- a/app/helpers/broadcast_messages_helper.rb +++ b/app/helpers/broadcast_messages_helper.rb @@ -47,7 +47,15 @@ module BroadcastMessagesHelper end def render_broadcast_message(broadcast_message) - Banzai.render_field(broadcast_message, :message).html_safe + if Feature.enabled?(:broadcast_message_placeholders) + Banzai.render_and_post_process(broadcast_message.message, { + current_user: current_user, + skip_project_check: true, + broadcast_message_placeholders: true + }).html_safe + else + Banzai.render_field(broadcast_message, :message).html_safe + end end def broadcast_type_options diff --git a/app/services/labels/transfer_service.rb b/app/services/labels/transfer_service.rb index 91984403db3..e6f9cf35fcb 100644 --- a/app/services/labels/transfer_service.rb +++ b/app/services/labels/transfer_service.rb @@ -49,7 +49,7 @@ module Labels Label.joins(:issues) .where( issues: { project_id: project.id }, - labels: { type: 'GroupLabel', group_id: old_group.id } + labels: { type: 'GroupLabel', group_id: old_group.self_and_ancestors } ) end # rubocop: enable CodeReuse/ActiveRecord @@ -59,14 +59,14 @@ module Labels Label.joins(:merge_requests) .where( merge_requests: { target_project_id: project.id }, - labels: { type: 'GroupLabel', group_id: old_group.id } + labels: { type: 'GroupLabel', group_id: old_group.self_and_ancestors } ) end # rubocop: enable CodeReuse/ActiveRecord def find_or_create_label!(label) params = label.attributes.slice('title', 'description', 'color') - new_label = FindOrCreateService.new(current_user, project, params).execute + new_label = FindOrCreateService.new(current_user, project, params.merge(include_ancestor_groups: true)).execute new_label.id end -- cgit v1.2.1