From 9e4b81478444c41c588bb4d767f2c4fb2a2ee1ce Mon Sep 17 00:00:00 2001 From: JanAckermann Date: Fri, 8 Jul 2022 10:08:55 +0200 Subject: [PATCH 1/7] Fix wrong space ref --- packages/web-app-files/src/helpers/share/link.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/web-app-files/src/helpers/share/link.ts b/packages/web-app-files/src/helpers/share/link.ts index 6555b06be3e..8c7c69c115d 100644 --- a/packages/web-app-files/src/helpers/share/link.ts +++ b/packages/web-app-files/src/helpers/share/link.ts @@ -16,6 +16,7 @@ interface CreateQuicklink { } export const createQuicklink = async (args: CreateQuicklink): Promise => { + console.log(args) const params: { [key: string]: unknown } = { name: $gettext('Quicklink'), permissions: 1, @@ -26,7 +27,7 @@ export const createQuicklink = async (args: CreateQuicklink): Promise => params.password = args.password } - const { storageId, resource, store } = args + const { resource, store } = args const expirationDate = store.state.user.capabilities.files_sharing.public.expire_date if (expirationDate.enforced) { @@ -39,15 +40,13 @@ export const createQuicklink = async (args: CreateQuicklink): Promise => // needs check for enforced password for default role (viewer?) // and concept to what happens if it is enforced - if (storageId) { - params.spaceRef = `${storageId}${resource.path}` - } + params.spaceRef = resource.id const link = await store.dispatch('Files/addLink', { path: resource.path, client: clientService.owncloudSdk, params, - storageId + storageId: resource.storageId }) copyToClipboard(link.url) From 44a285ace15c92f724a746b9c164a87abebd88c4 Mon Sep 17 00:00:00 2001 From: JanAckermann Date: Fri, 8 Jul 2022 10:35:36 +0200 Subject: [PATCH 2/7] Always make sure that we have a storage id --- packages/web-app-files/src/helpers/share/link.ts | 9 +++++---- packages/web-app-files/src/quickActions.js | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/web-app-files/src/helpers/share/link.ts b/packages/web-app-files/src/helpers/share/link.ts index 8c7c69c115d..6555b06be3e 100644 --- a/packages/web-app-files/src/helpers/share/link.ts +++ b/packages/web-app-files/src/helpers/share/link.ts @@ -16,7 +16,6 @@ interface CreateQuicklink { } export const createQuicklink = async (args: CreateQuicklink): Promise => { - console.log(args) const params: { [key: string]: unknown } = { name: $gettext('Quicklink'), permissions: 1, @@ -27,7 +26,7 @@ export const createQuicklink = async (args: CreateQuicklink): Promise => params.password = args.password } - const { resource, store } = args + const { storageId, resource, store } = args const expirationDate = store.state.user.capabilities.files_sharing.public.expire_date if (expirationDate.enforced) { @@ -40,13 +39,15 @@ export const createQuicklink = async (args: CreateQuicklink): Promise => // needs check for enforced password for default role (viewer?) // and concept to what happens if it is enforced - params.spaceRef = resource.id + if (storageId) { + params.spaceRef = `${storageId}${resource.path}` + } const link = await store.dispatch('Files/addLink', { path: resource.path, client: clientService.owncloudSdk, params, - storageId: resource.storageId + storageId }) copyToClipboard(link.url) diff --git a/packages/web-app-files/src/quickActions.js b/packages/web-app-files/src/quickActions.js index 82099fb8353..13a7c498117 100644 --- a/packages/web-app-files/src/quickActions.js +++ b/packages/web-app-files/src/quickActions.js @@ -66,6 +66,8 @@ export default { label: ($gettext) => $gettext('Copy quicklink'), icon: 'link', handler: async (ctx) => { + ctx.storageId = ctx.item.storageId + const passwordEnforced = ctx.store.getters.capabilities?.files_sharing?.public?.password?.enforced_for?.read_only === true @@ -76,7 +78,6 @@ export default { await ctx.store.dispatch('Files/sidebar/openWithPanel', 'sharing-item') }) } - await createQuicklink({ ...ctx, resource: ctx.item }) await ctx.store.dispatch('Files/sidebar/openWithPanel', 'sharing-item') }, From 33dc2e1aeeba5a784b499b1910e9032f7df7aa43 Mon Sep 17 00:00:00 2001 From: JanAckermann Date: Fri, 8 Jul 2022 10:37:19 +0200 Subject: [PATCH 3/7] Reintroduce new line --- packages/web-app-files/src/quickActions.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/web-app-files/src/quickActions.js b/packages/web-app-files/src/quickActions.js index 13a7c498117..00acdaa49b6 100644 --- a/packages/web-app-files/src/quickActions.js +++ b/packages/web-app-files/src/quickActions.js @@ -78,6 +78,7 @@ export default { await ctx.store.dispatch('Files/sidebar/openWithPanel', 'sharing-item') }) } + await createQuicklink({ ...ctx, resource: ctx.item }) await ctx.store.dispatch('Files/sidebar/openWithPanel', 'sharing-item') }, From ba8c82d57758a11e618af053503a1e45aaecf3e8 Mon Sep 17 00:00:00 2001 From: JanAckermann Date: Fri, 8 Jul 2022 11:11:20 +0200 Subject: [PATCH 4/7] Refactor --- packages/web-app-files/src/helpers/share/link.ts | 8 ++++---- packages/web-app-files/src/quickActions.js | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/web-app-files/src/helpers/share/link.ts b/packages/web-app-files/src/helpers/share/link.ts index 6555b06be3e..a38494b9bfb 100644 --- a/packages/web-app-files/src/helpers/share/link.ts +++ b/packages/web-app-files/src/helpers/share/link.ts @@ -26,7 +26,7 @@ export const createQuicklink = async (args: CreateQuicklink): Promise => params.password = args.password } - const { storageId, resource, store } = args + const { resource, store } = args const expirationDate = store.state.user.capabilities.files_sharing.public.expire_date if (expirationDate.enforced) { @@ -39,15 +39,15 @@ export const createQuicklink = async (args: CreateQuicklink): Promise => // needs check for enforced password for default role (viewer?) // and concept to what happens if it is enforced - if (storageId) { - params.spaceRef = `${storageId}${resource.path}` + if (resource.isReceivedShare()) { + params.spaceRef = resource.id } const link = await store.dispatch('Files/addLink', { path: resource.path, client: clientService.owncloudSdk, params, - storageId + storageId: resource.storageId }) copyToClipboard(link.url) diff --git a/packages/web-app-files/src/quickActions.js b/packages/web-app-files/src/quickActions.js index 00acdaa49b6..82099fb8353 100644 --- a/packages/web-app-files/src/quickActions.js +++ b/packages/web-app-files/src/quickActions.js @@ -66,8 +66,6 @@ export default { label: ($gettext) => $gettext('Copy quicklink'), icon: 'link', handler: async (ctx) => { - ctx.storageId = ctx.item.storageId - const passwordEnforced = ctx.store.getters.capabilities?.files_sharing?.public?.password?.enforced_for?.read_only === true From 8cc69b9dacde5aaad7a08c8a90097c763cd8f6aa Mon Sep 17 00:00:00 2001 From: JanAckermann Date: Fri, 8 Jul 2022 11:27:17 +0200 Subject: [PATCH 5/7] Refactor --- packages/web-app-files/src/helpers/share/link.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/web-app-files/src/helpers/share/link.ts b/packages/web-app-files/src/helpers/share/link.ts index a38494b9bfb..b04c408a274 100644 --- a/packages/web-app-files/src/helpers/share/link.ts +++ b/packages/web-app-files/src/helpers/share/link.ts @@ -39,15 +39,13 @@ export const createQuicklink = async (args: CreateQuicklink): Promise => // needs check for enforced password for default role (viewer?) // and concept to what happens if it is enforced - if (resource.isReceivedShare()) { - params.spaceRef = resource.id - } + params.spaceRef = resource.fileId || resource.id const link = await store.dispatch('Files/addLink', { path: resource.path, client: clientService.owncloudSdk, params, - storageId: resource.storageId + storageId: resource.fileId || resource.id }) copyToClipboard(link.url) From e142061cf12aba604d49b387baa9bc95f443a02c Mon Sep 17 00:00:00 2001 From: JanAckermann Date: Fri, 8 Jul 2022 11:29:34 +0200 Subject: [PATCH 6/7] Add changelog item --- changelog/unreleased/enhancement-ocis-resharing | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog/unreleased/enhancement-ocis-resharing b/changelog/unreleased/enhancement-ocis-resharing index f192cd13ab1..c8a74974d1f 100644 --- a/changelog/unreleased/enhancement-ocis-resharing +++ b/changelog/unreleased/enhancement-ocis-resharing @@ -4,6 +4,7 @@ We've enhanced web to be able to re-share resources when using an ownCloud infin Besides that we also send roles, space-ref and path as separate values to the sharing api which simplifies the usage of it. https://github.com/owncloud/web/pull/7086 +https://github.com/owncloud/web/pull/7247 https://github.com/owncloud/web/issues/6894 https://github.com/owncloud/web/pull/7243 https://github.com/owncloud/web/issues/7225 From 33ba3fef57fa28bd1f9e0839fbecd6ef96f89d23 Mon Sep 17 00:00:00 2001 From: JanAckermann Date: Fri, 8 Jul 2022 12:20:19 +0200 Subject: [PATCH 7/7] Trigger Build