diff --git a/app/assets/javascripts/admin/addon/components/admin-penalty-history.js b/app/assets/javascripts/admin/addon/components/admin-penalty-history.js
new file mode 100644
index 00000000000..32c288b248d
--- /dev/null
+++ b/app/assets/javascripts/admin/addon/components/admin-penalty-history.js
@@ -0,0 +1,22 @@
+import Component from "@ember/component";
+import discourseComputed from "discourse-common/utils/decorators";
+
+export default Component.extend({
+ classNames: ["penalty-history"],
+
+ @discourseComputed("user.penalty_counts.suspended")
+ suspendedCountClass(count) {
+ if (count > 0) {
+ return "danger";
+ }
+ return "";
+ },
+
+ @discourseComputed("user.penalty_counts.silenced")
+ silencedCountClass(count) {
+ if (count > 0) {
+ return "danger";
+ }
+ return "";
+ },
+});
diff --git a/app/assets/javascripts/admin/addon/controllers/modals/admin-silence-user.js b/app/assets/javascripts/admin/addon/controllers/modals/admin-silence-user.js
index b76565f8157..506598625d4 100644
--- a/app/assets/javascripts/admin/addon/controllers/modals/admin-silence-user.js
+++ b/app/assets/javascripts/admin/addon/controllers/modals/admin-silence-user.js
@@ -12,6 +12,10 @@ export default Controller.extend(PenaltyController, {
this.setProperties({ silenceUntil: null, silencing: false });
},
+ finishedSetup() {
+ this.set("silenceUntil", this.user?.next_penalty);
+ },
+
@discourseComputed("silenceUntil", "reason", "silencing")
submitDisabled(silenceUntil, reason, silencing) {
return silencing || isEmpty(silenceUntil) || !reason || reason.length < 1;
diff --git a/app/assets/javascripts/admin/addon/controllers/modals/admin-suspend-user.js b/app/assets/javascripts/admin/addon/controllers/modals/admin-suspend-user.js
index 2712b57cf23..c82a5628084 100644
--- a/app/assets/javascripts/admin/addon/controllers/modals/admin-suspend-user.js
+++ b/app/assets/javascripts/admin/addon/controllers/modals/admin-suspend-user.js
@@ -12,6 +12,10 @@ export default Controller.extend(PenaltyController, {
this.setProperties({ suspendUntil: null, suspending: false });
},
+ finishedSetup() {
+ this.set("suspendUntil", this.user?.next_penalty);
+ },
+
@discourseComputed("suspendUntil", "reason", "suspending")
submitDisabled(suspendUntil, reason, suspending) {
return suspending || isEmpty(suspendUntil) || !reason || reason.length < 1;
diff --git a/app/assets/javascripts/admin/addon/services/admin-tools.js b/app/assets/javascripts/admin/addon/services/admin-tools.js
index 8928af14e5a..fe282fefd6b 100644
--- a/app/assets/javascripts/admin/addon/services/admin-tools.js
+++ b/app/assets/javascripts/admin/addon/services/admin-tools.js
@@ -48,7 +48,6 @@ export default Service.extend({
_showControlModal(type, user, opts) {
opts = opts || {};
-
let controller = showModal(`admin-${type}-user`, {
admin: true,
modalClass: `${type}-user-modal`,
@@ -65,6 +64,8 @@ export default Service.extend({
before: opts.before,
successCallback: opts.successCallback,
});
+
+ controller.finishedSetup();
});
},
diff --git a/app/assets/javascripts/admin/addon/templates/components/admin-penalty-history.hbs b/app/assets/javascripts/admin/addon/templates/components/admin-penalty-history.hbs
new file mode 100644
index 00000000000..6c622714acf
--- /dev/null
+++ b/app/assets/javascripts/admin/addon/templates/components/admin-penalty-history.hbs
@@ -0,0 +1,8 @@
+
+
+ {{user.penalty_counts.suspended}}
+
+
+
+ {{user.penalty_counts.silenced}}
+
diff --git a/app/assets/javascripts/admin/addon/templates/modal/admin-silence-user.hbs b/app/assets/javascripts/admin/addon/templates/modal/admin-silence-user.hbs
index db3a184437b..6c7ad174589 100644
--- a/app/assets/javascripts/admin/addon/templates/modal/admin-silence-user.hbs
+++ b/app/assets/javascripts/admin/addon/templates/modal/admin-silence-user.hbs
@@ -5,6 +5,8 @@
{{errorMessage}}
{{/if}}
+ {{admin-penalty-history user=user}}
+