From 046baa7efce259d5d8b7b88a12326623a3b4982d Mon Sep 17 00:00:00 2001 From: Elizabeth Danzberger Date: Thu, 19 Sep 2024 16:31:07 +0200 Subject: [PATCH] fix(sharing): Don't ask for guest name on view-only share Signed-off-by: Elizabeth Danzberger --- cypress/e2e/share-link.js | 4 +++- src/helpers/guestName.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cypress/e2e/share-link.js b/cypress/e2e/share-link.js index 9d01d35454..c16053f6d7 100644 --- a/cypress/e2e/share-link.js +++ b/cypress/e2e/share-link.js @@ -58,7 +58,9 @@ describe('Public sharing of office documents', function() { }, }) - cy.inputCollaboraGuestName(guestName) + // Assert that we do not ask for guest name on readonly document + cy.get('[data-cy="guestNameModal"]').should('not.exist') + cy.waitForCollabora() cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' }) diff --git a/src/helpers/guestName.js b/src/helpers/guestName.js index e88aa21e55..83cb6e340d 100644 --- a/src/helpers/guestName.js +++ b/src/helpers/guestName.js @@ -21,5 +21,9 @@ export function shouldAskForGuestName(mimetype, canWrite) { const noCurrentUser = !getCurrentUser() || getCurrentUser()?.uid === '' const isReadOnlyPDF = mimetype === 'application/pdf' && !canWrite + if (!canWrite) { + return false + } + return noLoggedInUser && noGuest && noCurrentUser && !isReadOnlyPDF }