diff --git a/lib/system_message.rb b/lib/system_message.rb index 3f19aa485e4..c60461df323 100644 --- a/lib/system_message.rb +++ b/lib/system_message.rb @@ -23,13 +23,18 @@ class SystemMessage title = I18n.t("system_messages.#{type}.subject_template", params) raw = I18n.t("system_messages.#{type}.text_body_template", params) - post = PostCreator.create(Discourse.site_contact_user, + creator = PostCreator.create(Discourse.site_contact_user, title: title, raw: raw, archetype: Archetype.private_message, target_usernames: @recipient.username, - subtype: TopicSubtype.system_message) + subtype: TopicSubtype.system_message, + skip_validations: true) + post = creator.create + if creator.errors.present? + raise StandardError, creator.errors.to_s + end UserArchivedMessage.create!(user: Discourse.site_contact_user, topic: post.topic)