mirror of
https://github.com/discourse/discourse.git
synced 2025-06-19 22:23:04 +08:00
FIX: relax automation restrictions (#32238)
Relaxed restrictions: - Automation posts are not validated for similarity. This was causing error when PMs were created by regular user with same content and sent to different users. - Don't create warning logs when PM target does not exist anymore. When for example spammer was deleted, delayed PM is not sent, but it is correct behaviour; - Allow tags to be applied even if an automation user is not allowed to tag; - Restricted category tags should be visible in configuration UI. Still, they will be applied only when specific topic belongs to correct category.
This commit is contained in:

committed by
GitHub

parent
6fc5ce9688
commit
6e654bc596
@ -254,7 +254,6 @@ module DiscourseAutomation
|
||||
|
||||
if pm[:target_usernames].empty? && pm[:target_group_names].empty? &&
|
||||
pm[:target_emails].empty?
|
||||
Rails.logger.warn "[discourse-automation] Did not send PM - no target usernames, groups or emails"
|
||||
return
|
||||
end
|
||||
|
||||
@ -300,6 +299,7 @@ module DiscourseAutomation
|
||||
|
||||
post_created = EncryptedPostCreator.new(sender, pm).create if prefers_encrypt
|
||||
|
||||
pm[:acting_user] = Discourse.system_user
|
||||
PostCreator.new(sender, pm).create! if !post_created
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user