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:
Krzysztof Kotlarek
2025-04-11 07:27:43 +08:00
committed by GitHub
parent 6fc5ce9688
commit 6e654bc596
5 changed files with 82 additions and 11 deletions

View File

@ -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