jormungandr-bite/packages/client/src/pages/admin/abuses.vue

171 lines
4.3 KiB
Vue
Raw Normal View History

2020-10-19 04:29:04 -06:00
<template>
<div class="lcixvhis">
2020-10-19 04:29:04 -06:00
<div class="_section reports">
<div class="_content">
<div class="inputs" style="display: flex;">
2021-08-06 07:29:19 -06:00
<MkSelect v-model="state" style="margin: 0; flex: 1;">
2020-12-25 18:47:36 -07:00
<template #label>{{ $ts.state }}</template>
<option value="all">{{ $ts.all }}</option>
<option value="unresolved">{{ $ts.unresolved }}</option>
<option value="resolved">{{ $ts.resolved }}</option>
2020-10-19 04:29:04 -06:00
</MkSelect>
2021-08-06 07:29:19 -06:00
<MkSelect v-model="targetUserOrigin" style="margin: 0; flex: 1;">
2021-11-04 21:32:35 -06:00
<template #label>{{ $ts.reporteeOrigin }}</template>
2020-12-25 18:47:36 -07:00
<option value="combined">{{ $ts.all }}</option>
<option value="local">{{ $ts.local }}</option>
<option value="remote">{{ $ts.remote }}</option>
2020-10-19 04:29:04 -06:00
</MkSelect>
2021-08-06 07:29:19 -06:00
<MkSelect v-model="reporterOrigin" style="margin: 0; flex: 1;">
2020-12-25 18:47:36 -07:00
<template #label>{{ $ts.reporterOrigin }}</template>
<option value="combined">{{ $ts.all }}</option>
<option value="local">{{ $ts.local }}</option>
<option value="remote">{{ $ts.remote }}</option>
2020-10-19 04:29:04 -06:00
</MkSelect>
</div>
<!-- TODO
<div class="inputs" style="display: flex; padding-top: 1.2em;">
2021-09-29 09:50:45 -06:00
<MkInput v-model="searchUsername" style="margin: 0; flex: 1;" type="text" spellcheck="false" @update:modelValue="$refs.reports.reload()">
2020-12-25 18:47:36 -07:00
<span>{{ $ts.username }}</span>
2020-10-19 04:29:04 -06:00
</MkInput>
2021-09-29 09:50:45 -06:00
<MkInput v-model="searchHost" style="margin: 0; flex: 1;" type="text" spellcheck="false" @update:modelValue="$refs.reports.reload()" :disabled="pagination.params().origin === 'local'">
2020-12-25 18:47:36 -07:00
<span>{{ $ts.host }}</span>
2020-10-19 04:29:04 -06:00
</MkInput>
</div>
-->
2021-12-02 04:09:12 -07:00
<MkPagination v-slot="{items}" ref="reports" :pagination="pagination" style="margin-top: var(--margin);">
2021-11-19 03:36:12 -07:00
<div v-for="report in items" :key="report.id" class="bcekxzvu _card _gap">
2020-10-19 04:29:04 -06:00
<div class="_content target">
2021-04-17 08:52:54 -06:00
<MkAvatar class="avatar" :user="report.targetUser" :show-indicator="true"/>
2020-10-19 04:29:04 -06:00
<div class="info">
<MkUserName class="name" :user="report.targetUser"/>
<div class="acct">@{{ acct(report.targetUser) }}</div>
</div>
</div>
<div class="_content">
<div>
<Mfm :text="report.comment"/>
</div>
<hr>
<div>Reporter: <MkAcct :user="report.reporter"/></div>
<div><MkTime :time="report.createdAt"/></div>
</div>
<div class="_footer">
<div v-if="report.assignee">Assignee: <MkAcct :user="report.assignee"/></div>
2021-11-19 03:36:12 -07:00
<MkButton v-if="!report.resolved" primary @click="resolve(report)">{{ $ts.abuseMarkAsResolved }}</MkButton>
2020-10-19 04:29:04 -06:00
</div>
</div>
</MkPagination>
</div>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
2021-11-11 10:02:25 -07:00
import MkButton from '@/components/ui/button.vue';
import MkInput from '@/components/form/input.vue';
import MkSelect from '@/components/form/select.vue';
import MkPagination from '@/components/ui/pagination.vue';
import { acct } from '@/filters/user';
import * as os from '@/os';
import * as symbols from '@/symbols';
2020-10-19 04:29:04 -06:00
export default defineComponent({
components: {
MkButton,
MkInput,
MkSelect,
MkPagination,
},
emits: ['info'],
2020-10-19 04:29:04 -06:00
data() {
return {
2021-04-09 21:54:12 -06:00
[symbols.PAGE_INFO]: {
2020-12-25 18:47:36 -07:00
title: this.$ts.abuseReports,
2021-10-02 08:11:21 -06:00
icon: 'fas fa-exclamation-circle',
bg: 'var(--bg)',
2020-10-19 04:29:04 -06:00
},
searchUsername: '',
searchHost: '',
state: 'unresolved',
reporterOrigin: 'combined',
targetUserOrigin: 'combined',
pagination: {
endpoint: 'admin/abuse-user-reports',
limit: 10,
params: () => ({
state: this.state,
reporterOrigin: this.reporterOrigin,
targetUserOrigin: this.targetUserOrigin,
}),
},
}
},
watch: {
state() {
this.$refs.reports.reload();
},
reporterOrigin() {
this.$refs.reports.reload();
},
targetUserOrigin() {
this.$refs.reports.reload();
},
},
mounted() {
this.$emit('info', this[symbols.PAGE_INFO]);
},
2020-10-19 04:29:04 -06:00
methods: {
acct,
resolve(report) {
os.apiWithDialog('admin/resolve-abuse-user-report', {
reportId: report.id,
}).then(() => {
this.$refs.reports.removeItem(item => item.id === report.id);
});
},
}
});
</script>
<style lang="scss" scoped>
.lcixvhis {
margin: var(--margin);
}
2020-10-19 04:29:04 -06:00
.bcekxzvu {
> .target {
display: flex;
width: 100%;
box-sizing: border-box;
text-align: left;
align-items: center;
> .avatar {
width: 42px;
height: 42px;
}
> .info {
margin-left: 0.3em;
padding: 0 8px;
flex: 1;
> .name {
font-weight: bold;
}
}
}
}
</style>