From 3796a3edeac52314a992b9aae61ca9a6d7d6b1d1 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Mon, 20 Jun 2022 16:48:38 +0200 Subject: [PATCH] fix: block button in federation panel (#8855) --- packages/client/src/pages/instance-info.vue | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/client/src/pages/instance-info.vue b/packages/client/src/pages/instance-info.vue index 9d7af4fc7d..231b1dfd18 100644 --- a/packages/client/src/pages/instance-info.vue +++ b/packages/client/src/pages/instance-info.vue @@ -138,12 +138,17 @@ let chartSrc = $ref('instance-requests'); let chartSpan = $ref('hour'); async function fetch() { - meta = await os.api('meta', { detail: true }); - instance = await os.api('federation/show-instance', { - host: props.host, - }); - suspended = instance.isSuspended; - isBlocked = meta.blockedHosts.includes(instance.host); + if (iAmModerator) { + // suspended and blocked information is only displayed to moderators. + // otherwise the API will error anyway + + meta = await os.api('admin/meta', { detail: true }); + instance = await os.api('federation/show-instance', { + host: props.host, + }); + suspended = instance.isSuspended; + isBlocked = meta.blockedHosts.includes(instance.host); + } } async function toggleBlock(ev) {