From e4196a48a7d3236af320931add47448a3c630585 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Sun, 23 Aug 2026 19:00:26 +0200 Subject: [PATCH] feat(overview): flag shared files with a sharing indicator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Files in the overview could not be told apart by sharing state. Show a "shared" indicator on both the grid cards and the list rows. A file counts as shared when the current user has shared it out (a non-empty oc:share-types) or it is owned by someone else and shared with them — the same definition the Files app uses. The overview did not fetch sharing state, so register the oc:share-types DAV property, as files_sharing does, to include it in the search results. The indicator carries an accessible label ("Shared", or "Shared by {owner}" for an incoming share) so the state is never conveyed by icon or colour alone. In the grid it uses a new FileCard overlay slot over the thumbnail; in the list it joins the favourite star in the indicator slot. Co-Authored-By: Claude Opus 4.8 Signed-off-by: Frank Karlitschek --- src/components/FileCard.spec.ts | 8 ++++ src/components/FileCard.vue | 20 ++++++++++ src/components/ShareIndicator.spec.ts | 51 ++++++++++++++++++++++++++ src/components/ShareIndicator.vue | 53 +++++++++++++++++++++++++++ src/services/officeFiles.spec.ts | 9 +++++ src/services/officeFiles.ts | 9 ++++- src/test-utils/fixtures.ts | 6 +++ src/utils/fileSharing.spec.ts | 50 +++++++++++++++++++++++++ src/utils/fileSharing.ts | 44 ++++++++++++++++++++++ src/views/OfficeOverview.vue | 22 +++++++++-- 10 files changed, 267 insertions(+), 5 deletions(-) create mode 100644 src/components/ShareIndicator.spec.ts create mode 100644 src/components/ShareIndicator.vue create mode 100644 src/utils/fileSharing.spec.ts create mode 100644 src/utils/fileSharing.ts diff --git a/src/components/FileCard.spec.ts b/src/components/FileCard.spec.ts index 9f74c91..105c894 100644 --- a/src/components/FileCard.spec.ts +++ b/src/components/FileCard.spec.ts @@ -36,4 +36,12 @@ describe('FileCard', () => { const withSubname = mount(FileCard, { slots: { subname: 'a subname' } }) expect(withSubname.find('.file-card__subname').text()).toBe('a subname') }) + + it('only renders the overlay slot when provided', () => { + const without = mount(FileCard) + expect(without.find('.file-card__overlay').exists()).toBe(false) + + const withOverlay = mount(FileCard, { slots: { overlay: 'a badge' } }) + expect(withOverlay.find('.file-card__overlay').text()).toBe('a badge') + }) }) diff --git a/src/components/FileCard.vue b/src/components/FileCard.vue index 744c60b..78aeeab 100644 --- a/src/components/FileCard.vue +++ b/src/components/FileCard.vue @@ -11,6 +11,9 @@ defineEmits<{ click: [event: MouseEvent] }>()