Skip to content

Commit

Permalink
improve moderation log
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Sep 24, 2023
1 parent 30b2312 commit 82a51d4
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"twemoji-parser": "14.0.0",
"typescript": "5.2.2",
"uuid": "9.0.1",
"v-code-diff": "^1.7.1",
"vanilla-tilt": "1.8.1",
"vite": "4.4.9",
"vue": "3.3.4",
Expand Down
22 changes: 21 additions & 1 deletion packages/frontend/src/pages/admin/modlog.ModLog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ SPDX-License-Identifier: AGPL-3.0-only
<div :class="$style.root">
<div>{{ i18n.ts.moderator }}: {{ log.userId }}</div>

<template v-if="log.type === 'suspend'">
<template v-if="log.type === 'updateServerSettings'">
<div :class="$style.diff">
<CodeDiff :oldString="JSON5.stringify(log.info.before, null, '\t')" :newString="JSON5.stringify(log.info.after, null, '\t')" language="javascript" maxHeight="300px"/>
</div>
</template>
<template v-else-if="log.type === 'updateUserNote'">
<div>{{ i18n.ts.user }}: {{ log.info.userId }}</div>
<div :class="$style.diff">
<CodeDiff :oldString="log.info.before ?? ''" :newString="log.info.after ?? ''" maxHeight="300px"/>
</div>
</template>
<template v-else-if="log.type === 'suspend'">
<div>{{ i18n.ts.user }}: {{ log.info.targetId }}</div>
</template>
<template v-else-if="log.type === 'unsuspend'">
Expand All @@ -36,6 +47,8 @@ SPDX-License-Identifier: AGPL-3.0-only

<script lang="ts" setup>
import * as Misskey from 'misskey-js';
import { CodeDiff } from 'v-code-diff';
import JSON5 from 'json5';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
import { dateString } from '@/filters/date.js';
Expand All @@ -54,4 +67,11 @@ const props = defineProps<{
width: 18px;
height: 18px;
}

.diff {
background: #fff;
color: #000;
border-radius: 6px;
overflow: clip;
}
</style>
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/admin/modlog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSelect v-model="type" style="margin: 0; flex: 1;">
<template #label>{{ i18n.ts.type }}</template>
<option :value="null">{{ i18n.ts.all }}</option>
<option v-for="t in Misskey.moderationLogTypes" :key="t" :value="t">{{ t }}</option>
<option v-for="t in Misskey.moderationLogTypes" :key="t" :value="t">{{ i18n.ts._moderationLogTypes[t] ?? t }}</option>
</MkSelect>
<MkInput v-model="moderatorId" style="margin: 0; flex: 1;">
<template #label>{{ i18n.ts.moderator }}(ID)</template>
Expand Down
45 changes: 44 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 82a51d4

Please sign in to comment.