fix(front): [regression] re-enable publish action for channel uploads

This commit is contained in:
upsiflu 2025-03-25 11:04:47 +01:00
parent 465010d3ea
commit 0d743b7ca2
3 changed files with 16 additions and 18 deletions

View File

@ -404,6 +404,7 @@ const labels = computed(() => ({
}))
const publish = async () => {
console.log("TRYING TO PUBLISH")
isLoading.value = true
errors.value = []
@ -414,17 +415,10 @@ const publish = async () => {
/* { import_status: components["schemas"]["ImportStatusEnum"];
audio_file: string;} */
// const theUpdate : components['schemas']['PatchedUploadForOwnerRequest'] = {
// import_status: 'pending',
// }
// await axios.post('uploads/action/', {
// action: 'publish',
// objects: uploadedFiles.value.map((file) => file.response?.uuid)
// } satisfies paths['/api/v2/uploads/action/']['post']['requestBody']['content']['application/json'],
// {
// headers: { 'Authorization': `Bearer ${store.state.auth.oauth}` }
// })
await axios.post<paths['/api/v2/uploads/action/']['post']['responses']['200']['content']['application/json']>('uploads/action/', {
action: 'publish',
objects: uploadedFiles.value.map((file) => file.response?.uuid)
})
// Tell the store that the uploaded files are pending import
store.commit('channels/publish', {

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { computed, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { useStore } from '~/store'
import onKeyboardShortcut from '~/composables/onKeyboardShortcut'
@ -13,6 +13,8 @@ import Alert from '~/components/ui/Alert.vue'
import Card from '~/components/ui/Card.vue'
import type { Actor, Channel, PrivacyLevel } from '~/types'
import type { paths } from '~/generated/types'
import axios from 'axios'
import FileUploadWidget from '~/components/library/FileUploadWidget.vue'
import type { VueUploadItem } from 'vue-upload-component'
import ChannelUpload from '~/components/channels/UploadForm.vue'
@ -144,7 +146,7 @@ const channelUpload = ref()
v-if="state.uploadDestination?.type === 'channel'"
ref="channelUpload"
:filter="state.uploadDestination.filter"
:channel="null"
:channel="state.uploadDestination?.channel || null"
/>
<!-- -->
@ -179,7 +181,7 @@ const channelUpload = ref()
</Button>
<Button
v-if="channelUpload"
:on-click="() => channelUpload.publish()"
@click="() => { channelUpload.publish(); isOpen = false }"
>
<!-- Set update import_metadata from 'draft' to 'public' -->
{{ t('components.channels.UploadModal.button.publish') }}

View File

@ -124,20 +124,22 @@ const albumModal = ref()
<h3 class="ui header">
{{ t('views.channels.DetailOverview.header.uploadsFailure') }}
</h3>
<Button
<Link
v-if="skippedUploads.length > 0"
secondary
solid
:to="{name: 'content.libraries.files', query: {q: 'status:skipped'}}"
>
{{ t('views.channels.DetailOverview.link.skippedUploads') }}
</Button>
<Button
</Link>
<Link
v-if="erroredUploads.length > 0"
secondary
solid
:to="{name: 'content.libraries.files', query: {q: 'status:errored'}}"
>
{{ t('views.channels.DetailOverview.link.erroredUploads') }}
</Button>
</Link>
</template>
<template v-else>
<Loader />