Rename trust level badges

This commit is contained in:
Sam 2014-09-05 16:38:29 +10:00
parent 59d04c0695
commit 96ac2f63cd
3 changed files with 32 additions and 12 deletions

View file

@ -1836,9 +1836,9 @@ en:
pending: 'Users Pending Review' pending: 'Users Pending Review'
newuser: 'Users at Trust Level 0 (New User)' newuser: 'Users at Trust Level 0 (New User)'
basic: 'Users at Trust Level 1 (Basic User)' basic: 'Users at Trust Level 1 (Basic User)'
regular: 'Users at Trust Level 2 (Regular User)' regular: 'Users at Trust Level 2 (Member)'
leader: 'Users at Trust Level 3 (Veteran)' leader: 'Users at Trust Level 3 (Regular)'
elder: 'Users at Trust Level 4 (Elder)' elder: 'Users at Trust Level 4 (Leader)'
admins: 'Admin Users' admins: 'Admin Users'
moderators: 'Moderators' moderators: 'Moderators'
blocked: 'Blocked Users' blocked: 'Blocked Users'
@ -2136,14 +2136,14 @@ en:
basic_user: basic_user:
name: Basic name: Basic
description: <a href="https://meta.discourse.org/t/what-do-user-trust-levels-do/4924/4">Granted</a> all essential community functions description: <a href="https://meta.discourse.org/t/what-do-user-trust-levels-do/4924/4">Granted</a> all essential community functions
regular_user: member:
name: Regular name: Member
description: <a href="https://meta.discourse.org/t/what-do-user-trust-levels-do/4924/5">Granted</a> invitations description: <a href="https://meta.discourse.org/t/what-do-user-trust-levels-do/4924/5">Granted</a> invitations
regular:
name: Regular
description: <a href="https://meta.discourse.org/t/what-do-user-trust-levels-do/4924/6">Granted</a> recategorize, rename, followed links and lounge
leader: leader:
name: Leader name: Leader
description: <a href="https://meta.discourse.org/t/what-do-user-trust-levels-do/4924/6">Granted</a> recategorize, rename, followed links and lounge
elder:
name: Elder
description: <a href="https://meta.discourse.org/t/what-do-user-trust-levels-do/4924/7">Granted</a> global edit, pin, close, archive, split and merge description: <a href="https://meta.discourse.org/t/what-do-user-trust-levels-do/4924/7">Granted</a> global edit, pin, close, archive, split and merge
welcome: welcome:
name: Welcome name: Welcome

View file

@ -40,9 +40,9 @@ Badge.exec_sql "UPDATE badges
# Trust level system badges. # Trust level system badges.
trust_level_badges = [ trust_level_badges = [
{id: 1, name: "Basic User", type: BadgeType::Bronze}, {id: 1, name: "Basic User", type: BadgeType::Bronze},
{id: 2, name: "Regular User", type: BadgeType::Bronze}, {id: 2, name: "Member", type: BadgeType::Bronze},
{id: 3, name: "Leader", type: BadgeType::Silver}, {id: 3, name: "Regular", type: BadgeType::Silver},
{id: 4, name: "Elder", type: BadgeType::Gold} {id: 4, name: "Leader", type: BadgeType::Gold}
] ]
trust_level_badges.each do |spec| trust_level_badges.each do |spec|
@ -54,7 +54,7 @@ trust_level_badges.each do |spec|
b.default_badge_grouping_id = BadgeGrouping::TrustLevel b.default_badge_grouping_id = BadgeGrouping::TrustLevel
b.trigger = Badge::Trigger::TrustLevelChange b.trigger = Badge::Trigger::TrustLevelChange
# allow title for leader and elder # allow title for tl3 and above
b.default_allow_title = spec[:id] > 2 b.default_allow_title = spec[:id] > 2
b.system = true b.system = true
end end

View file

@ -0,0 +1,20 @@
class RenameTrustLevelBadges < ActiveRecord::Migration
def rename(id, old, new)
execute "UPDATE badges SET name = '#{new}' WHERE name = '#{old}' AND id = #{id}"
rescue
puts "#{new} badge is already in use, skipping rename"
end
def up
rename 2, 'Regular User', 'Member'
rename 3, 'Leader', 'Regular'
rename 4, 'Elder', 'Leader'
end
def down
rename 2, 'Member', 'Regular User'
rename 3, 'Regular', 'Leader'
rename 4, 'Leader', 'Elder'
end
end