From 74f35ef3853ab74a0b452a8ec75ded68b94ca6ef Mon Sep 17 00:00:00 2001 From: "Cleopatra Enjeck M." Date: Sat, 30 Nov 2024 12:07:09 +0100 Subject: [PATCH] feat: warn when promoting to table manager Signed-off-by: Cleopatra Enjeck M. --- src/modules/sidebar/partials/ShareList.vue | 32 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/modules/sidebar/partials/ShareList.vue b/src/modules/sidebar/partials/ShareList.vue index 45dacaeda..0962ef550 100644 --- a/src/modules/sidebar/partials/ShareList.vue +++ b/src/modules/sidebar/partials/ShareList.vue @@ -64,7 +64,7 @@ + @click="warnOnPromote(share)"> @@ -114,6 +114,16 @@
{{ t('tables', 'No shares') }}
+
+ +
@@ -127,6 +137,9 @@ import Crown from 'vue-material-design-icons/Crown.vue' import Information from 'vue-material-design-icons/Information.vue' import Account from 'vue-material-design-icons/Account.vue' import moment from '@nextcloud/moment' +import { showWarning } from '@nextcloud/dialogs' +import DialogConfirmation from '../../../shared/modals/DialogConfirmation.vue' +import '@nextcloud/dialogs/style.css' export default { components: { @@ -142,6 +155,7 @@ export default { NcActionSeparator, OpenInNew, Crown, + DialogConfirmation, }, mixins: [formatting], @@ -158,6 +172,8 @@ export default { loading: false, // To enable the share info popup debug: false, + showModal: false, + currentShare: {}, } }, @@ -205,10 +221,18 @@ export default { updatePermission(share, permission, value) { this.$emit('update', { id: share.id, permission, value }) }, - promoteToManager(share) { - this.$emit('update', { id: share.id, permission: 'manage', value: true }) + warnOnPromote(share) { + this.currentShare = share + this.showModal = true + }, + promoteToManager() { + if (!this.currentShare) return + this.$emit('update', { id: this.currentShare?.id, permission: 'manage', value: true }) + this.currentShare = {} + this.showModal = false }, - demoteManager(share) { + async demoteManager(share) { + showWarning(t('tables', 'Any application created by a demoted share recipients using a shared table will continue to consume its data.', { share: share.displayName })) this.$emit('update', { id: share.id, permission: 'manage', value: false }) }, personHasTableManagePermission(userId) {