Skip to content

Commit 082b694

Browse files
committed
feat(files_sharing): confirm before deleting a share from the sidebar
The new Delete dual-button deleted immediately. Add a confirmation dialog so the destructive action is not one accidental click away. Assisted-by: ClaudeCode:claude-opus-4-8 Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
1 parent 9a6f840 commit 082b694

1 file changed

Lines changed: 37 additions & 1 deletion

File tree

apps/files_sharing/src/components/SharingEntry.vue

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
class="sharing-entry__action"
6363
:aria-label="t('files_sharing', 'Delete share')"
6464
variant="tertiary"
65-
@click="onDelete">
65+
@click="confirmDelete">
6666
<template #icon>
6767
<DeleteIcon :size="20" />
6868
</template>
@@ -72,6 +72,7 @@
7272
</template>
7373

7474
<script>
75+
import { DialogBuilder } from '@nextcloud/dialogs'
7576
import { ShareType } from '@nextcloud/sharing'
7677
import NcAvatar from '@nextcloud/vue/components/NcAvatar'
7778
import NcButton from '@nextcloud/vue/components/NcButton'
@@ -171,6 +172,41 @@ export default {
171172
}
172173
},
173174
175+
/**
176+
* Ask for confirmation before deleting the share.
177+
*/
178+
async confirmDelete() {
179+
let confirmed = false
180+
const dialog = (new DialogBuilder())
181+
.setName(t('files_sharing', 'Delete share'))
182+
.setText(t('files_sharing', 'Are you sure you want to delete this share? This operation cannot be undone.'))
183+
.setButtons([
184+
{
185+
label: t('files_sharing', 'Cancel'),
186+
variant: 'secondary',
187+
callback: () => {},
188+
},
189+
{
190+
label: t('files_sharing', 'Delete'),
191+
variant: 'error',
192+
callback: () => {
193+
confirmed = true
194+
},
195+
},
196+
])
197+
.build()
198+
199+
try {
200+
await dialog.show()
201+
} catch (error) {
202+
logger.debug('Delete confirmation dialog closed', { error })
203+
}
204+
205+
if (confirmed) {
206+
this.onDelete()
207+
}
208+
},
209+
174210
/**
175211
* Save potential changed data on menu close
176212
*/

0 commit comments

Comments
 (0)