DEV: adds log warning if assign is not enabled (#202)

This commit is contained in:
Joffrey JAFFEUX 2021-09-08 16:46:41 +02:00 committed by GitHub
parent 0881b638bd
commit da0a6ce219
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -671,8 +671,11 @@ after_initialize do
triggerables %i[point_in_time recurring]
script do |context, fields|
next unless SiteSetting.assign_enabled?
script do |context, fields, automation|
unless SiteSetting.assign_enabled?
Rails.logger.warn("[discourse-automation id=#{automation.id}] discourse-assign is not enabled.")
next
end
next unless topic_id = fields.dig('assigned_topic', 'value')
next unless topic = Topic.find_by(id: topic_id)