Add "silence" button for accounts in #instance/filter-users view

This commit is contained in:
Bofh 2022-12-13 00:03:19 +01:00
parent 489297deb9
commit a5c9f07f2e
4 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,3 @@
<?php chdir('../../../../../../') ?>
<?php require 'base.php' ?>
<?php mod_php() ?>

View File

@ -0,0 +1,15 @@
<?php
$_ = function() {
$id = trim($_GET['id']);
if (!valid_mastodon_account_id($id))
return apiresult(['error' => 'id parameter has incorrect format'], 400);
$output = instance_http_post('/api/v1/admin/accounts/'.$id.'/action',
['type' => 'silence' ]);
if (!isset($_SERVER['REQUEST_URI']))
sleep(2);
return apiresult($output);
};
$_();

View File

@ -171,6 +171,8 @@
<div class="only mastodon">{mastodon:fields}</div> <div class="only mastodon">{mastodon:fields}</div>
<div class="note">{note}</div> <div class="note">{note}</div>
<div style="margin-top: 1em; text-align: right;"> <div style="margin-top: 1em; text-align: right;">
<button onclick="window.view.instance.do.users.silence('{id}')"
class="btn mid"><i class="fa fa-volume-mute fa-fw"></i>Silence</button>
<button onclick="window.view.instance.do.users.suspend('{id}')" <button onclick="window.view.instance.do.users.suspend('{id}')"
class="btn mid red"><i class="fa fa-ban fa-fw"></i>Suspend</button> class="btn mid red"><i class="fa fa-ban fa-fw"></i>Suspend</button>
</div> </div>

View File

@ -28,6 +28,13 @@ window.view.instance = {
toast.info('User has been successfully suspended'); toast.info('User has been successfully suspended');
}); });
}, },
silence: function(_id) {
const hargs = get_hash_arguments();
http.get(`api/v1/http/mastodon/accounts/silence?instance=${hargs.instance}&id=${_id}`,
{}, function(js) {
toast.info('User has been successfully silenced');
});
},
}, },
new_accounts: { new_accounts: {
approve: function(_id) { approve: function(_id) {