FIX: add link to user profile for staged users

This commit is contained in:
Régis Hanol 2016-01-19 16:41:07 +01:00
parent 29fbc2d7bc
commit 5018a8033d
5 changed files with 17 additions and 20 deletions

View File

@ -9,6 +9,8 @@ const AdminUser = Discourse.User.extend({
customGroups: Em.computed.filter("groups", (g) => !g.automatic && Group.create(g)),
automaticGroups: Em.computed.filter("groups", (g) => g.automatic && Group.create(g)),
canViewProfile: Ember.computed.or("active", "staged"),
generateApiKey() {
const self = this;
return Discourse.ajax("/admin/users/" + this.get('id') + "/generate_api_key", {

View File

@ -1,11 +1,13 @@
<section class="details {{unless model.active 'not-activated'}}">
<div class='user-controls'>
{{#if model.active}}
{{#if model.canViewProfile}}
{{#link-to 'user' model class="btn"}}
{{fa-icon "user"}}
{{i18n 'admin.user.show_public_profile'}}
{{/link-to}}
{{/if}}
{{#if model.active}}
{{#if model.can_impersonate}}
<button class='btn btn-danger' {{action "impersonate" target="content"}} title="{{i18n 'admin.impersonate.help'}}">
{{fa-icon "crosshairs"}}
@ -344,6 +346,12 @@
{{/conditional-loading-spinner}}
</div>
</div>
<div class="display-row">
<div class='field'>{{i18n 'admin.user.staged'}}</div>
<div class='value'>{{model.staged}}</div>
<div class='controls'>{{i18n 'admin.user.stage_explanation'}}</div>
</div>
</section>
<section class='details'>

View File

@ -56,10 +56,6 @@ class AdminDetailedUserSerializer < AdminUserSerializer
scope.can_anonymize_user?(object)
end
def moderator
object.moderator
end
def topic_count
object.topics.count
end
@ -72,18 +68,10 @@ class AdminDetailedUserSerializer < AdminUserSerializer
object.suspend_record.try(:acting_user)
end
def tl3_requirements
object.tl3_requirements
end
def include_tl3_requirements?
object.has_trust_level?(TrustLevel[2])
end
def user_fields
object.user_fields
end
def include_user_fields?
object.user_fields.present?
end

View File

@ -23,7 +23,8 @@ class AdminUserListSerializer < BasicUserSerializer
:suspended_till,
:suspended,
:blocked,
:time_read
:time_read,
:staged
[:days_visited, :posts_read_count, :topics_entered, :post_count].each do |sym|
attributes sym
@ -46,7 +47,7 @@ class AdminUserListSerializer < BasicUserSerializer
def can_impersonate
scope.can_impersonate?(object)
end
def last_emailed_at
return nil if object.last_emailed_at.blank?
object.last_emailed_at
@ -56,7 +57,7 @@ class AdminUserListSerializer < BasicUserSerializer
return nil if object.last_emailed_at.blank?
AgeWords.age_words(Time.now - object.last_emailed_at)
end
def last_seen_at
return nil if object.last_seen_at.blank?
object.last_seen_at
@ -71,10 +72,6 @@ class AdminUserListSerializer < BasicUserSerializer
return nil if object.user_stat.time_read.blank?
AgeWords.age_words(object.user_stat.time_read)
end
def created_at
object.created_at
end
def created_at_age
AgeWords.age_words(Time.now - object.created_at)

View File

@ -2401,6 +2401,7 @@ en:
moderator: "Moderator?"
admin: "Admin?"
blocked: "Blocked?"
staged: "Staged?"
show_admin_profile: "Admin"
edit_title: "Edit Title"
save_title: "Save Title"
@ -2470,6 +2471,7 @@ en:
deactivate_explanation: "A deactivated user must re-validate their email."
suspended_explanation: "A suspended user can't log in."
block_explanation: "A blocked user can't post or start topics."
stage_explanation: "A staged user can only post via email in specific topics."
trust_level_change_failed: "There was a problem changing the user's trust level."
suspend_modal_title: "Suspend User"
trust_level_2_users: "Trust Level 2 Users"