Rename 'leader' -> 'tl3'
This commit is contained in:
parent
fa50723807
commit
bff95a6a97
|
@ -399,11 +399,11 @@ Discourse.AdminUser = Discourse.User.extend({
|
|||
});
|
||||
},
|
||||
|
||||
leaderRequirements: function() {
|
||||
if (this.get('leader_requirements')) {
|
||||
return Discourse.LeaderRequirements.create(this.get('leader_requirements'));
|
||||
tl3Requirements: function() {
|
||||
if (this.get('tl3_requirements')) {
|
||||
return Discourse.TL3Requirements.create(this.get('tl3_requirements'));
|
||||
}
|
||||
}.property('leader_requirements'),
|
||||
}.property('tl3_requirements'),
|
||||
|
||||
suspendedBy: function() {
|
||||
if (this.get('suspended_by')) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Discourse.LeaderRequirements = Discourse.Model.extend({
|
||||
Discourse.TL3Requirements = Discourse.Model.extend({
|
||||
days_visited_percent: function() {
|
||||
return ((this.get('days_visited') * 100) / this.get('time_period'));
|
||||
}.property('days_visited', 'time_period'),
|
||||
|
|
|
@ -48,7 +48,7 @@ Discourse.Route.buildRoutes(function() {
|
|||
this.resource('adminUsers', { path: '/users' }, function() {
|
||||
this.resource('adminUser', { path: '/:username' }, function() {
|
||||
this.route('badges');
|
||||
this.route('leaderRequirements', { path: '/leader_requirements' });
|
||||
this.route('tl3Requirements', { path: '/tl3_requirements' });
|
||||
});
|
||||
this.resource('adminUsersList', { path: '/list' }, function() {
|
||||
_.each(['active', 'new', 'pending', 'admins', 'moderators', 'blocked', 'suspended',
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminUserLeaderRequirementsRoute = Discourse.Route.extend({
|
||||
Discourse.AdminUserTl3RequirementsRoute = Discourse.Route.extend({
|
||||
model: function() {
|
||||
return this.modelFor('adminUser');
|
||||
},
|
|
@ -269,8 +269,8 @@
|
|||
{{combo-box content=trustLevels value=trust_level nameProperty="detailedName"}}
|
||||
</div>
|
||||
<div class="controls">
|
||||
{{#if leaderRequirements}}
|
||||
{{#link-to 'adminUser.leaderRequirements' this class="btn"}}{{i18n admin.user.trust_level_3_requirements}}{{/link-to}}
|
||||
{{#if tl3Requirements}}
|
||||
{{#link-to 'adminUser.tl3Requirements' this class="btn"}}{{i18n admin.user.trust_level_3_requirements}}{{/link-to}}
|
||||
{{/if}}
|
||||
|
||||
{{#if dirty}}
|
||||
|
|
|
@ -1147,7 +1147,7 @@ table.api-keys {
|
|||
}
|
||||
}
|
||||
|
||||
.leader-requirements {
|
||||
.tl3-requirements {
|
||||
.fa-check {
|
||||
color: $success;
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ class Admin::UsersController < Admin::AdminController
|
|||
def badges
|
||||
end
|
||||
|
||||
def leader_requirements
|
||||
def tl3_requirements
|
||||
end
|
||||
|
||||
def ip_info
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Jobs
|
||||
|
||||
class LeaderPromotions < Jobs::Scheduled
|
||||
class Tl3Promotions < Jobs::Scheduled
|
||||
daily at: 4.hours
|
||||
|
||||
def execute(args)
|
||||
|
@ -8,7 +8,7 @@ module Jobs
|
|||
demoted_user_ids = []
|
||||
User.real.where(trust_level: TrustLevel[3], trust_level_locked: false).find_each do |u|
|
||||
# Don't demote too soon after being promoted
|
||||
next if u.on_leader_grace_period?
|
||||
next if u.on_tl3_grace_period?
|
||||
|
||||
if Promotion.tl3_lost?(u)
|
||||
demoted_user_ids << u.id
|
|
@ -58,7 +58,7 @@ class TrustLevel3Requirements
|
|||
end
|
||||
|
||||
def on_grace_period
|
||||
@user.on_leader_grace_period?
|
||||
@user.on_tl3_grace_period?
|
||||
end
|
||||
|
||||
def days_visited
|
||||
|
|
|
@ -570,11 +570,11 @@ class User < ActiveRecord::Base
|
|||
last_sent_email_address || email
|
||||
end
|
||||
|
||||
def leader_requirements
|
||||
def tl3_requirements
|
||||
@lq ||= TrustLevel3Requirements.new(self)
|
||||
end
|
||||
|
||||
def on_leader_grace_period?
|
||||
def on_tl3_grace_period?
|
||||
UserHistory.for(self, :auto_trust_level_change)
|
||||
.where('created_at >= ?', SiteSetting.tl3_promotion_min_duration.to_i.days.ago)
|
||||
.where(previous_value: TrustLevel[2].to_s)
|
||||
|
|
|
@ -23,7 +23,7 @@ class AdminDetailedUserSerializer < AdminUserSerializer
|
|||
has_one :approved_by, serializer: BasicUserSerializer, embed: :objects
|
||||
has_one :api_key, serializer: ApiKeySerializer, embed: :objects
|
||||
has_one :suspended_by, serializer: BasicUserSerializer, embed: :objects
|
||||
has_one :leader_requirements, serializer: TrustLevel3RequirementsSerializer, embed: :objects
|
||||
has_one :tl3_requirements, serializer: TrustLevel3RequirementsSerializer, embed: :objects
|
||||
has_many :groups, embed: :object, serializer: BasicGroupSerializer
|
||||
|
||||
def can_revoke_admin
|
||||
|
@ -66,11 +66,11 @@ class AdminDetailedUserSerializer < AdminUserSerializer
|
|||
object.suspend_record.try(:acting_user)
|
||||
end
|
||||
|
||||
def leader_requirements
|
||||
object.leader_requirements
|
||||
def tl3_requirements
|
||||
object.tl3_requirements
|
||||
end
|
||||
|
||||
def include_leader_requirements?
|
||||
def include_tl3_requirements?
|
||||
object.has_trust_level?(TrustLevel[2])
|
||||
end
|
||||
|
||||
|
|
|
@ -77,7 +77,8 @@ Discourse::Application.routes.draw do
|
|||
post "groups" => "users#add_group", constraints: AdminConstraint.new
|
||||
delete "groups/:group_id" => "users#remove_group", constraints: AdminConstraint.new
|
||||
get "badges"
|
||||
get "leader_requirements"
|
||||
get "leader_requirements" => "users#tl3_requirements"
|
||||
get "tl3_requirements"
|
||||
end
|
||||
|
||||
resources :impersonate, constraints: AdminConstraint.new
|
||||
|
|
Loading…
Reference in New Issue