Files
discourse-chat-integration/app/services/problem_check/channel_errors.rb
T
Ted Johansson f0275f1591 DEV: Promote channel error check to ProblemCheck (#190)
We're promoting problem checks to first class citizens in core. This migrates the problem check to the new API.

In the process of adding tests for this check, I discovered what seems like a mistake that likely means this check never worked until now. (See inline comment.)
2024-03-15 13:21:11 +08:00

26 lines
532 B
Ruby

# frozen_string_literal: true
class ProblemCheck::ChannelErrors < ProblemCheck
self.priority = "low"
def call
return no_problem if !SiteSetting.chat_integration_enabled
return no_problem if !channel_errors?
problem
end
private
def channel_errors?
DiscourseChatIntegration::Channel.find_each.any? do |channel|
channel.error_key.present? &&
::DiscourseChatIntegration::Provider.is_enabled(channel.provider)
end
end
def translation_key
"chat_integration.admin_error"
end
end