discourse/app/assets/javascripts/admin/templates/user-index.hbs

576 lines
20 KiB
Handlebars
Raw Normal View History

<section class="details {{unless model.active 'not-activated'}}">
<div class='user-controls'>
{{#if model.canViewProfile}}
{{#link-to 'user' model class="btn"}}
{{d-icon "user"}}
{{i18n 'admin.user.show_public_profile'}}
{{/link-to}}
{{/if}}
{{#if model.can_view_action_logs}}
{{d-button action="viewActionLogs" actionParam=model.username icon="list-alt" label="admin.user.action_logs"}}
{{/if}}
{{#if model.active}}
{{#if currentUser.admin}}
{{d-button action="logOut" icon="power-off" label="admin.user.log_out"}}
{{/if}}
{{/if}}
{{plugin-outlet name="admin-user-controls-after" args=(hash model=model) tagName="" connectorTagName=""}}
</div>
<div class='display-row username'>
<div class='field'>{{i18n 'user.username.title'}}</div>
<div class='value'>
{{#if editingUsername}}
{{text-field value=userUsernameValue autofocus="autofocus"}}
{{else}}
<span {{action "toggleUsernameEdit"}}>{{model.username}}</span>
{{/if}}
</div>
2013-02-06 03:16:51 +08:00
<div class='controls'>
{{#if editingUsername}}
{{d-button action="saveUsername" label="admin.user_fields.save"}}
<a href {{action "toggleUsernameEdit"}}>{{i18n 'cancel'}}</a>
{{else}}
{{d-button action="toggleUsernameEdit" icon="pencil"}}
{{/if}}
2013-02-06 03:16:51 +08:00
</div>
</div>
2013-04-20 13:34:11 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'user.name.title'}}</div>
<div class='value'>
{{#if editingName}}
{{text-field value=userNameValue autofocus="autofocus"}}
{{else}}
<span {{action "toggleNameEdit"}}>{{model.name}}</span>
{{/if}}
</div>
<div class='controls'>
{{#if editingName}}
{{d-button action="saveName" label="admin.user_fields.save"}}
<a href {{action "toggleNameEdit"}}>{{i18n 'cancel'}}</a>
{{else}}
{{d-button action="toggleNameEdit" icon="pencil"}}
{{/if}}
</div>
</div>
{{plugin-outlet name="admin-user-below-names" args=(hash user=model) tagName='' connectorTagName=''}}
{{#if canCheckEmails}}
<div class='display-row email'>
<div class='field'>{{i18n 'user.email.title'}}</div>
<div class='value'>
{{#unless model.active}}
<div class='controls'>{{i18n 'admin.users.not_verified'}}</div>
{{/unless}}
{{#if model.email}}
<a href="mailto:{{unbound model.email}}">{{model.email}}</a>
{{else}}
{{d-button action="checkEmail" actionParam=model icon="envelope-o" label="admin.users.check_email.text" title="admin.users.check_email.title"}}
{{/if}}
</div>
</div>
2013-04-20 13:34:11 +08:00
<div class="display-row bounce-score">
<div class='field'><a href="{{model.bounceLink}}">{{i18n 'admin.user.bounce_score'}}</a></div>
<div class='value'>{{model.bounceScore}}</div>
<div class='controls'>
{{#if model.canResetBounceScore}}
{{d-button action="resetBounceScore" label="admin.user.reset_bounce_score.label" title="admin.user.reset_bounce_score.title"}}
{{/if}}
{{model.bounceScoreExplanation}}
</div>
</div>
<div class='display-row associations'>
<div class='field'>{{i18n 'user.associated_accounts'}}</div>
<div class='value'>
{{#if model.associated_accounts}}
{{model.associated_accounts}}
{{else}}
{{d-button action="checkEmail" actionParam=model icon="envelope-o" label="admin.users.check_email.text" title="admin.users.check_email.title"}}
{{/if}}
</div>
</div>
{{/if}}
<div class='display-row'>
<div class='field'>{{i18n 'user.avatar.title'}}</div>
2013-02-06 03:16:51 +08:00
<div class='value'>{{avatar content imageSize="large"}}</div>
<div class="controls">
{{{i18n "admin.user.visit_profile" url=preferencesPath}}}
</div>
2013-02-06 03:16:51 +08:00
</div>
2013-04-20 13:34:11 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'user.title.title'}}</div>
<div class='value'>
{{#if editingTitle}}
{{text-field value=userTitleValue autofocus="autofocus"}}
{{else}}
<span {{action "toggleTitleEdit"}}>{{model.title}}&nbsp;</span>
{{/if}}
</div>
<div class='controls'>
{{#if editingTitle}}
{{d-button action="saveTitle" label="admin.user_fields.save"}}
<a href {{action "toggleTitleEdit"}}>{{i18n 'cancel'}}</a>
{{else}}
{{d-button action="toggleTitleEdit" icon="pencil"}}
{{/if}}
</div>
</div>
<div class='display-row last-ip'>
<div class='field'>{{i18n 'user.ip_address.title'}}</div>
<div class='value'>{{model.ip_address}}</div>
2013-02-06 03:16:51 +08:00
<div class='controls'>
{{#if currentUser.staff}}
{{d-button action="refreshBrowsers" label="admin.user.refresh_browsers"}}
{{ip-lookup ip=model.ip_address userId=model.id}}
{{/if}}
2013-02-06 03:16:51 +08:00
</div>
</div>
2013-04-20 13:34:11 +08:00
<div class='display-row registration-ip'>
<div class='field'>{{i18n 'user.registration_ip_address.title'}}</div>
<div class='value'>{{model.registration_ip_address}}</div>
<div class='controls'>
{{#if currentUser.staff}}
{{ip-lookup ip=model.registration_ip_address userId=model.id}}
{{/if}}
</div>
</div>
{{#if showBadges}}
<div class='display-row'>
<div class='field'>{{i18n 'admin.badges.title'}}</div>
<div class='value'>
{{i18n 'badges.badge_count' count=model.badge_count}}
</div>
<div class='controls'>
{{#link-to 'adminUser.badges' model class="btn"}}{{d-icon "certificate"}}{{i18n 'admin.badges.edit_badges'}}{{/link-to}}
</div>
</div>
{{/if}}
<div class='display-row'>
<div class='field'>{{i18n 'user.second_factor.title'}}</div>
<div class='value'>
{{#if model.second_factor_enabled}}
{{i18n "yes_value"}}
{{else}}
{{i18n "no_value"}}
{{/if}}
</div>
<div class='controls'>
{{#if canDisableSecondFactor}}
{{d-button action="disableSecondFactor" icon="unlock-alt" label="user.second_factor.disable"}}
{{/if}}
</div>
</div>
2013-02-06 03:16:51 +08:00
</section>
{{#if userFields}}
<section class='details'>
{{#each userFields as |uf|}}
<div class='display-row'>
2014-12-13 02:28:20 +08:00
<div class='field'>{{uf.name}}</div>
<div class='value'>
2014-12-13 02:28:20 +08:00
{{#if uf.value}}
{{uf.value}}
{{else}}
&mdash;
{{/if}}
</div>
</div>
{{/each}}
</section>
{{/if}}
{{plugin-outlet name="admin-user-details" args=(hash model=model)}}
2013-02-06 03:16:51 +08:00
<section class='details'>
<h1>{{i18n 'admin.user.permissions'}}</h1>
2013-02-06 03:16:51 +08:00
{{#if showApproval}}
<div class='display-row'>
<div class='field'>{{i18n 'admin.users.approved'}}</div>
<div class='value'>
{{#if model.approved}}
{{i18n 'admin.user.approved_by'}}
{{#link-to 'adminUser' model.approvedBy}}{{avatar model.approvedBy imageSize="small"}}{{/link-to}}
{{#link-to 'adminUser' model.approvedBy}}{{model.approvedBy.username}}{{/link-to}}
{{else}}
{{i18n 'no_value'}}
{{/if}}
</div>
<div class='controls'>
{{#if model.approved}}
{{i18n 'admin.user.approve_success'}}
{{else}}
{{#if model.can_approve}}
{{d-button action="approve" icon="check" label="admin.user.approve"}}
{{/if}}
{{/if}}
</div>
2013-02-06 03:16:51 +08:00
</div>
{{/if}}
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.users.active'}}</div>
2016-12-28 18:45:41 +08:00
<div class='value'>{{i18n-yes-no model.active}}</div>
<div class='controls'>
{{#if model.active}}
{{#if model.can_deactivate}}
{{d-button action="deactivate" label="admin.user.deactivate_account"}}
{{i18n 'admin.user.deactivate_explanation'}}
{{/if}}
{{else}}
{{#if model.can_send_activation_email}}
{{d-button action="sendActivationEmail" icon="envelope" label="admin.user.send_activation_email"}}
{{/if}}
{{#if model.can_activate}}
{{d-button action="activate" icon="check" label="admin.user.activate"}}
{{/if}}
{{/if}}
</div>
</div>
2017-09-27 04:46:37 +08:00
<div class="display-row">
<div class='field'>{{i18n 'admin.user.staged'}}</div>
<div class='value'>{{i18n-yes-no model.staged}}</div>
<div class='controls'>{{i18n 'admin.user.staged_explanation'}}</div>
</div>
{{#if currentUser.admin}}
<div class='display-row'>
<div class='field'>{{i18n 'admin.api.key'}}</div>
{{#if model.api_key}}
<div class='long-value'>
{{model.api_key.key}}
{{d-button action="regenerateApiKey" icon="undo" label="admin.api.regenerate"}}
{{d-button action="revokeApiKey" icon="times" label="admin.api.revoke"}}
</div>
{{else}}
<div class='value'>
&mdash;
</div>
<div class='controls'>
{{d-button action="generateApiKey" icon="key" label="admin.api.generate"}}
</div>
{{/if}}
</div>
{{/if}}
2013-10-23 03:53:08 +08:00
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.admin'}}</div>
2016-12-28 18:45:41 +08:00
<div class='value'>{{i18n-yes-no model.admin}}</div>
2013-02-06 03:16:51 +08:00
<div class='controls'>
{{#if model.can_revoke_admin}}
{{d-button action="revokeAdmin" icon="shield" label="admin.user.revoke_admin"}}
2013-02-06 03:16:51 +08:00
{{/if}}
{{#if model.can_grant_admin}}
{{d-button action="grantAdmin" icon="shield" label="admin.user.grant_admin"}}
{{/if}}
2013-02-06 03:16:51 +08:00
</div>
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.moderator'}}</div>
2016-12-28 18:45:41 +08:00
<div class='value'>{{i18n-yes-no model.moderator}}</div>
<div class='controls'>
{{#if model.can_revoke_moderation}}
{{d-button action="revokeModeration" icon="shield" label="admin.user.revoke_moderation"}}
{{/if}}
{{#if model.can_grant_moderation}}
{{d-button action="grantModeration" icon="shield" label="admin.user.grant_moderation"}}
{{/if}}
</div>
2013-02-06 03:16:51 +08:00
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'trust_level'}}</div>
<div class="value">
{{combo-box content=site.trustLevels value=model.trust_level nameProperty="detailedName"}}
{{#if model.dirty}}
<div>
{{d-button class="ok no-text" action="saveTrustLevel" icon="check"}}
{{d-button class="cancel no-text" action="restoreTrustLevel" icon="times"}}
</div>
{{/if}}
</div>
<div class="controls">
{{#if model.canLockTrustLevel}}
{{#if model.manual_locked_trust_level}}
{{d-icon "lock" title="admin.user.trust_level_locked_tip"}}
{{d-button action="lockTrustLevel" actionParam=false label="admin.user.unlock_trust_level"}}
{{else}}
{{d-icon "unlock" title="admin.user.trust_level_unlocked_tip"}}
{{d-button action="lockTrustLevel" actionParam=true label="admin.user.lock_trust_level"}}
{{/if}}
{{/if}}
{{#if model.tl3Requirements}}
{{#link-to 'adminUser.tl3Requirements' model class="btn"}}{{i18n 'admin.user.trust_level_3_requirements'}}{{/link-to}}
{{/if}}
</div>
</div>
<div class="user-suspended display-row {{if model.isSuspended 'highlight-danger'}}">
<div class='field'>{{i18n 'admin.user.suspended'}}</div>
<div class='value'>
{{i18n-yes-no model.isSuspended}}
{{#if model.isSuspended}}
2017-10-03 03:04:22 +08:00
{{#unless model.suspendedForever}}
{{i18n "admin.user.suspended_until" until=model.suspendedTillDate}}
{{/unless}}
{{/if}}
</div>
<div class='controls'>
{{#if model.isSuspended}}
2017-09-13 05:07:42 +08:00
{{d-button
class="btn-danger unsuspend-user"
action=(action "unsuspend")
2017-09-13 05:07:42 +08:00
icon="ban"
label="admin.user.unsuspend"}}
{{i18n 'admin.user.suspended_explanation'}}
{{else}}
{{#if model.canSuspend}}
{{d-button
class="btn-danger suspend-user"
action=(action "showSuspendModal")
icon="ban"
label="admin.user.suspend"}}
{{i18n 'admin.user.suspended_explanation'}}
{{/if}}
2013-02-06 03:16:51 +08:00
{{/if}}
</div>
</div>
{{#if model.isSuspended}}
<div class='display-row highlight-danger suspension-info'>
<div class='field'>{{i18n 'admin.user.suspended_by'}}</div>
<div class='value'>
{{#link-to 'adminUser' model.suspendedBy}}{{avatar model.suspendedBy imageSize="tiny"}}{{/link-to}}
{{#link-to 'adminUser' model.suspendedBy}}{{model.suspendedBy.username}}{{/link-to}}
</div>
<div class='controls'>
<b>{{i18n 'admin.user.suspend_reason'}}</b>:
<div class='full-reason'>{{model.full_suspend_reason}}</div>
</div>
</div>
{{/if}}
2017-11-11 01:18:08 +08:00
<div class="display-row {{if model.silenced 'highlight-danger'}}">
<div class='field'>{{i18n 'admin.user.silenced'}}</div>
<div class='value'>
{{i18n-yes-no model.silenced}}
{{#if model.isSilenced}}
{{#unless model.silencedForever}}
{{i18n "admin.user.suspended_until" until=model.silencedTillDate}}
{{/unless}}
{{/if}}
</div>
<div class='controls'>
2017-11-11 01:18:08 +08:00
{{#conditional-loading-spinner size="small" condition=model.silencingUser}}
{{#if model.silenced}}
{{d-button
class="btn-danger unsilence-user"
action="unsilence"
icon="microphone-slash"
label="admin.user.unsilence"}}
2017-11-11 01:18:08 +08:00
{{i18n 'admin.user.silence_explanation'}}
{{else}}
{{d-button
class="btn-danger silence-user"
action=(action "showSilenceModal")
icon="microphone-slash"
label="admin.user.silence"}}
2017-11-11 01:18:08 +08:00
{{i18n 'admin.user.silence_explanation'}}
{{/if}}
{{/conditional-loading-spinner}}
</div>
</div>
{{#if model.isSilenced}}
<div class='display-row highlight-danger silence-info'>
<div class='field'>{{i18n 'admin.user.silenced_by'}}</div>
<div class='value'>
{{#link-to 'adminUser' model.silencedBy}}{{avatar model.silencedBy imageSize="tiny"}}{{/link-to}}
{{#link-to 'adminUser' model.silencedBy}}{{model.silencedBy.username}}{{/link-to}}
</div>
<div class='controls'>
<b>{{i18n 'admin.user.silence_reason'}}</b>:
<div class='full-reason'>{{model.silence_reason}}</div>
</div>
</div>
{{/if}}
2013-02-06 03:16:51 +08:00
</section>
{{#if currentUser.admin}}
<section class='details'>
<h1>{{i18n 'admin.groups.title'}}</h1>
<div class='display-row'>
<div class='field'>{{i18n 'admin.groups.automatic'}}</div>
<div class='value'>{{automaticGroups}}</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.groups.custom'}}</div>
<div class='value'>
{{admin-group-selector selected=model.customGroups available=availableGroups}}
</div>
<div class='controls'>
{{#if model.customGroups}}
{{i18n 'admin.groups.primary'}}
2017-10-20 03:51:08 +08:00
{{combo-box content=model.customGroups value=model.primary_group_id none="admin.groups.no_primary"}}
{{/if}}
{{#if primaryGroupDirty}}
{{d-button icon="check" class="ok" action="savePrimaryGroup"}}
{{d-button icon="times" class="cancel" action="resetPrimaryGroup"}}
{{/if}}
</div>
</div>
</section>
{{/if}}
2013-02-06 03:16:51 +08:00
<section class='details'>
<h1>{{i18n 'admin.user.activity'}}</h1>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'created'}}</div>
<div class='value'>{{format-date model.created_at leaveAgo="true"}}</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.users.last_emailed'}}</div>
<div class='value'>{{format-date model.last_emailed_at}}</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'last_seen'}}</div>
<div class='value'>{{format-date model.last_seen_at leaveAgo="true"}}</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.like_count'}}</div>
<div class='value'>{{model.like_given_count}} / {{model.like_count}}</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.topics_entered'}}</div>
<div class='value'>{{model.topics_entered}}</div>
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.post_count'}}</div>
<div class='value'>{{model.post_count}}</div>
<div class='controls'>
{{#if model.can_delete_all_posts}}
{{#if model.post_count}}
{{d-button class="btn-danger" action="deleteAllPosts" icon="trash-o" label="admin.user.delete_all_posts"}}
{{/if}}
{{else}}
{{model.deleteAllPostsExplanation}}
{{/if}}
</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.posts_read_count'}}</div>
<div class='value'>{{model.posts_read_count}}</div>
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.warnings_received_count'}}</div>
<div class='value'>{{model.warnings_received_count}}</div>
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.flags_given_received_count'}}</div>
<div class='value'>
{{model.flags_given_count}} / {{model.flags_received_count}}
</div>
<div class='controls'>
{{#if model.flags_received_count}}
{{d-button
action=(action "showFlagsReceived")
label="admin.user.show_flags_received"
icon="flag"
}}
{{/if}}
</div>
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.private_topics_count'}}</div>
<div class='value'>{{model.private_topics_count}}</div>
2013-02-06 03:16:51 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.time_read'}}</div>
<div class='value'>{{{format-duration model.time_read}}}</div>
</div>
2013-02-06 03:16:51 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'user.invited.days_visited'}}</div>
<div class='value'>{{{model.days_visited}}}</div>
</div>
2013-02-06 03:16:51 +08:00
</section>
{{#if model.single_sign_on_record}}
2014-08-23 08:34:48 +08:00
<section class='details'>
<h1>{{i18n 'admin.user.sso.title'}}</h1>
2014-08-23 08:34:48 +08:00
{{#with model.single_sign_on_record as |sso|}}
2014-08-23 08:34:48 +08:00
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.sso.external_id'}}</div>
<div class='value'>{{sso.external_id}}</div>
2014-08-23 08:34:48 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.sso.external_username'}}</div>
<div class='value'>{{sso.external_username}}</div>
2014-08-23 08:34:48 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.sso.external_name'}}</div>
<div class='value'>{{sso.external_name}}</div>
2014-08-23 08:34:48 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.sso.external_email'}}</div>
<div class='value'>{{sso.external_email}}</div>
2014-08-23 08:34:48 +08:00
</div>
<div class='display-row'>
<div class='field'>{{i18n 'admin.user.sso.external_avatar_url'}}</div>
<div class='value'>{{sso.external_avatar_url}}</div>
2014-08-23 08:34:48 +08:00
</div>
{{/with}}
</section>
{{/if}}
<section>
<hr>
2015-03-11 01:06:08 +08:00
<div class="pull-right">
{{#if model.active}}
{{#if model.can_impersonate}}
{{d-button class="btn-danger" action="impersonate" icon="crosshairs" label="admin.impersonate.title" title="admin.impersonate.help"}}
{{/if}}
{{/if}}
{{#unless model.anonymizeForbidden}}
2015-03-11 01:06:08 +08:00
{{d-button label="admin.user.anonymize"
icon="exclamation-triangle"
class="btn-danger"
disabled=model.anonymizeForbidden
2015-03-11 01:06:08 +08:00
action="anonymize"}}
{{/unless}}
{{#unless model.deleteForbidden}}
2015-03-11 01:06:08 +08:00
{{d-button label="admin.user.delete"
icon="exclamation-triangle"
class="btn-danger"
disabled=model.deleteForbidden
2015-03-11 01:06:08 +08:00
action="destroy"}}
{{/unless}}
</div>
{{#if model.deleteExplanation}}
<div class="clearfix"></div>
<br>
<div class="pull-right">
{{d-icon "exclamation-triangle"}} {{model.deleteExplanation}}
</div>
{{/if}}
</section>
<div class="clearfix"></div>