From 96ac2f63cd6d8198664d58ed6f546b8449712f3b Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 5 Sep 2014 16:38:29 +1000 Subject: [PATCH] Rename trust level badges --- config/locales/client.en.yml | 16 +++++++-------- db/fixtures/006_badges.rb | 8 ++++---- ...0140905055251_rename_trust_level_badges.rb | 20 +++++++++++++++++++ 3 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 db/migrate/20140905055251_rename_trust_level_badges.rb diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 7fd5fb565..029100cfb 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1836,9 +1836,9 @@ en: pending: 'Users Pending Review' newuser: 'Users at Trust Level 0 (New User)' basic: 'Users at Trust Level 1 (Basic User)' - regular: 'Users at Trust Level 2 (Regular User)' - leader: 'Users at Trust Level 3 (Veteran)' - elder: 'Users at Trust Level 4 (Elder)' + regular: 'Users at Trust Level 2 (Member)' + leader: 'Users at Trust Level 3 (Regular)' + elder: 'Users at Trust Level 4 (Leader)' admins: 'Admin Users' moderators: 'Moderators' blocked: 'Blocked Users' @@ -2136,14 +2136,14 @@ en: basic_user: name: Basic description: Granted all essential community functions - regular_user: - name: Regular + member: + name: Member description: Granted invitations + regular: + name: Regular + description: Granted recategorize, rename, followed links and lounge leader: name: Leader - description: Granted recategorize, rename, followed links and lounge - elder: - name: Elder description: Granted global edit, pin, close, archive, split and merge welcome: name: Welcome diff --git a/db/fixtures/006_badges.rb b/db/fixtures/006_badges.rb index ef7853a93..690fefb57 100644 --- a/db/fixtures/006_badges.rb +++ b/db/fixtures/006_badges.rb @@ -40,9 +40,9 @@ Badge.exec_sql "UPDATE badges # Trust level system badges. trust_level_badges = [ {id: 1, name: "Basic User", type: BadgeType::Bronze}, - {id: 2, name: "Regular User", type: BadgeType::Bronze}, - {id: 3, name: "Leader", type: BadgeType::Silver}, - {id: 4, name: "Elder", type: BadgeType::Gold} + {id: 2, name: "Member", type: BadgeType::Bronze}, + {id: 3, name: "Regular", type: BadgeType::Silver}, + {id: 4, name: "Leader", type: BadgeType::Gold} ] trust_level_badges.each do |spec| @@ -54,7 +54,7 @@ trust_level_badges.each do |spec| b.default_badge_grouping_id = BadgeGrouping::TrustLevel 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.system = true end diff --git a/db/migrate/20140905055251_rename_trust_level_badges.rb b/db/migrate/20140905055251_rename_trust_level_badges.rb new file mode 100644 index 000000000..40b34e0dd --- /dev/null +++ b/db/migrate/20140905055251_rename_trust_level_badges.rb @@ -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