From 8bedf1c29f49a5a492cd824c7bae109b4597dbe0 Mon Sep 17 00:00:00 2001 From: SebastianKrupinski Date: Mon, 15 Jun 2026 13:08:20 -0400 Subject: [PATCH] fix: empty trash bin action Signed-off-by: SebastianKrupinski --- .../AppNavigation/CalendarList/Trashbin.vue | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/components/AppNavigation/CalendarList/Trashbin.vue b/src/components/AppNavigation/CalendarList/Trashbin.vue index d77d06297c..3b5c7a1e54 100644 --- a/src/components/AppNavigation/CalendarList/Trashbin.vue +++ b/src/components/AppNavigation/CalendarList/Trashbin.vue @@ -164,7 +164,8 @@ export default { url: calendar._url, deletedAt: calendar._props['{http://nextcloud.com/ns}deleted-at'], color: calendar.color ?? uidToHexColor(calendar.displayname), - readonly: false, + canDelete: this.canDeleteCalendar(calendar), + canRestore: this.canRestoreCalendar(calendar), })) const formattedCalendarObjects = this.objects.map((vobject) => { let eventSummary = t('calendar', 'Untitled item') @@ -286,12 +287,34 @@ export default { return } this.items.forEach((item) => { - if (!this.canModify(item)) { + if (!item.canDelete) { return } this.onDeletePermanently(item) }) }, + + /** + * Whether the current user is allowed to restore a deleted calendar. + * + * @return {boolean} + */ + canRestoreCalendar(calendar) { + const privileges = calendar?.currentUserPrivilegeSet ?? [] + return privileges.includes('{DAV:}write') + || privileges.includes('{DAV:}all') + }, + + /** + * Whether the current user is allowed to permanently delete a deleted calendar. + * + * @return {boolean} + */ + canDeleteCalendar(calendar) { + const privileges = calendar?.currentUserPrivilegeSet ?? [] + return privileges.includes('{DAV:}write') + || privileges.includes('{DAV:}all') + }, }, }