Skip to content

Commit 74f35ef

Browse files
committed
feat: warn when promoting to table manager
Signed-off-by: Cleopatra Enjeck M. <patrathewhiz@gmail.com>
1 parent 9bf572c commit 74f35ef

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/modules/sidebar/partials/ShareList.vue

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</NcActionCheckbox>
6565
<NcActionButton v-if="!isView && !personHasTableManagePermission(share.receiver)"
6666
:close-after-click="true"
67-
@click="promoteToManager(share)">
67+
@click="warnOnPromote(share)">
6868
<template #icon>
6969
<Crown :size="20" />
7070
</template>
@@ -114,6 +114,16 @@
114114
<div v-else>
115115
{{ t('tables', 'No shares') }}
116116
</div>
117+
<div>
118+
<DialogConfirmation :description="t('tables', 'After table promotion, any applications based on this table created by the share recipients will continue to consume its data even if you demote them later')"
119+
:title="t('tables', 'Confirm table manager promotion')"
120+
:cancel-title="t('tables', 'Cancel')"
121+
:confirm-title="t('tables', 'Promote to table manager')"
122+
confirm-class="error"
123+
:show-modal="showModal"
124+
@confirm="promoteToManager"
125+
@cancel="showModal=false" />
126+
</div>
117127
</div>
118128
</template>
119129

@@ -127,6 +137,9 @@ import Crown from 'vue-material-design-icons/Crown.vue'
127137
import Information from 'vue-material-design-icons/Information.vue'
128138
import Account from 'vue-material-design-icons/Account.vue'
129139
import moment from '@nextcloud/moment'
140+
import { showWarning } from '@nextcloud/dialogs'
141+
import DialogConfirmation from '../../../shared/modals/DialogConfirmation.vue'
142+
import '@nextcloud/dialogs/style.css'
130143
131144
export default {
132145
components: {
@@ -142,6 +155,7 @@ export default {
142155
NcActionSeparator,
143156
OpenInNew,
144157
Crown,
158+
DialogConfirmation,
145159
},
146160
147161
mixins: [formatting],
@@ -158,6 +172,8 @@ export default {
158172
loading: false,
159173
// To enable the share info popup
160174
debug: false,
175+
showModal: false,
176+
currentShare: {},
161177
}
162178
},
163179
@@ -205,10 +221,18 @@ export default {
205221
updatePermission(share, permission, value) {
206222
this.$emit('update', { id: share.id, permission, value })
207223
},
208-
promoteToManager(share) {
209-
this.$emit('update', { id: share.id, permission: 'manage', value: true })
224+
warnOnPromote(share) {
225+
this.currentShare = share
226+
this.showModal = true
227+
},
228+
promoteToManager() {
229+
if (!this.currentShare) return
230+
this.$emit('update', { id: this.currentShare?.id, permission: 'manage', value: true })
231+
this.currentShare = {}
232+
this.showModal = false
210233
},
211-
demoteManager(share) {
234+
async demoteManager(share) {
235+
showWarning(t('tables', 'Any application created by a demoted share recipients using a shared table will continue to consume its data.', { share: share.displayName }))
212236
this.$emit('update', { id: share.id, permission: 'manage', value: false })
213237
},
214238
personHasTableManagePermission(userId) {

0 commit comments

Comments
 (0)