mirror of
https://github.com/discourse/discourse.git
synced 2024-12-26 15:03:44 +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.
80 lines
2.5 KiB
Handlebars
80 lines
2.5 KiB
Handlebars
<DModal
|
|
class="{{@model.penaltyType}}-user-modal"
|
|
@title={{i18n this.modalTitle}}
|
|
@closeModal={{this.warnBeforeClosing}}
|
|
@flash={{this.flash}}
|
|
>
|
|
<:body>
|
|
{{#if this.canPenalize}}
|
|
<div class="penalty-duration-controls">
|
|
{{#if (eq @model.penaltyType "suspend")}}
|
|
<FutureDateInput
|
|
@label="admin.user.suspend_duration"
|
|
@clearable={{false}}
|
|
@input={{this.penalizeUntil}}
|
|
@onChangeInput={{fn (mut this.penalizeUntil)}}
|
|
class="suspend-until"
|
|
/>
|
|
{{else if (eq @model.penaltyType "silence")}}
|
|
<FutureDateInput
|
|
@label="admin.user.silence_duration"
|
|
@clearable={{false}}
|
|
@input={{this.penalizeUntil}}
|
|
@onChangeInput={{fn (mut this.penalizeUntil)}}
|
|
class="silence-until"
|
|
/>
|
|
{{/if}}
|
|
</div>
|
|
{{#if (eq @model.penaltyType "suspend")}}
|
|
<div class="penalty-reason-visibility">
|
|
{{#if this.siteSettings.hide_suspension_reasons}}
|
|
{{html-safe (i18n "admin.user.suspend_reason_hidden_label")}}
|
|
{{else}}
|
|
{{html-safe (i18n "admin.user.suspend_reason_label")}}
|
|
{{/if}}
|
|
</div>
|
|
{{/if}}
|
|
<AdminPenaltyReason
|
|
@penaltyType={{@model.penaltyType}}
|
|
@reason={{this.reason}}
|
|
@message={{this.message}}
|
|
/>
|
|
{{#if @model.postId}}
|
|
<AdminPenaltyPostAction
|
|
@postId={{@model.postId}}
|
|
@postAction={{this.postAction}}
|
|
@postEdit={{this.postEdit}}
|
|
/>
|
|
{{/if}}
|
|
{{#if @model.user.similar_users_count}}
|
|
<AdminPenaltySimilarUsers
|
|
@penaltyType={{@model.penaltyType}}
|
|
@user={{@model.user}}
|
|
@selectedUserIds={{this.otherUserIds}}
|
|
@onUsersChanged={{this.similarUsersChanged}}
|
|
/>
|
|
{{/if}}
|
|
{{else}}
|
|
{{#if (eq @model.penaltyType "suspend")}}
|
|
<div class="cant-suspend">{{i18n "admin.user.cant_suspend"}}</div>
|
|
{{else if (eq @model.penaltyType "silence")}}
|
|
<div class="cant-silence">{{i18n "admin.user.cant_silence"}}</div>
|
|
{{/if}}
|
|
{{/if}}
|
|
</:body>
|
|
<:footer>
|
|
<div class="penalty-history">{{html-safe this.penaltyHistory}}</div>
|
|
<DButton
|
|
class="btn-danger perform-penalize"
|
|
@action={{this.penalizeUser}}
|
|
@disabled={{this.submitDisabled}}
|
|
@icon="ban"
|
|
@label={{this.buttonLabel}}
|
|
/>
|
|
<DButton
|
|
class="btn-flat d-modal-cancel"
|
|
@action={{this.warnBeforeClosing}}
|
|
@label="cancel"
|
|
/>
|
|
</:footer>
|
|
</DModal> |