Fix #1829
This commit is contained in:
parent
09c1aba30d
commit
2900c3818c
|
@ -18,7 +18,7 @@ known_first_party=funkwhale_api
|
|||
multi_line_output=3
|
||||
default_section=THIRDPARTY
|
||||
|
||||
[*.{html,js,vue,css,scss,json,yml}]
|
||||
[*.{html,js,vue,css,scss,json,yml,ts}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import SemanticModal from '~/components/semantic/Modal.vue'
|
|||
|
||||
import useThemeList from '~/composables/useThemeList'
|
||||
import useTheme from '~/composables/useTheme'
|
||||
import axios from 'axios'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { computed, ref, watch, watchEffect, onMounted } from 'vue'
|
||||
import { useGettext } from 'vue3-gettext'
|
||||
|
@ -93,6 +94,29 @@ const moderationNotifications = computed(() =>
|
|||
+ store.state.ui.notifications.pendingReviewRequests
|
||||
)
|
||||
|
||||
Promise.resolve().then(async () => {
|
||||
const [edits, reports, requests] = await Promise.all([
|
||||
axios.get('mutations/', { params: { page_size: 1 } }),
|
||||
axios.get('manage/moderation/reports/', { params: { page_size: 1 } }),
|
||||
axios.get('manage/moderation/requests/', { params: { page_size: 1 } })
|
||||
])
|
||||
|
||||
store.commit('ui/incrementNotifications', {
|
||||
type: 'pendingReviewEdits',
|
||||
value: edits.data.count
|
||||
})
|
||||
|
||||
store.commit('ui/incrementNotifications', {
|
||||
type: 'pendingReviewRequests',
|
||||
value: requests.data.count
|
||||
})
|
||||
|
||||
store.commit('ui/incrementNotifications', {
|
||||
type: 'pendingReviewReports',
|
||||
value: reports.data.count
|
||||
})
|
||||
})
|
||||
|
||||
const isProduction = import.meta.env.PROD
|
||||
const showUserModal = ref(false)
|
||||
const showLanguageModal = ref(false)
|
||||
|
|
|
@ -247,7 +247,7 @@ import AttachmentInput from '~/components/common/AttachmentInput.vue'
|
|||
import EditList from '~/components/library/EditList.vue'
|
||||
import EditCard from '~/components/library/EditCard.vue'
|
||||
import TagsSelector from '~/components/library/TagsSelector.vue'
|
||||
import useEditConfigs from '~/composables/useEditConfigs'
|
||||
import useEditConfigs from '~/composables/moderation/useEditConfigs'
|
||||
import { computed } from 'vue'
|
||||
|
||||
export default {
|
||||
|
|
|
@ -103,8 +103,8 @@ const fetchData = async () => {
|
|||
:type="type"
|
||||
:target="target"
|
||||
@cancel="showForm = false"
|
||||
@save="showForm = false; result = {count: 1, results: [$event]}"
|
||||
@delete="result = {count: 0, results: []}; showForm = false"
|
||||
@save="(event: unknown) => { showForm = false; result = {count: 1, results: [event]} }"
|
||||
@delete="() => { result = {count: 0, results: []}; showForm = false }"
|
||||
/>
|
||||
</div>
|
||||
<div class="ui hidden divider" />
|
||||
|
|
|
@ -157,7 +157,7 @@ export default [
|
|||
path: 'reports',
|
||||
name: 'manage.moderation.reports.list',
|
||||
component: () => import('~/views/admin/moderation/ReportsList.vue'),
|
||||
props: route => ({ defaultQuery: route.query.q, updateUrl: true })
|
||||
props: route => ({ defaultQuery: route.query.q, updateUrl: true, orderingConfigName: null })
|
||||
},
|
||||
{
|
||||
path: 'reports/:id',
|
||||
|
@ -169,7 +169,7 @@ export default [
|
|||
path: 'requests',
|
||||
name: 'manage.moderation.requests.list',
|
||||
component: () => import('~/views/admin/moderation/RequestsList.vue'),
|
||||
props: route => ({ defaultQuery: route.query.q, updateUrl: true })
|
||||
props: route => ({ defaultQuery: route.query.q, updateUrl: true, orderingConfigName: null })
|
||||
},
|
||||
{
|
||||
path: 'requests/:id',
|
||||
|
|
|
@ -347,7 +347,7 @@ const store: Module<State, RootState> = {
|
|||
notifications (state, { type, count }: { type: NotificationsKey, count: number }) {
|
||||
state.notifications[type] = count
|
||||
},
|
||||
incrementNotifications (state, { type, count, value }: { type: NotificationsKey, count: number, value: number }) {
|
||||
incrementNotifications (state, { type, count, value }: { type: NotificationsKey, count: number, value?: number }) {
|
||||
if (value !== undefined) {
|
||||
state.notifications[type] = Math.max(0, value)
|
||||
} else {
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
<script setp lang="ts">
|
||||
import { useGettext } from 'vue3-gettext'
|
||||
import { computed } from 'vue'
|
||||
|
||||
import EditsCardList from '~/components/manage/library/EditsCardList.vue'
|
||||
|
||||
interface Props {
|
||||
defaultQuery?: string
|
||||
}
|
||||
|
||||
withDefaults(defineProps<Props>(), {
|
||||
defaultQuery: ''
|
||||
})
|
||||
|
||||
const labels = computed(() => ({
|
||||
title: $pgettext('*/Admin/*/Noun', 'Edits')
|
||||
}))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main v-title="labels.title">
|
||||
<section class="ui vertical stripe segment">
|
||||
|
@ -14,23 +33,3 @@
|
|||
</section>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import EditsCardList from '~/components/manage/library/EditsCardList.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
EditsCardList
|
||||
},
|
||||
props: {
|
||||
defaultQuery: { type: String, required: false, default: '' }
|
||||
},
|
||||
computed: {
|
||||
labels () {
|
||||
return {
|
||||
title: this.$pgettext('*/Admin/*/Noun', 'Edits')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue