aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/src/components/SharingEntryLink.vue4
-rw-r--r--apps/files_sharing/src/mixins/SharesMixin.js24
-rw-r--r--apps/files_sharing/src/services/WebdavClient.ts18
-rw-r--r--apps/files_sharing/src/views/SharingDetailsTab.vue11
4 files changed, 52 insertions, 5 deletions
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index 680901244a2..8c6235a78ee 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -183,6 +183,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'
@@ -638,6 +639,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 !
diff --git a/apps/files_sharing/src/mixins/SharesMixin.js b/apps/files_sharing/src/mixins/SharesMixin.js
index 5f973bf63cf..4893025c99f 100644
--- a/apps/files_sharing/src/mixins/SharesMixin.js
+++ b/apps/files_sharing/src/mixins/SharesMixin.js
@@ -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
@@ -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,
@@ -62,6 +65,7 @@ export default {
data() {
return {
config: new Config(),
+ node: null,
// errors helpers
errors: {},
@@ -84,7 +88,9 @@ export default {
},
computed: {
-
+ path() {
+ return (this.fileInfo.path + '/' + this.fileInfo.name).replace('//', '/')
+ },
/**
* Does the current share have a note
*
@@ -172,6 +178,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
*
@@ -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
diff --git a/apps/files_sharing/src/services/WebdavClient.ts b/apps/files_sharing/src/services/WebdavClient.ts
new file mode 100644
index 00000000000..cd33147b03f
--- /dev/null
+++ b/apps/files_sharing/src/services/WebdavClient.ts
@@ -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)
+}
diff --git a/apps/files_sharing/src/views/SharingDetailsTab.vue b/apps/files_sharing/src/views/SharingDetailsTab.vue
index 6f6a6d60002..1f81a4bdc57 100644
--- a/apps/files_sharing/src/views/SharingDetailsTab.vue
+++ b/apps/files_sharing/src/views/SharingDetailsTab.vue
@@ -215,6 +215,7 @@
</template>
<script>
+import { emit } from '@nextcloud/event-bus'
import { getLanguage } from '@nextcloud/l10n'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
@@ -243,6 +244,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,
@@ -839,7 +841,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)
@@ -854,12 +856,11 @@ export default {
* Process the new share request
*
* @param {Share} share incoming share object
- * @param {object} fileInfo file data
*/
- async addShare(share, fileInfo) {
+ async addShare(share) {
console.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,
@@ -879,6 +880,8 @@ export default {
},
async removeShare() {
await this.onDelete()
+ await this.getNode()
+ emit('files:node:updated', this.node)
this.$emit('close-sharing-details')
},
/**