copy `iAmModerator` check to other instance-info controls

This commit is contained in:
Hazelnoot 2024-10-11 11:25:10 -04:00
parent 66a88c89b5
commit 7837852149
1 changed files with 4 additions and 0 deletions

View File

@ -337,6 +337,7 @@ async function resumeDelivery(): Promise<void> {
} }
async function toggleNSFW(): Promise<void> { async function toggleNSFW(): Promise<void> {
if (!iAmModerator) return;
if (!instance.value) throw new Error('No instance?'); if (!instance.value) throw new Error('No instance?');
await misskeyApi('admin/federation/update-instance', { await misskeyApi('admin/federation/update-instance', {
host: instance.value.host, host: instance.value.host,
@ -345,6 +346,7 @@ async function toggleNSFW(): Promise<void> {
} }
async function toggleRejectReports(): Promise<void> { async function toggleRejectReports(): Promise<void> {
if (!iAmModerator) return;
if (!instance.value) throw new Error('No instance?'); if (!instance.value) throw new Error('No instance?');
await misskeyApi('admin/federation/update-instance', { await misskeyApi('admin/federation/update-instance', {
host: instance.value.host, host: instance.value.host,
@ -364,6 +366,7 @@ function refreshMetadata(): void {
} }
async function deleteAllFiles(): Promise<void> { async function deleteAllFiles(): Promise<void> {
if (!iAmModerator) return;
if (!instance.value) throw new Error('No instance?'); if (!instance.value) throw new Error('No instance?');
const confirm = await os.confirm({ const confirm = await os.confirm({
@ -383,6 +386,7 @@ async function deleteAllFiles(): Promise<void> {
} }
async function severAllFollowRelations(): Promise<void> { async function severAllFollowRelations(): Promise<void> {
if (!iAmModerator) return;
if (!instance.value) throw new Error('No instance?'); if (!instance.value) throw new Error('No instance?');
const confirm = await os.confirm({ const confirm = await os.confirm({