diff --git a/migrations/20140810_upgrade_admin_contrib_tiers.js b/migrations/20140810_upgrade_admin_contrib_tiers.js new file mode 100644 index 0000000000..60e38668cb --- /dev/null +++ b/migrations/20140810_upgrade_admin_contrib_tiers.js @@ -0,0 +1,30 @@ +// https://github.com/HabitRPG/habitrpg/issues/3801 +// Convert contributors of Tier 7 with admin flag to Tier 8 (moderators). +// Convert contributors of Tier 8 to Tier 9 (staff) (all Tier 8s are admins). + +db.users.update( + { + 'contributor.admin':true, + 'contributor.level':{$gte:7} + }, + { + $inc: { 'contributor.level': 1 } + }, + { multi: true } +); + +/* +db.users.find({_id : ObjectId("6")}) +db.users.find( + { + 'contributor.admin':true, + 'contributor.level':{$gte:7} + }, + { + 'username':1, + 'profile.name':1, + 'contributor.level':1, + 'contributor.admin':1 + } +); +*/ diff --git a/public/js/controllers/rootCtrl.js b/public/js/controllers/rootCtrl.js index 1582aecaae..e93ef3486d 100644 --- a/public/js/controllers/rootCtrl.js +++ b/public/js/controllers/rootCtrl.js @@ -48,6 +48,15 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ style += ' label-contributor-'+user.contributor.level; return style; } + $scope.userAdminGlyphiconStyle = function(user,style){ + style = style || ''; + if(user && user.contributor && user.contributor.level) + if(user.contributor.level==8) + style += ' glyphicon glyphicon-star'; // moderator + if(user.contributor.level==9) + style += ' glyphicon glyphicon-tower'; // staff + return style; + } $rootScope.playSound = function(id){ if (!user.preferences.sound) return; diff --git a/src/models/user.js b/src/models/user.js index a9e981b420..eab3bd340e 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -67,7 +67,7 @@ var UserSchema = new Schema({ }, contributor: { - level: Number, // 1-7, see https://trello.com/c/wkFzONhE/277-contributor-gear + level: Number, // 1-9, see https://trello.com/c/wkFzONhE/277-contributor-gear https://github.com/HabitRPG/habitrpg/issues/3801 admin: Boolean, sudo: Boolean, text: String, // Artisan, Friend, Blacksmith, etc diff --git a/views/options/social/hall.jade b/views/options/social/hall.jade index 59c6235ceb..0879e1c84c 100644 --- a/views/options/social/hall.jade +++ b/views/options/social/hall.jade @@ -28,7 +28,10 @@ script(type='text/ng-template', id='partials/options.social.hall.heroes.html') label=env.t('contribLevel') input.form-control(type='number', step="any", ng-model='hero.contributor.level') small=env.t('contribHallText') + |  a(target='_blank', href='https://trello.com/c/wkFzONhE/277-contributor-gear')=env.t('moreDetails') + |,  + a(target='_blank', href='https://github.com/HabitRPG/habitrpg/issues/3801')=env.t('moreDetails2') .form-group textarea.form-control(cols=5, placeholder=env.t('contributions'), ng-model='hero.contributor.contributions') include ../../shared/formatting-help @@ -88,7 +91,7 @@ script(type='text/ng-template', id='partials/options.social.hall.heroes.html') span(ng-if='hero.contributor.admin',popover=env.t('gamemaster'),popover-trigger='mouseenter',popover-placement='right') a.label.label-default(ng-class='userLevelStyle(hero)', ng-click='clickMember(hero._id, true)') | {{hero.profile.name}}  - span.glyphicon.glyphicon-star + span(ng-class='userAdminGlyphiconStyle(hero)') span(ng-if='!hero.contributor.admin') a.label.label-default(ng-class='userLevelStyle(hero)', ng-click='clickMember(hero._id, true)') {{hero.profile.name}} td(ng-if='user.contributor.admin') {{hero._id}}