mirror of
https://github.com/discourse/discourse.git
synced 2025-05-03 20:54:35 +08:00
Rename "Rookie of the Month" to "New User of the Month"
This commit is contained in:
parent
e6f6bd34d8
commit
fc7fa4c0ad
@ -1,20 +1,20 @@
|
|||||||
require 'badge_granter'
|
require 'badge_granter'
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class GrantRookieBadges < Jobs::Scheduled
|
class GrantNewUserOfTheMonthBadges < Jobs::Scheduled
|
||||||
every 1.month
|
every 1.month
|
||||||
|
|
||||||
MAX_AWARDED = 2
|
MAX_AWARDED = 2
|
||||||
|
|
||||||
def execute(args)
|
def execute(args)
|
||||||
badge = Badge.find(Badge::RookieOfTheMonth)
|
badge = Badge.find(Badge::NewUserOfTheMonth)
|
||||||
scores.each do |user_id, score|
|
scores.each do |user_id, score|
|
||||||
# Don't bother awarding to users who haven't received any likes
|
# Don't bother awarding to users who haven't received any likes
|
||||||
if score > 0.0
|
if score > 0.0
|
||||||
user = User.find(user_id)
|
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)
|
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")
|
month_year: Time.now.strftime("%B %Y")
|
||||||
})
|
})
|
||||||
end
|
end
|
@ -56,7 +56,7 @@ class Badge < ActiveRecord::Base
|
|||||||
GivesBack = 32
|
GivesBack = 32
|
||||||
Empathetic = 39
|
Empathetic = 39
|
||||||
|
|
||||||
RookieOfTheMonth = 44
|
NewUserOfTheMonth = 44
|
||||||
|
|
||||||
# other consts
|
# other consts
|
||||||
AutobiographerMinBioLength = 10
|
AutobiographerMinBioLength = 10
|
||||||
|
@ -2319,11 +2319,11 @@ en:
|
|||||||
|
|
||||||
[Please review and fix them](%{base_url}/admin).
|
[Please review and fix them](%{base_url}/admin).
|
||||||
|
|
||||||
rookie_of_the_month:
|
new_user_of_the_month:
|
||||||
title: "You're a Rookie of the Month!"
|
title: "You're a New User of the Month!"
|
||||||
subject_template: "You're a Rookie of the Month!"
|
subject_template: "You're a New User of the Month!"
|
||||||
text_body_template: |
|
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.
|
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
|
description: Replied to a Post via email
|
||||||
long_description: |
|
long_description: |
|
||||||
This badge is granted the first time you reply to a post via email :e-mail:.
|
This badge is granted the first time you reply to a post via email :e-mail:.
|
||||||
rookie_of_the_month:
|
new_user_of_the_month:
|
||||||
name: "Rookie of the Month"
|
name: "New User of the Month"
|
||||||
description: Contributed a lot of value in their first month
|
description: Contributed a lot of value in their first month
|
||||||
long_description: |
|
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.
|
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.
|
||||||
|
@ -402,8 +402,8 @@ Badge.seed do |b|
|
|||||||
end
|
end
|
||||||
|
|
||||||
Badge.seed do |b|
|
Badge.seed do |b|
|
||||||
b.id = Badge::RookieOfTheMonth
|
b.id = Badge::NewUserOfTheMonth
|
||||||
b.name = "Rookie of the Month"
|
b.name = "New User of the Month"
|
||||||
b.badge_type_id = BadgeType::Bronze
|
b.badge_type_id = BadgeType::Bronze
|
||||||
b.multiple_grant = false
|
b.multiple_grant = false
|
||||||
b.target_posts = false
|
b.target_posts = false
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require 'rails_helper'
|
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 }
|
let(:granter) { described_class.new }
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ describe Jobs::GrantRookieBadges do
|
|||||||
|
|
||||||
granter.execute({})
|
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
|
expect(badge).to be_present
|
||||||
|
|
||||||
end
|
end
|
Loading…
x
Reference in New Issue
Block a user