Send the user a notice when they've received rookie of the month

This commit is contained in:
Robin Ward 2017-03-30 16:48:09 -04:00
parent 893e93dfbe
commit e6f6bd34d8
2 changed files with 17 additions and 1 deletions

View File

@ -11,7 +11,13 @@ module Jobs
scores.each do |user_id, score|
# Don't bother awarding to users who haven't received any likes
if score > 0.0
BadgeGranter.grant(badge, User.find(user_id))
user = User.find(user_id)
if user.badges.where(id: Badge::RookieOfTheMonth).blank?
BadgeGranter.grant(badge, user)
SystemMessage.new(user).create('rookie_of_the_month', {
month_year: Time.now.strftime("%B %Y")
})
end
end
end
end

View File

@ -2319,6 +2319,16 @@ en:
[Please review and fix them](%{base_url}/admin).
rookie_of_the_month:
title: "You're a Rookie of the Month!"
subject_template: "You're a Rookie of the Month!"
text_body_template: |
Congratulations, you've been awarded the **Rookie of the Month award for %{month_year}**.
You received this because you've quickly become a valuable member of the community and other members are really enjoying your posts.
Thanks and keep up the great work!
unsubscribe_link: |
To unsubscribe from these emails, [click here](%{unsubscribe_url}).