1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-01 00:08:14 +09:00

feat(ui): unresolved report notification

This commit is contained in:
オスカー、 2024-05-21 02:58:11 +09:00 committed by 무라쿠모
parent b0208a5fc7
commit 693cc1e1a2
Signed by: SWREI
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"
noEmailServerWarning: "Email server not configured."
thereIsUnresolvedAbuseReportWarning: "There are unsolved reports."
thereIsUnresolvedAbuseReport: "There are {left} reports that is not resolved. Please check it on control panel."
recommended: "Recommended"
check: "Check"
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;
/**
* {left}
*/
"thereIsUnresolvedAbuseReport": ParameterizedString<"left">;
/**
*
*/

View File

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

View File

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

View File

@ -17,6 +17,12 @@ SPDX-License-Identifier: AGPL-3.0-only
</span>
<span :class="$style.title">{{ i18n.ts.verificationEmailSent }}</span>
</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
v-for="announcement in $i.unreadAnnouncements.filter(x => x.display === 'banner')"
:key="announcement.id"
@ -36,10 +42,22 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { instanceName } from '@/config.js';
import { instance } from '@/instance.js';
import { $i } from '@/account.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>
<style lang="scss" module>

View File

@ -39,6 +39,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<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">
<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>
<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>
@ -70,8 +73,10 @@ import { defaultStore } from '@/store.js';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.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 otherMenuItemIndicated = computed(() => {
@ -94,6 +99,15 @@ watch(defaultStore.reactiveState.menuDisplay, () => {
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) {
openAccountMenu_({
withExtraOperation: true,