FEATURE: automatically archive welcome messages for site_contact_user

This de-clutters the sent messages box for site_contact_user, making it again usable
This commit is contained in:
Sam
2016-01-10 16:46:11 +11:00
parent 1a223b9d10
commit 6fabb341f1
3 changed files with 41 additions and 7 deletions

View File

@ -23,12 +23,17 @@ class SystemMessage
title = I18n.t("system_messages.#{type}.subject_template", params)
raw = I18n.t("system_messages.#{type}.text_body_template", params)
PostCreator.create(Discourse.site_contact_user,
post = PostCreator.create(Discourse.site_contact_user,
title: title,
raw: raw,
archetype: Archetype.private_message,
target_usernames: @recipient.username,
subtype: TopicSubtype.system_message)
UserArchivedMessage.create!(user: Discourse.site_contact_user, topic: post.topic)
post
end
def create_from_system_user(type, params = {})