fix: block button in federation panel (#8855)

This commit is contained in:
Johann150 2022-06-20 16:48:38 +02:00 committed by GitHub
parent f995172c5d
commit 3796a3edea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -138,12 +138,17 @@ let chartSrc = $ref('instance-requests');
let chartSpan = $ref('hour'); let chartSpan = $ref('hour');
async function fetch() { async function fetch() {
meta = await os.api('meta', { detail: true }); if (iAmModerator) {
instance = await os.api('federation/show-instance', { // suspended and blocked information is only displayed to moderators.
host: props.host, // otherwise the API will error anyway
});
suspended = instance.isSuspended; meta = await os.api('admin/meta', { detail: true });
isBlocked = meta.blockedHosts.includes(instance.host); instance = await os.api('federation/show-instance', {
host: props.host,
});
suspended = instance.isSuspended;
isBlocked = meta.blockedHosts.includes(instance.host);
}
} }
async function toggleBlock(ev) { async function toggleBlock(ev) {