diff options
Diffstat (limited to 'app/services/concerns')
4 files changed, 58 insertions, 5 deletions
diff --git a/app/services/concerns/alert_management/alert_processing.rb b/app/services/concerns/alert_management/alert_processing.rb index 9fe82507edd..5d35658a2b3 100644 --- a/app/services/concerns/alert_management/alert_processing.rb +++ b/app/services/concerns/alert_management/alert_processing.rb @@ -36,7 +36,7 @@ module AlertManagement SystemNoteService.log_resolving_alert(alert, alert_source) if alert.resolve(incoming_payload.ends_at) - SystemNoteService.change_alert_status(alert, User.alert_bot) + SystemNoteService.change_alert_status(alert, Users::Internal.alert_bot) close_issue(alert.issue_id) if auto_close_incident? end diff --git a/app/services/concerns/rate_limited_service.rb b/app/services/concerns/rate_limited_service.rb index fa366c1ccd0..79be952ac14 100644 --- a/app/services/concerns/rate_limited_service.rb +++ b/app/services/concerns/rate_limited_service.rb @@ -61,9 +61,11 @@ module RateLimitedService cattr_accessor :rate_limiter_scoped_and_keyed def self.rate_limit(key:, opts:, rate_limiter: ::Gitlab::ApplicationRateLimiter) - self.rate_limiter_scoped_and_keyed = RateLimiterScopedAndKeyed.new(key: key, - opts: opts, - rate_limiter: rate_limiter) + self.rate_limiter_scoped_and_keyed = RateLimiterScopedAndKeyed.new( + key: key, + opts: opts, + rate_limiter: rate_limiter + ) end end diff --git a/app/services/concerns/service_desk/custom_emails/logger.rb b/app/services/concerns/service_desk/custom_emails/logger.rb new file mode 100644 index 00000000000..1817933c3d0 --- /dev/null +++ b/app/services/concerns/service_desk/custom_emails/logger.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module ServiceDesk + module CustomEmails + module Logger + private + + def log_warning(error_message: nil) + with_context do + Gitlab::AppLogger.warn(build_log_message(error_message: error_message)) + end + end + + def log_info(error_message: nil, project: nil) + with_context(project: project) do + Gitlab::AppLogger.info(build_log_message(error_message: error_message)) + end + end + + def with_context(project: nil, &block) + Gitlab::ApplicationContext.with_context( + related_class: self.class.to_s, + user: current_user, + project: project || self.project, + &block + ) + end + + def log_category + 'custom_email' + end + + def build_log_message(error_message: nil) + { + category: log_category, + error_message: error_message + }.compact + end + end + end +end diff --git a/app/services/concerns/update_repository_storage_methods.rb b/app/services/concerns/update_repository_storage_methods.rb index dca38abf7af..f14c79ecd7e 100644 --- a/app/services/concerns/update_repository_storage_methods.rb +++ b/app/services/concerns/update_repository_storage_methods.rb @@ -69,7 +69,17 @@ module UpdateRepositoryStorageMethods raise Error, s_('UpdateRepositoryStorage|Timeout waiting for %{type} repository pushes') % { type: type.name } end - repository = type.repository_for(container) + # `Projects::UpdateRepositoryStorageService`` expects the repository it is + # moving to have a `Project` as a container. + # This hack allows design repos to also be moved as part of a project move + # as before. + # The alternative to this hack is to setup a service like + # `Snippets::UpdateRepositoryStorageService' and a corresponding worker like + # `Snippets::UpdateRepositoryStorageWorker` for snippets. + # + # Gitlab issue: https://gitlab.com/gitlab-org/gitlab/-/issues/423429 + + repository = type.repository_for(type.design? ? container.design_management_repository : container) full_path = repository.full_path raw_repository = repository.raw checksum = repository.checksum |