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