From 725f2ab476a7f3b65c75b30952bab6acccf1952e Mon Sep 17 00:00:00 2001 From: Bofh Date: Mon, 12 Dec 2022 21:28:15 +0100 Subject: [PATCH] Add suspend button on #instance/filter-users for manually suspending an account --- js/templates/instance/filter-users.html | 4 ++++ views/instance.php | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/js/templates/instance/filter-users.html b/js/templates/instance/filter-users.html index b725a90..b1e4087 100644 --- a/js/templates/instance/filter-users.html +++ b/js/templates/instance/filter-users.html @@ -170,6 +170,10 @@
{mastodon:fields}
{note}
+
+ +
diff --git a/views/instance.php b/views/instance.php index 48ab46b..fd36f0a 100644 --- a/views/instance.php +++ b/views/instance.php @@ -19,6 +19,16 @@ window.view.instance = { window.location.hash = window.location.hash.replace('#instance/','#instance_config/'); }, do: { + users: { + suspend: function(_id) { + if (!confirm('Are you sure you want to suspend this user?')) return; + const hargs = get_hash_arguments(); + http.get(`api/v1/http/mastodon/accounts/suspend?instance=${hargs.instance}&id=${_id}`, + {}, function(js) { + toast.info('User has been successfully suspended'); + }); + }, + }, new_accounts: { approve: function(_id) { window.view.instance.do.new_accounts._perform('approve', _id); @@ -194,6 +204,7 @@ window.view.instance = { var tpl = TPL; const it = js['data'][i]; tpl = tpl.replaceAll('{software}', hargs.software); + tpl = tpl.replaceAll('{id}', it.id); tpl = tpl.replaceAll('{name}', html2text(it.name)); tpl = tpl.replaceAll('{acct}', html2text(it.acct)); if (it.avatar === null)