diff --git a/src/helpers/guestName.js b/src/helpers/guestName.js index bfd5d667d6..4e352479e4 100644 --- a/src/helpers/guestName.js +++ b/src/helpers/guestName.js @@ -20,12 +20,13 @@ const setGuestNameCookie = (username) => { } } -const shouldAskForGuestName = () => { +const shouldAskForGuestName = (mimetype, canWrite) => { const noLoggedInUser = !getLoggedInUser() const noGuestCookie = !cookieAlreadySet('guestUser') const noCurrentUser = !getCurrentUser() || getCurrentUser()?.uid === '' + const isReadOnlyPDF = mimetype === 'application/pdf' && !canWrite - return noLoggedInUser && noGuestCookie && noCurrentUser + return noLoggedInUser && noGuestCookie && noCurrentUser && !isReadOnlyPDF } export { diff --git a/src/view/Office.vue b/src/view/Office.vue index f3b4665913..b22461b92d 100644 --- a/src/view/Office.vue +++ b/src/view/Office.vue @@ -159,6 +159,14 @@ export default { type: String, default: null, }, + mime: { + type: String, + default: null, + }, + permissions: { + type: String, + default: '', + }, isEmbedded: { type: Boolean, default: false, @@ -271,7 +279,7 @@ export default { } this.postMessage.registerPostMessageHandler(this.postMessageHandler) - if (shouldAskForGuestName()) { + if (shouldAskForGuestName(this.mime, this.permissions?.includes('W'))) { const { default: GuestNamePicker } = await import( /* webpackChunkName: 'GuestNamePicker' */ '../components/GuestNamePicker.vue')