enhance(client): show warning in control panel when there is an unresolved abuse report

This commit is contained in:
syuilo 2022-06-21 19:48:28 +09:00
parent f880d0631c
commit 2d181ba5af
4 changed files with 17 additions and 1 deletions

View file

@ -14,6 +14,7 @@ You should also include the user name that made the change.
### Improvements ### Improvements
- Server: Add rate limit to i/notifications @tamaina - Server: Add rate limit to i/notifications @tamaina
- Client: Improve files page of control panel @syuilo - Client: Improve files page of control panel @syuilo
- Client: Show warning in control panel when there is an unresolved abuse report @syuilo
- Improve player detection in URL preview @mei23 - Improve player detection in URL preview @mei23
- Add Badge Image to Push Notification #8012 @tamaina - Add Badge Image to Push Notification #8012 @tamaina

View file

@ -850,6 +850,10 @@ cropImageAsk: "画像をクロップしますか?"
file: "ファイル" file: "ファイル"
recentNHours: "直近{n}時間" recentNHours: "直近{n}時間"
recentNDays: "直近{n}日" recentNDays: "直近{n}日"
noEmailServerWarning: "メールサーバーの設定がされていません。"
thereIsUnresolvedAbuseReportWarning: "未対応の通報があります。"
recommended: "推奨"
check: "チェック"
_emailUnavailable: _emailUnavailable:
used: "既に使用されています" used: "既に使用されています"

View file

@ -5,7 +5,7 @@
<FormSuspense :p="init"> <FormSuspense :p="init">
<div class="_formRoot"> <div class="_formRoot">
<FormSwitch v-model="enableEmail" class="_formBlock"> <FormSwitch v-model="enableEmail" class="_formBlock">
<template #label>{{ i18n.ts.enableEmail }}</template> <template #label>{{ i18n.ts.enableEmail }} ({{ i18n.ts.recommended }})</template>
<template #caption>{{ i18n.ts.emailConfigInfo }}</template> <template #caption>{{ i18n.ts.emailConfigInfo }}</template>
</FormSwitch> </FormSwitch>

View file

@ -7,8 +7,10 @@
<img :src="$instance.iconUrl || '/favicon.ico'" alt="" class="icon"/> <img :src="$instance.iconUrl || '/favicon.ico'" alt="" class="icon"/>
</div> </div>
<MkInfo v-if="thereIsUnresolvedAbuseReport" warn class="info">{{ $ts.thereIsUnresolvedAbuseReportWarning }} <MkA to="/admin/abuses" class="_link">{{ $ts.check }}</MkA></MkInfo>
<MkInfo v-if="noMaintainerInformation" warn class="info">{{ $ts.noMaintainerInformationWarning }} <MkA to="/admin/settings" class="_link">{{ $ts.configure }}</MkA></MkInfo> <MkInfo v-if="noMaintainerInformation" warn class="info">{{ $ts.noMaintainerInformationWarning }} <MkA to="/admin/settings" class="_link">{{ $ts.configure }}</MkA></MkInfo>
<MkInfo v-if="noBotProtection" warn class="info">{{ $ts.noBotProtectionWarning }} <MkA to="/admin/security" class="_link">{{ $ts.configure }}</MkA></MkInfo> <MkInfo v-if="noBotProtection" warn class="info">{{ $ts.noBotProtectionWarning }} <MkA to="/admin/security" class="_link">{{ $ts.configure }}</MkA></MkInfo>
<MkInfo v-if="noEmailServer" warn class="info">{{ $ts.noEmailServerWarning }} <MkA to="/admin/email-settings" class="_link">{{ $ts.configure }}</MkA></MkInfo>
<MkSuperMenu :def="menuDef" :grid="initialPage == null"></MkSuperMenu> <MkSuperMenu :def="menuDef" :grid="initialPage == null"></MkSuperMenu>
</div> </div>
@ -58,6 +60,15 @@ let el = $ref(null);
let pageProps = $ref({}); let pageProps = $ref({});
let noMaintainerInformation = isEmpty(instance.maintainerName) || isEmpty(instance.maintainerEmail); let noMaintainerInformation = isEmpty(instance.maintainerName) || isEmpty(instance.maintainerEmail);
let noBotProtection = !instance.enableHcaptcha && !instance.enableRecaptcha; let noBotProtection = !instance.enableHcaptcha && !instance.enableRecaptcha;
let noEmailServer = !instance.enableEmail;
let thereIsUnresolvedAbuseReport = $ref(false);
os.api('admin/abuse-user-reports', {
state: 'unresolved',
limit: 1,
}).then(reports => {
if (reports.length > 0) thereIsUnresolvedAbuseReport = true;
});
const NARROW_THRESHOLD = 600; const NARROW_THRESHOLD = 600;
const ro = new ResizeObserver((entries, observer) => { const ro = new ResizeObserver((entries, observer) => {