diff --git a/src/components/card/AttachmentList.vue b/src/components/card/AttachmentList.vue index 394320b68..e10811b4e 100644 --- a/src/components/card/AttachmentList.vue +++ b/src/components/card/AttachmentList.vue @@ -94,10 +94,12 @@ import relativeDate from '../../mixins/relativeDate.js' import { formatFileSize } from '@nextcloud/files' import { getCurrentUser } from '@nextcloud/auth' import { generateUrl, generateOcsUrl, generateRemoteUrl } from '@nextcloud/router' -import { mapState, mapActions } from 'vuex' +import { mapState as mapStateVuex } from 'vuex' +import { mapState, mapActions } from 'pinia' import { loadState } from '@nextcloud/initial-state' import attachmentUpload from '../../mixins/attachmentUpload.js' import { getFilePickerBuilder } from '@nextcloud/dialogs' +import { useAttachmentStore } from '../../stores/attachment.js' const maxUploadSizeState = loadState('deck', 'maxUploadSize', -1) const picker = getFilePickerBuilder(t('deck', 'File to share')) @@ -147,7 +149,7 @@ export default { }, attachments() { // FIXME sort propertly by last modified / deleted at - return [...this.$store.getters.attachmentsByCard(this.cardId)].filter(attachment => attachment.deletedAt >= 0).sort((a, b) => b.id - a.id) + return [...this.attachmentsByCard(this.cardId)].filter(attachment => attachment.deletedAt >= 0).sort((a, b) => b.id - a.id) }, mimetypeForAttachment() { return (attachment) => { @@ -176,9 +178,12 @@ export default { formattedFileSize() { return (filesize) => formatFileSize(filesize) }, - ...mapState({ + ...mapStateVuex({ currentBoard: state => state.currentBoard, }), + ...mapState(useAttachmentStore, [ + 'attachmentsByCard', + ]), isReadOnly() { return !this.$store.getters.canEdit }, @@ -210,8 +215,9 @@ export default { }, }, methods: { - ...mapActions([ + ...mapActions(useAttachmentStore, [ 'fetchAttachments', + 'unshareAttachment', ]), handleUploadFile(event) { const files = event.target.files ?? [] @@ -240,9 +246,6 @@ export default { }) }) }, - unshareAttachment(attachment) { - this.$store.dispatch('unshareAttachment', attachment) - }, clickAddNewAttachmment() { this.$refs.localAttachments.click() }, diff --git a/src/components/card/CardSidebarTabAttachments.vue b/src/components/card/CardSidebarTabAttachments.vue index e57e76290..1bbf6e52b 100644 --- a/src/components/card/CardSidebarTabAttachments.vue +++ b/src/components/card/CardSidebarTabAttachments.vue @@ -11,7 +11,9 @@ diff --git a/src/components/cards/CardCover.vue b/src/components/cards/CardCover.vue index b7d0d0e78..75df0256a 100644 --- a/src/components/cards/CardCover.vue +++ b/src/components/cards/CardCover.vue @@ -12,8 +12,9 @@