From b07ef78fa236a3694e43a395dc1b7a528e3d5b82 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 13 Mar 2025 18:28:32 +0100 Subject: [PATCH] fix(files_sharing): ensure share status action works also in grid view Remove some hacks from files app about the *files_sharing* status action, in general not sure why this hack was there instead of being in the correct app - but it broke the grid view. So now the sharing information is also available in grid view. Moreover the icon is fixed in size to not overflow the actions menu. Signed-off-by: Ferdinand Thiessen --- .../components/FileEntry/FileEntryActions.vue | 36 ++++--- .../files_actions/sharingStatusAction.scss | 9 ++ ...action.cy.ts => share-status-action.cy.ts} | 101 +++++++++++------- 3 files changed, 92 insertions(+), 54 deletions(-) rename cypress/e2e/files_sharing/{files-inline-action.cy.ts => share-status-action.cy.ts} (55%) diff --git a/apps/files/src/components/FileEntry/FileEntryActions.vue b/apps/files/src/components/FileEntry/FileEntryActions.vue index 5793d06a0b1..e5619cba92f 100644 --- a/apps/files/src/components/FileEntry/FileEntryActions.vue +++ b/apps/files/src/components/FileEntry/FileEntryActions.vue @@ -25,12 +25,14 @@ :open.sync="openedMenu" @close="openedSubmenu = null"> - - {{ mountType === 'shared' && action.id === 'sharing-status' ? '' : actionDisplayName(action) }} + {{ actionDisplayName(action) }} @@ -223,10 +227,6 @@ export default defineComponent({ getBoundariesElement() { return document.querySelector('.app-content > .files-list') }, - - mountType() { - return this.source.attributes['mount-type'] - }, }, watch: { @@ -324,13 +324,19 @@ main.app-content[style*="mouse-pos-x"] .v-popper__popper { } - diff --git a/apps/files_sharing/src/files_actions/sharingStatusAction.scss b/apps/files_sharing/src/files_actions/sharingStatusAction.scss index 12f4b806f6a..3a6690f40f1 100644 --- a/apps/files_sharing/src/files_actions/sharingStatusAction.scss +++ b/apps/files_sharing/src/files_actions/sharingStatusAction.scss @@ -18,3 +18,12 @@ svg.sharing-status__avatar { border-radius: 32px; overflow: hidden; } + +.files-list__row-action-sharing-status { + .button-vue__text { + color: var(--color-primary-element); + } + .button-vue__icon { + color: var(--color-primary-element); + } +} diff --git a/cypress/e2e/files_sharing/files-inline-action.cy.ts b/cypress/e2e/files_sharing/share-status-action.cy.ts similarity index 55% rename from cypress/e2e/files_sharing/files-inline-action.cy.ts rename to cypress/e2e/files_sharing/share-status-action.cy.ts index 4d7763bd778..1b88810047a 100644 --- a/cypress/e2e/files_sharing/files-inline-action.cy.ts +++ b/cypress/e2e/files_sharing/share-status-action.cy.ts @@ -4,13 +4,13 @@ */ import type { User } from '@nextcloud/cypress' import { createShare } from './FilesSharingUtils.ts' -import { closeSidebar, getRowForFile } from '../files/FilesUtils.ts' +import { closeSidebar, enableGridMode, getActionButtonForFile, getRowForFile } from '../files/FilesUtils.ts' -describe('files_sharing: Files inline status action', { testIsolation: true }, () => { +describe('files_sharing: Sharing status action', { testIsolation: true }, () => { /** * Regression test of https://github.com/nextcloud/server/issues/45723 */ - it('No "shared" tag when user ID is purely numerical', () => { + it('No "shared" tag when user ID is purely numerical but there are no shares', () => { const user = { language: 'en', password: 'test1234', @@ -29,51 +29,54 @@ describe('files_sharing: Files inline status action', { testIsolation: true }, ( .should('not.exist') }) + it('Render quick option for sharing', () => { + cy.createRandomUser().then((user) => { + cy.mkdir(user, '/folder') + cy.login(user) + + cy.visit('/apps/files') + }) + + getRowForFile('folder') + .should('be.visible') + .find('[data-cy-files-list-row-actions]') + .findByRole('button', { name: /Show sharing options/ }) + .should('be.visible') + .click() + + // check the click opened the sidebar + cy.get('[data-cy-sidebar]') + .should('be.visible') + // and ensure the sharing tab is selected + .findByRole('tab', { name: 'Sharing', selected: true }) + .should('exist') + }) + describe('Sharing inline status action handling', () => { let user: User let sharee: User - beforeEach(() => { - cy.createRandomUser().then(($user) => { - user = $user - }) + before(() => { cy.createRandomUser().then(($user) => { sharee = $user }) - }) + cy.createRandomUser().then(($user) => { + user = $user + cy.mkdir(user, '/folder') + cy.login(user) - it('Render quick option for sharing', () => { - cy.mkdir(user, '/folder') - cy.login(user) + cy.visit('/apps/files') + getRowForFile('folder').should('be.visible') - cy.visit('/apps/files') - getRowForFile('folder') - .should('be.visible') - - getRowForFile('folder') - .should('be.visible') - .find('[data-cy-files-list-row-actions]') - .findByRole('button', { name: /Show sharing options/ }) - .should('be.visible') - .click() - - // check the click opened the sidebar - cy.get('[data-cy-sidebar]') - .should('be.visible') - // and ensure the sharing tab is selected - .findByRole('tab', { name: 'Sharing', selected: true }) - .should('exist') + createShare('folder', sharee.userId) + closeSidebar() + }) + cy.logout() }) it('Render inline status action for sharer', () => { - cy.mkdir(user, '/folder') cy.login(user) - cy.visit('/apps/files') - getRowForFile('folder') - .should('be.visible') - createShare('folder', sharee.userId) - closeSidebar() getRowForFile('folder') .should('be.visible') @@ -82,16 +85,21 @@ describe('files_sharing: Files inline status action', { testIsolation: true }, ( .should('be.visible') }) - it('Render inline status action for sharee', () => { - cy.mkdir(user, '/folder') + it('Render status action in gridview for sharer', () => { cy.login(user) - cy.visit('/apps/files') + enableGridMode() + getRowForFile('folder') .should('be.visible') - createShare('folder', sharee.userId) - closeSidebar() + getActionButtonForFile('folder') + .click() + cy.findByRole('menu') + .findByRole('menuitem', { name: /shared with/i }) + .should('be.visible') + }) + it('Render inline status action for sharee', () => { cy.login(sharee) cy.visit('/apps/files') @@ -101,5 +109,20 @@ describe('files_sharing: Files inline status action', { testIsolation: true }, ( .findByRole('button', { name: `Shared by ${user.userId}` }) .should('be.visible') }) + + it('Render status action in grid view for sharee', () => { + cy.login(sharee) + cy.visit('/apps/files') + + enableGridMode() + + getRowForFile('folder') + .should('be.visible') + getActionButtonForFile('folder') + .click() + cy.findByRole('menu') + .findByRole('menuitem', { name: `Shared by ${user.userId}` }) + .should('be.visible') + }) }) })