mirror of
https://github.com/discourse/discourse.git
synced 2024-12-09 18:53:49 +08:00
35b748e7f4
This commit fixes a bug where the silence button is incorrectly displayed on the admin page of a staff user. It's not actually possible to silence a staff user because the backend correctly prevents it, but the frontend isn't checking if the button should be displayed. Another small bug that this commit fixes is the similar users list not showing up inside the silence/suspend modals due to also a bug in the frontend. I've also changed the way similar users are loaded so that they're not returned by the `admin/users#show` endpoint anymore and moved them into a new endpoint that the penalize modals (suspend and silence) can call directly to retrieve the list of users. This is done because the similar users list is never shown on the admin user page (`/admin/users/:user_id/:username`); they're only needed when the suspend or silence modals are opened. Internal topic: t/130014.
46 lines
1.4 KiB
Handlebars
46 lines
1.4 KiB
Handlebars
<div class="penalty-similar-users">
|
|
<p class="alert alert-warning">
|
|
{{html-safe
|
|
(i18n
|
|
"admin.user.other_matches"
|
|
(hash count=@user.similar_users_count username=@user.username)
|
|
)
|
|
}}
|
|
</p>
|
|
|
|
<ConditionalLoadingSpinner @condition={{this.isLoading}}>
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>{{i18n "username"}}</th>
|
|
<th>{{i18n "last_seen"}}</th>
|
|
<th>{{i18n "admin.user.topics_entered"}}</th>
|
|
<th>{{i18n "admin.user.posts_read_count"}}</th>
|
|
<th>{{i18n "admin.user.time_read"}}</th>
|
|
<th>{{i18n "created"}}</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
{{#each this.similarUsers as |user|}}
|
|
<tr>
|
|
<td>
|
|
<Input
|
|
@type="checkbox"
|
|
disabled={{not (get user this.penaltyField)}}
|
|
{{on "click" (fn this.selectUserId user.id)}}
|
|
/>
|
|
</td>
|
|
<td>{{avatar user imageSize="small"}} {{user.username}}</td>
|
|
<td>{{format-duration user.last_seen_age}}</td>
|
|
<td>{{number user.topics_entered}}</td>
|
|
<td>{{number user.posts_read_count}}</td>
|
|
<td>{{format-duration user.time_read}}</td>
|
|
<td>{{format-duration user.created_at_age}}</td>
|
|
</tr>
|
|
{{/each}}
|
|
</tbody>
|
|
</table>
|
|
</ConditionalLoadingSpinner>
|
|
</div> |