From 1c9aee2a00febb71b1ee00a1e858670c48194b59 Mon Sep 17 00:00:00 2001 From: Pascal Wengerter Date: Wed, 27 Apr 2022 15:21:53 +0200 Subject: [PATCH 1/6] WIP init revert first ruff implementation for quicklinks combine CURRENT_FILE_OUTGOING_SHARES_ADD and CURRENT_FILE_OUTGOING_SHARES_UPDATE into CURRENT_FILE_OUTGOING_SHARES_UPSERT refactor quicklink action into helper implement quicklink logic update test message text --- .../components/FilesList/ContextActions.vue | 6 +- .../components/SideBar/Shares/FileLinks.vue | 10 +++- .../SideBar/Shares/Links/QuickLink.vue | 18 ++++++ .../web-app-files/src/helpers/share/index.ts | 1 + .../web-app-files/src/helpers/share/link.ts | 54 +++++++++++++++++ .../src/mixins/actions/createPublicLink.js | 44 -------------- .../src/mixins/actions/createQuicklink.js | 45 ++++++++++++++ packages/web-app-files/src/quickActions.js | 59 +++---------------- packages/web-app-files/src/store/actions.js | 17 +++--- packages/web-app-files/src/store/mutations.js | 5 +- .../components/FilesList/QuickActions.spec.js | 10 ++-- .../tests/unit/store/mutations.spec.js | 6 +- .../publicLinkCreate.feature | 3 +- 13 files changed, 157 insertions(+), 121 deletions(-) create mode 100644 packages/web-app-files/src/components/SideBar/Shares/Links/QuickLink.vue create mode 100644 packages/web-app-files/src/helpers/share/link.ts delete mode 100644 packages/web-app-files/src/mixins/actions/createPublicLink.js create mode 100644 packages/web-app-files/src/mixins/actions/createQuicklink.js diff --git a/packages/web-app-files/src/components/FilesList/ContextActions.vue b/packages/web-app-files/src/components/FilesList/ContextActions.vue index 7d495715445..9ec6eb533e2 100644 --- a/packages/web-app-files/src/components/FilesList/ContextActions.vue +++ b/packages/web-app-files/src/components/FilesList/ContextActions.vue @@ -8,7 +8,7 @@ import ContextActionMenu from '../ContextActionMenu.vue' import FileActions from '../../mixins/fileActions' import AcceptShare from '../../mixins/actions/acceptShare' import Copy from '../../mixins/actions/copy' -import CreatePublicLink from '../../mixins/actions/createPublicLink' +import CreateQuicklink from '../../mixins/actions/createQuicklink' import DeclineShare from '../../mixins/actions/declineShare' import Delete from '../../mixins/actions/delete' import DownloadArchive from '../../mixins/actions/downloadArchive' @@ -35,7 +35,7 @@ export default { FileActions, AcceptShare, Copy, - CreatePublicLink, + CreateQuicklink, DeclineShare, Delete, DownloadArchive, @@ -134,7 +134,7 @@ export default { }, menuItemsShare() { - return [...this.$_showShares_items, ...this.$_createPublicLink_items].filter((item) => + return [...this.$_showShares_items, ...this.$_createQuicklink_items].filter((item) => item.isEnabled(this.filterParams) ) }, diff --git a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue index b8fc42fd62c..2d2a37cf488 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue @@ -12,8 +12,7 @@
- - +
+
+ + +
link.quicklink === true) }, globalExpirationDate() { @@ -229,7 +246,14 @@ export default defineComponent({ }, links() { - return [...this.currentFileOutgoingLinks, ...this.indirectLinks] + // exclude quicklink here + const nonQuickLinkOutgoingLinks = this.currentFileOutgoingLinks.filter( + (link) => !link.quicklink + ) + + console.log(nonQuickLinkOutgoingLinks, this.currentFileOutgoingLinks) + + return [...nonQuickLinkOutgoingLinks, ...this.indirectLinks] .sort(this.linksComparator) .map((share) => { share.key = 'direct-link-' + share.id @@ -376,6 +400,7 @@ export default defineComponent({ expireDate, password, permissions: link.permissions, + quicklink: link.quicklink, name: link.name, ...(this.currentStorageId && { spaceRef: `${this.currentStorageId}${this.highlightedFile.path}` diff --git a/packages/web-app-files/src/components/SideBar/Shares/Links/CreateQuickLink.vue b/packages/web-app-files/src/components/SideBar/Shares/Links/CreateQuickLink.vue new file mode 100644 index 00000000000..e6246a6d14e --- /dev/null +++ b/packages/web-app-files/src/components/SideBar/Shares/Links/CreateQuickLink.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/packages/web-app-files/src/components/SideBar/Shares/Links/NameAndCopy.vue b/packages/web-app-files/src/components/SideBar/Shares/Links/NameAndCopy.vue index bbe82bbc163..4cbd014b77a 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/Links/NameAndCopy.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/Links/NameAndCopy.vue @@ -2,55 +2,80 @@
3 && this.linkListCollapsed) { + return this.links.slice(0, 3) + } + return this.links + }, + indirectLinks() { const allShares = [] const parentPaths = getParentPaths(this.highlightedFile.path, false) @@ -317,6 +337,10 @@ export default defineComponent({ ]), ...mapActions(['showMessage', 'createModal', 'hideModal']), + toggleLinkListCollapsed() { + this.linkListCollapsed = !this.linkListCollapsed + }, + reloadLinks() { this.loadCurrentFileOutgoingShares({ client: this.$client, diff --git a/packages/web-app-files/src/components/SideBar/Shares/FileShares.vue b/packages/web-app-files/src/components/SideBar/Shares/FileShares.vue index 21b8ca223d5..000d4dce400 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/FileShares.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/FileShares.vue @@ -12,31 +12,15 @@ />

- - - -

-