diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-22 21:07:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-22 21:07:27 +0300 |
commit | 0c6f357040350390191b975c864064b027ec1026 (patch) | |
tree | e546c504086b9ca84fbdf297de302a864d976bf1 /app/services/service_desk | |
parent | b52aefb5996cdd22dc969161d414244a59046e6e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/service_desk')
3 files changed, 27 insertions, 0 deletions
diff --git a/app/services/service_desk/custom_emails/base_service.rb b/app/services/service_desk/custom_emails/base_service.rb index 62152f31012..4c2df948344 100644 --- a/app/services/service_desk/custom_emails/base_service.rb +++ b/app/services/service_desk/custom_emails/base_service.rb @@ -34,8 +34,33 @@ module ServiceDesk end def error_response(message) + with_context do + Gitlab::AppLogger.warn(build_log_message(error_message: message)) + end ServiceResponse.error(message: message) end + + def log_info(error_message: nil) + with_context do + Gitlab::AppLogger.info(build_log_message(error_message: error_message)) + end + end + + def with_context(&block) + Gitlab::ApplicationContext.with_context( + related_class: self.class.to_s, + user: current_user, + project: project, + &block + ) + end + + def build_log_message(error_message: nil) + { + category: 'custom_email', + error_message: error_message + }.compact + end end end end diff --git a/app/services/service_desk/custom_emails/create_service.rb b/app/services/service_desk/custom_emails/create_service.rb index c3ca98a0259..305f5b3fa11 100644 --- a/app/services/service_desk/custom_emails/create_service.rb +++ b/app/services/service_desk/custom_emails/create_service.rb @@ -25,6 +25,7 @@ module ServiceDesk # we don't use its response here. create_verification + log_info ServiceResponse.success end diff --git a/app/services/service_desk/custom_emails/destroy_service.rb b/app/services/service_desk/custom_emails/destroy_service.rb index 1aa5994edd8..abbe39646aa 100644 --- a/app/services/service_desk/custom_emails/destroy_service.rb +++ b/app/services/service_desk/custom_emails/destroy_service.rb @@ -13,6 +13,7 @@ module ServiceDesk project.reset project.service_desk_setting&.update!(custom_email: nil, custom_email_enabled: false) + log_info ServiceResponse.success end |