Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/files_sharing/src/components/SharingEntryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
</template>

<script>
import { emit } from '@nextcloud/event-bus'
import { generateUrl } from '@nextcloud/router'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { Type as ShareTypes } from '@nextcloud/sharing'
Expand Down Expand Up @@ -703,6 +704,9 @@ export default {
})
}

await this.getNode()
emit('files:node:updated', this.node)

// Execute the copy link method
// freshly created share component
// ! somehow does not works on firefox !
Expand Down
24 changes: 23 additions & 1 deletion apps/files_sharing/src/mixins/SharesMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
*
*/

import { emit } from '@nextcloud/event-bus'
import { fetchNode } from '../services/WebdavClient.ts'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { getCurrentUser } from '@nextcloud/auth'
// eslint-disable-next-line import/no-unresolved, n/no-missing-import
Expand All @@ -35,6 +37,7 @@ import Share from '../models/Share.js'
import SharesRequests from './ShareRequests.js'
import ShareTypes from './ShareTypes.js'
import Config from '../services/ConfigService.js'
import logger from '../services/logger.ts'

import {
BUNDLED_PERMISSIONS,
Expand Down Expand Up @@ -62,6 +65,7 @@ export default {
data() {
return {
config: new Config(),
node: null,

// errors helpers
errors: {},
Expand All @@ -84,7 +88,9 @@ export default {
},

computed: {

path() {
return (this.fileInfo.path + '/' + this.fileInfo.name).replace('//', '/')
},
/**
* Does the current share have a note
*
Expand Down Expand Up @@ -171,6 +177,20 @@ export default {
},

methods: {
/**
* Fetch webdav node
*
* @return {Node}
*/
async getNode() {
const node = { path: this.path }
try {
this.node = await fetchNode(node)
logger.info('Fetched node:', { node: this.node })
} catch (error) {
logger.error('Error:', error)
}
},
/**
* Check if a share is valid before
* firing the request
Expand Down Expand Up @@ -269,6 +289,8 @@ export default {
: t('files_sharing', 'Folder "{path}" has been unshared', { path: this.share.path })
showSuccess(message)
this.$emit('remove:share', this.share)
await this.getNode()
emit('files:node:updated', this.node)
} catch (error) {
// re-open menu if error
this.open = true
Expand Down
18 changes: 18 additions & 0 deletions apps/files_sharing/src/services/WebdavClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { davGetClient, davGetDefaultPropfind, davResultToNode, davRootPath } from '@nextcloud/files'
import type { FileStat, ResponseDataDetailed } from 'webdav'
import type { Node } from '@nextcloud/files'

export const client = davGetClient()

export const fetchNode = async (node: Node): Promise<Node> => {
const propfindPayload = davGetDefaultPropfind()
const result = await client.stat(`${davRootPath}${node.path}`, {
details: true,
data: propfindPayload,
}) as ResponseDataDetailed<FileStat>
return davResultToNode(result.data)
}
22 changes: 14 additions & 8 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@
</template>

<script>
import { emit } from '@nextcloud/event-bus'
import { getLanguage } from '@nextcloud/l10n'
import { Type as ShareType } from '@nextcloud/sharing'

Expand Down Expand Up @@ -272,6 +273,7 @@ import Share from '../models/Share.js'
import ShareRequests from '../mixins/ShareRequests.js'
import ShareTypes from '../mixins/ShareTypes.js'
import SharesMixin from '../mixins/SharesMixin.js'
import logger from '../services/logger.ts'

import {
ATOMIC_PERMISSIONS,
Expand Down Expand Up @@ -726,8 +728,8 @@ export default {
beforeMount() {
this.initializePermissions()
this.initializeAttributes()
console.debug('shareSentIn', this.share)
console.debug('config', this.config)
logger.debug('Share object received', { share: this.share })
logger.debug('Configuration object received', { config: this.config })
},

mounted() {
Expand Down Expand Up @@ -890,7 +892,7 @@ export default {
}

this.creating = true
const share = await this.addShare(incomingShare, this.fileInfo)
const share = await this.addShare(incomingShare)
this.creating = false
this.share = share
this.$emit('add:share', this.share)
Expand All @@ -899,6 +901,9 @@ export default {
this.queueUpdate(...permissionsAndAttributes)
}

await this.getNode()
emit('files:node:updated', this.node)

if (this.$refs.externalLinkActions?.length > 0) {
await Promise.allSettled(this.$refs.externalLinkActions.map((action) => {
if (typeof action.$children.at(0)?.onSave !== 'function') {
Expand All @@ -914,12 +919,11 @@ export default {
* Process the new share request
*
* @param {Share} share incoming share object
* @param {object} fileInfo file data
*/
async addShare(share, fileInfo) {
console.debug('Adding a new share from the input for', share)
async addShare(share) {
logger.debug('Adding a new share from the input for', { share })
const path = this.path
try {
const path = (fileInfo.path + '/' + fileInfo.name).replace('//', '/')
const resultingShare = await this.createShare({
path,
shareType: share.shareType,
Expand All @@ -932,13 +936,15 @@ export default {
})
return resultingShare
} catch (error) {
console.error('Error while adding new share', error)
logger.error('Error while adding new share', { error })
} finally {
// this.loading = false // No loader here yet
}
},
async removeShare() {
await this.onDelete()
await this.getNode()
emit('files:node:updated', this.node)
this.$emit('close-sharing-details')
},
/**
Expand Down
4 changes: 2 additions & 2 deletions dist/4065-4065.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/4065-4065.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/6075-6075.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/6075-6075.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/9558-9558.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/9558-9558.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/9638-9638.js

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions dist/9993-9993.js.LICENSE.txt → dist/9638-9638.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
*/

/**
* @copyright 2022 Louis Chmn <[email protected]>
* @copyright Copyright (c) 2019 John Molakvoæ <[email protected]>
*
* @author Louis Chmn <[email protected]>
* @author Arthur Schiwon <[email protected]>
* @author John Molakvoæ <[email protected]>
* @author Julius Härtl <[email protected]>
*
* @license AGPL-3.0-or-later
*
Expand All @@ -55,9 +57,12 @@
/**
* @copyright Copyright (c) 2019 John Molakvoæ <[email protected]>
*
* @author Arthur Schiwon <[email protected]>
* @author Christoph Wurst <[email protected]>
* @author Daniel Calviño Sánchez <[email protected]>
* @author Gary Kim <[email protected]>
* @author John Molakvoæ <[email protected]>
* @author Julius Härtl <[email protected]>
* @author Vincent Petry <[email protected]>
*
* @license AGPL-3.0-or-later
*
Expand All @@ -80,11 +85,9 @@
* @copyright Copyright (c) 2019 John Molakvoæ <[email protected]>
*
* @author Christoph Wurst <[email protected]>
* @author Daniel Calviño Sánchez <[email protected]>
* @author Gary Kim <[email protected]>
* @author Joas Schilling <[email protected]>
* @author John Molakvoæ <[email protected]>
* @author Julius Härtl <[email protected]>
* @author Vincent Petry <[email protected]>
*
* @license AGPL-3.0-or-later
*
Expand All @@ -106,10 +109,12 @@
/**
* @copyright Copyright (c) 2019 John Molakvoæ <[email protected]>
*
* @author Christoph Wurst <[email protected]>
* @author Joas Schilling <[email protected]>
* @author Daniel Calviño Sánchez <[email protected]>
* @author Gary Kim <[email protected]>
* @author Georg Ehrke <[email protected]>
* @author John Molakvoæ <[email protected]>
* @author Julius Härtl <[email protected]>
* @author Roeland Jago Douma <[email protected]>
*
* @license AGPL-3.0-or-later
*
Expand All @@ -131,12 +136,8 @@
/**
* @copyright Copyright (c) 2019 John Molakvoæ <[email protected]>
*
* @author Daniel Calviño Sánchez <[email protected]>
* @author Gary Kim <[email protected]>
* @author Georg Ehrke <[email protected]>
* @author John Molakvoæ <[email protected]>
* @author Julius Härtl <[email protected]>
* @author Roeland Jago Douma <[email protected]>
*
* @license AGPL-3.0-or-later
*
Expand All @@ -156,10 +157,9 @@
*/

/**
* @copyright Copyright (c) 2019 John Molakvoæ <[email protected]>
* @copyright Copyright (c) 2020 John Molakvoæ <[email protected]>
*
* @author John Molakvoæ <[email protected]>
* @author Julius Härtl <[email protected]>
*
* @license AGPL-3.0-or-later
*
Expand All @@ -179,7 +179,7 @@
*/

/**
* @copyright Copyright (c) 2020 John Molakvoæ <[email protected]>
* @copyright Copyright (c) 2022 John Molakvoæ <[email protected]>
*
* @author John Molakvoæ <[email protected]>
*
Expand Down
1 change: 1 addition & 0 deletions dist/9638-9638.js.map

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions dist/9993-9993.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/9993-9993.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions dist/comments-comments-app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/comments-comments-app.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/comments-comments-tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/comments-comments-tab.js.map

Large diffs are not rendered by default.

Loading