feat(ui): unresolved report notification

This commit is contained in:
무라쿠모 2024-05-21 02:58:11 +09:00 committed by 무라쿠모
parent f2e911803f
commit 6388215676
No known key found for this signature in database
GPG key ID: 139D6573F92DA9F7
6 changed files with 40 additions and 1 deletions

View file

@ -944,6 +944,7 @@ recentNHours: "Last {n} hours"
recentNDays: "Last {n} days" recentNDays: "Last {n} days"
noEmailServerWarning: "Email server not configured." noEmailServerWarning: "Email server not configured."
thereIsUnresolvedAbuseReportWarning: "There are unsolved reports." thereIsUnresolvedAbuseReportWarning: "There are unsolved reports."
thereIsUnresolvedAbuseReport: "There are {left} reports that is not resolved. Please check it on control panel."
recommended: "Recommended" recommended: "Recommended"
check: "Check" check: "Check"
driveCapOverrideLabel: "Change the drive capacity for this user" driveCapOverrideLabel: "Change the drive capacity for this user"

4
locales/index.d.ts vendored
View file

@ -3800,6 +3800,10 @@ export interface Locale extends ILocale {
* *
*/ */
"thereIsUnresolvedAbuseReportWarning": string; "thereIsUnresolvedAbuseReportWarning": string;
/**
* {left}
*/
"thereIsUnresolvedAbuseReport": ParameterizedString<"left">;
/** /**
* *
*/ */

View file

@ -946,6 +946,7 @@ recentNHours: "直近{n}時間"
recentNDays: "直近{n}日" recentNDays: "直近{n}日"
noEmailServerWarning: "メールサーバーの設定がされていません。" noEmailServerWarning: "メールサーバーの設定がされていません。"
thereIsUnresolvedAbuseReportWarning: "未対応の通報があります。" thereIsUnresolvedAbuseReportWarning: "未対応の通報があります。"
thereIsUnresolvedAbuseReport: "まだ未解決の報告が{left}件あります。コントロールパネルでご確認ください。"
recommended: "推奨" recommended: "推奨"
check: "チェック" check: "チェック"
driveCapOverrideLabel: "このユーザーのドライブ容量上限を変更" driveCapOverrideLabel: "このユーザーのドライブ容量上限を変更"

View file

@ -943,6 +943,7 @@ recentNHours: "최근 {n}시간"
recentNDays: "최근 {n}일" recentNDays: "최근 {n}일"
noEmailServerWarning: "메일 서버가 설정되어 있지 않습니다." noEmailServerWarning: "메일 서버가 설정되어 있지 않습니다."
thereIsUnresolvedAbuseReportWarning: "해결되지 않은 신고가 있습니다." thereIsUnresolvedAbuseReportWarning: "해결되지 않은 신고가 있습니다."
thereIsUnresolvedAbuseReport: "아직 해결되지 않은 신고가 {left}건 있습니다. 제어판에서 확인해주세요."
recommended: "추천" recommended: "추천"
check: "체크" check: "체크"
driveCapOverrideLabel: "이 유저의 드라이브 용량을 변경" driveCapOverrideLabel: "이 유저의 드라이브 용량을 변경"

View file

@ -17,6 +17,12 @@ SPDX-License-Identifier: AGPL-3.0-only
</span> </span>
<span :class="$style.title">{{ i18n.ts.verificationEmailSent }}</span> <span :class="$style.title">{{ i18n.ts.verificationEmailSent }}</span>
</MkA> </MkA>
<MkA v-if="unresolvedReportCount > 0" :class="$style.item" to="/admin/">
<span :class="$style.icon">
<i class="ti ti-circle-x" style="color: var(--error);"></i>
</span>
<span :class="$style.title">{{ i18n.tsx.thereIsUnresolvedAbuseReport({ left: unresolvedReportCount }) }}</span>
</MkA>
<MkA <MkA
v-for="announcement in $i.unreadAnnouncements.filter(x => x.display === 'banner')" v-for="announcement in $i.unreadAnnouncements.filter(x => x.display === 'banner')"
:key="announcement.id" :key="announcement.id"
@ -36,10 +42,22 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue';
import { instanceName } from '@/config.js'; import { instanceName } from '@/config.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
const unresolvedReportCount = ref<number>(0);
if ($i?.isAdmin || $i?.isModerator) {
misskeyApi('admin/abuse-user-reports', {
state: 'unresolved',
}).then(reports => {
unresolvedReportCount.value = reports.length;
});
}
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -39,6 +39,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<div :class="$style.divider"></div> <div :class="$style.divider"></div>
<MkA v-if="$i.isAdmin || $i.isModerator" v-tooltip.noDelay.right="i18n.ts.controlPanel" :class="$style.item" :activeClass="$style.active" to="/admin"> <MkA v-if="$i.isAdmin || $i.isModerator" v-tooltip.noDelay.right="i18n.ts.controlPanel" :class="$style.item" :activeClass="$style.active" to="/admin">
<i :class="$style.itemIcon" class="ti ti-dashboard ti-fw"></i><span :class="$style.itemText">{{ i18n.ts.controlPanel }}</span> <i :class="$style.itemIcon" class="ti ti-dashboard ti-fw"></i><span :class="$style.itemText">{{ i18n.ts.controlPanel }}</span>
<span v-if="unresolvedReportAvailable" :class="$style.itemIndicator">
<i class="_indicatorCircle"></i>
</span>
</MkA> </MkA>
<button class="_button" :class="$style.item" @click="more"> <button class="_button" :class="$style.item" @click="more">
<i :class="$style.itemIcon" class="ti ti-grid-dots ti-fw"></i><span :class="$style.itemText">{{ i18n.ts.more }}</span> <i :class="$style.itemIcon" class="ti ti-grid-dots ti-fw"></i><span :class="$style.itemText">{{ i18n.ts.more }}</span>
@ -70,8 +73,10 @@ import { defaultStore } from '@/store.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
import { miLocalStorage } from '@/local-storage.js'; import { miLocalStorage } from '@/local-storage.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
const iconOnly = ref(false); const iconOnly = ref<boolean>(false);
const unresolvedReportAvailable = ref<boolean>(false);
const menu = computed(() => defaultStore.state.menu); const menu = computed(() => defaultStore.state.menu);
const otherMenuItemIndicated = computed(() => { const otherMenuItemIndicated = computed(() => {
@ -94,6 +99,15 @@ watch(defaultStore.reactiveState.menuDisplay, () => {
calcViewState(); calcViewState();
}); });
if ($i?.isAdmin || $i?.isModerator) {
misskeyApi('admin/abuse-user-reports', {
state: 'unresolved',
limit: 1,
}).then(reports => {
if (reports.length > 0) unresolvedReportAvailable.value = true;
});
}
function openAccountMenu(ev: MouseEvent) { function openAccountMenu(ev: MouseEvent) {
openAccountMenu_({ openAccountMenu_({
withExtraOperation: true, withExtraOperation: true,