From fc7fa4c0ad94fe5ef8faf37db574013bf4887e5b Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 31 Mar 2017 16:30:30 -0400 Subject: [PATCH] Rename "Rookie of the Month" to "New User of the Month" --- ...dges.rb => grant_new_user_of_the_month_badges.rb} | 8 ++++---- app/models/badge.rb | 2 +- config/locales/server.en.yml | 12 ++++++------ db/fixtures/006_badges.rb | 4 ++-- ...rb => grant_new_user_of_the_month_badges_spec.rb} | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) rename app/jobs/scheduled/{grant_rookie_badges.rb => grant_new_user_of_the_month_badges.rb} (88%) rename spec/jobs/{grant_rookie_badges_spec.rb => grant_new_user_of_the_month_badges_spec.rb} (90%) diff --git a/app/jobs/scheduled/grant_rookie_badges.rb b/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb similarity index 88% rename from app/jobs/scheduled/grant_rookie_badges.rb rename to app/jobs/scheduled/grant_new_user_of_the_month_badges.rb index 4312bc283a0..2094ceb9cbf 100644 --- a/app/jobs/scheduled/grant_rookie_badges.rb +++ b/app/jobs/scheduled/grant_new_user_of_the_month_badges.rb @@ -1,20 +1,20 @@ require 'badge_granter' module Jobs - class GrantRookieBadges < Jobs::Scheduled + class GrantNewUserOfTheMonthBadges < Jobs::Scheduled every 1.month MAX_AWARDED = 2 def execute(args) - badge = Badge.find(Badge::RookieOfTheMonth) + badge = Badge.find(Badge::NewUserOfTheMonth) scores.each do |user_id, score| # Don't bother awarding to users who haven't received any likes if score > 0.0 user = User.find(user_id) - if user.badges.where(id: Badge::RookieOfTheMonth).blank? + if user.badges.where(id: Badge::NewUserOfTheMonth).blank? BadgeGranter.grant(badge, user) - SystemMessage.new(user).create('rookie_of_the_month', { + SystemMessage.new(user).create('new_user_of_the_month', { month_year: Time.now.strftime("%B %Y") }) end diff --git a/app/models/badge.rb b/app/models/badge.rb index d3966729d22..5ffde4726b3 100644 --- a/app/models/badge.rb +++ b/app/models/badge.rb @@ -56,7 +56,7 @@ class Badge < ActiveRecord::Base GivesBack = 32 Empathetic = 39 - RookieOfTheMonth = 44 + NewUserOfTheMonth = 44 # other consts AutobiographerMinBioLength = 10 diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 8203bfa6d6d..8028b728b87 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -2319,11 +2319,11 @@ 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!" + new_user_of_the_month: + title: "You're a New User of the Month!" + subject_template: "You're a New User of the Month!" text_body_template: | - Congratulations, you've been awarded the **Rookie of the Month award for %{month_year}**. + Congratulations, you've been awarded the **New User 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. @@ -3300,8 +3300,8 @@ en: description: Replied to a Post via email long_description: | This badge is granted the first time you reply to a post via email :e-mail:. - rookie_of_the_month: - name: "Rookie of the Month" + new_user_of_the_month: + name: "New User of the Month" description: Contributed a lot of value in their first month long_description: | This badge is granted to two high quality users who joined in the last month. The quality is determined by how many of their posts were liked and by whom. diff --git a/db/fixtures/006_badges.rb b/db/fixtures/006_badges.rb index e956ad37cc2..88364c4fc77 100644 --- a/db/fixtures/006_badges.rb +++ b/db/fixtures/006_badges.rb @@ -402,8 +402,8 @@ Badge.seed do |b| end Badge.seed do |b| - b.id = Badge::RookieOfTheMonth - b.name = "Rookie of the Month" + b.id = Badge::NewUserOfTheMonth + b.name = "New User of the Month" b.badge_type_id = BadgeType::Bronze b.multiple_grant = false b.target_posts = false diff --git a/spec/jobs/grant_rookie_badges_spec.rb b/spec/jobs/grant_new_user_of_the_month_badges_spec.rb similarity index 90% rename from spec/jobs/grant_rookie_badges_spec.rb rename to spec/jobs/grant_new_user_of_the_month_badges_spec.rb index 4ba2edbf0ba..f4abe6e9e73 100644 --- a/spec/jobs/grant_rookie_badges_spec.rb +++ b/spec/jobs/grant_new_user_of_the_month_badges_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -require_dependency 'jobs/scheduled/grant_rookie_badges' +require_dependency 'jobs/scheduled/grant_new_user_of_the_month_badges' -describe Jobs::GrantRookieBadges do +describe Jobs::GrantNewUserOfTheMonthBadges do let(:granter) { described_class.new } @@ -14,7 +14,7 @@ describe Jobs::GrantRookieBadges do granter.execute({}) - badge = user.user_badges.where(badge_id: Badge::RookieOfTheMonth) + badge = user.user_badges.where(badge_id: Badge::NewUserOfTheMonth) expect(badge).to be_present end