Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBERF-9262: hide document activity & inline comments for guests & PDFs #7807

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions packages/panel/src/components/Panel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { Writable, writable } from 'svelte/store'

import activity from '@hcengineering/activity'
import { Doc } from '@hcengineering/core'
import { AccountRole, Doc, getCurrentAccount } from '@hcengineering/core'
import {
Component,
deviceOptionsStore as deviceInfo,
Expand Down Expand Up @@ -64,6 +64,11 @@
export let hideExtra: boolean = false
export let overflowExtra: boolean = false

const account = getCurrentAccount()
$: isGuest = account.role === AccountRole.DocGuest

$: showActivity = !withoutActivity && !isGuest

export function getAside (): string | boolean {
return panel.getAside()
}
Expand Down Expand Up @@ -109,7 +114,7 @@
afterUpdate(async () => {
const fn = await getResource(activity.function.ShouldScrollToActivity)

if (!withoutActivity && fn?.()) {
if (showActivity && fn?.()) {
return
}

Expand Down Expand Up @@ -243,7 +248,7 @@
{#if $deviceInfo.isMobile}
<div bind:this={content} class="popupPanel-body__mobile-content clear-mins" class:max={useMaxWidth}>
<slot />
{#if !withoutActivity}
{#if showActivity}
{#key object._id}
<Component
is={activity.component.Activity}
Expand All @@ -261,7 +266,7 @@
style:--side-content-space={`${sideContentSpace}px`}
>
<slot />
{#if !withoutActivity}
{#if showActivity}
{#key object._id}
<Component
is={activity.component.Activity}
Expand Down Expand Up @@ -295,7 +300,7 @@
}}
>
<slot />
{#if !withoutActivity}
{#if showActivity}
{#key object._id}
<Component
is={activity.component.Activity}
Expand Down
4 changes: 4 additions & 0 deletions packages/theme/styles/panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@
.panel-instance & {
background-color: var(--theme-panel-color);
border: 1px solid var(--theme-divider-color);

@media print {
border: none;
}
}

.popupPanel-title {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,25 @@
<script lang="ts">
import { Analytics } from '@hcengineering/analytics'
import {
AccountRole,
type Blob,
Class,
type CollaborativeDoc,
type Doc,
type Ref,
generateId,
getCurrentAccount,
makeDocCollabId
} from '@hcengineering/core'
import { IntlString, translate } from '@hcengineering/platform'
import {
DrawingCmd,
KeyedAttribute,
getAttribute,
getClient,
getFileUrl,
getImageSize,
imageSizeToRatio,
KeyedAttribute,
DrawingCmd
imageSizeToRatio
} from '@hcengineering/presentation'
import { markupToJSON } from '@hcengineering/text'
import {
Expand All @@ -56,19 +58,19 @@
import { createEventDispatcher, getContext, onDestroy, onMount } from 'svelte'
import { Doc as YDoc } from 'yjs'

import { Completion } from '../Completion'
import { deleteAttachment } from '../command/deleteAttachment'
import { textEditorCommandHandler } from '../commands'
import { EditorKitOptions, getEditorKit } from '../../src/kits/editor-kit'
import { Provider } from '../provider/types'
import { createLocalProvider, createRemoteProvider } from '../provider/utils'
import textEditor, {
CollaborationIds,
CollaborationUser,
RefAction,
TextEditorCommandHandler,
TextEditorHandler
} from '@hcengineering/text-editor'
import { EditorKitOptions, getEditorKit } from '../../src/kits/editor-kit'
import { Completion } from '../Completion'
import { deleteAttachment } from '../command/deleteAttachment'
import { textEditorCommandHandler } from '../commands'
import { Provider } from '../provider/types'
import { createLocalProvider, createRemoteProvider } from '../provider/utils'
import { addTableHandler } from '../utils'

import TextEditorToolbar from './TextEditorToolbar.svelte'
Expand All @@ -79,11 +81,11 @@
import { FileUploadExtension } from './extension/fileUploadExt'
import { ImageUploadExtension } from './extension/imageUploadExt'
import { InlineCommandsExtension } from './extension/inlineCommands'
import { InlineCommentCollaborationExtension } from './extension/inlineComment'
import { LeftMenuExtension } from './extension/leftMenu'
import { mermaidOptions } from './extension/mermaid'
import { type FileAttachFunction } from './extension/types'
import { completionConfig, inlineCommandsConfig } from './extensions'
import { mermaidOptions } from './extension/mermaid'
import { InlineCommentCollaborationExtension } from './extension/inlineComment'

export let object: Doc
export let attribute: KeyedAttribute
Expand Down Expand Up @@ -118,6 +120,9 @@
const client = getClient()
const dispatch = createEventDispatcher()

const account = getCurrentAccount()
$: isGuest = account.role === AccountRole.DocGuest

const objectClass = object._class
const objectId = object._id
const objectSpace = object.space
Expand Down Expand Up @@ -433,7 +438,7 @@
onMount(async () => {
await ph

if (enableInlineComments) {
if (enableInlineComments && !isGuest) {
lexiv0re marked this conversation as resolved.
Show resolved Hide resolved
optionalExtensions.push(
InlineCommentCollaborationExtension.configure({
ydoc,
Expand Down
8 changes: 5 additions & 3 deletions services/print/pod-print/src/print.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,23 @@ export async function print (url: string, options?: PrintOptions): Promise<Buffe
// Read page header and footer if defined
const pageHeader = await page.evaluate(() => {
const header = document.querySelector('#page-header')
return header !== null ? header.innerHTML : undefined
return header?.innerHTML ?? ''
})

const pageFooter = await page.evaluate(() => {
const footer = document.querySelector('#page-footer')
return footer !== null ? footer.innerHTML : undefined
return footer?.innerHTML ?? ''
})

const displayHeaderFooter = pageHeader !== '' || pageFooter !== ''

res = await page.pdf({
format: 'A4',
landscape: false,
timeout: 0,
headerTemplate: pageHeader,
footerTemplate: pageFooter,
displayHeaderFooter: pageHeader !== undefined || pageFooter !== undefined,
displayHeaderFooter,
margin: {
top: '1.5cm',
right: '1cm',
Expand Down
2 changes: 0 additions & 2 deletions tests/sanity/tests/tracker/public-link.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ test.describe('Tracker public link issues tests', () => {
await clearPage.goto(link)

const clearIssuesDetailsPage = new IssuesDetailsPage(clearPage)
await clearIssuesDetailsPage.waitDetailsOpened(publicLinkIssue.title)
await clearIssuesDetailsPage.checkIssue({
...publicLinkIssue,
status: 'Backlog'
Expand Down Expand Up @@ -91,7 +90,6 @@ test.describe('Tracker public link issues tests', () => {
await setTestOptions(clearPage)

const clearIssuesDetailsPage = new IssuesDetailsPage(clearPage)
await clearIssuesDetailsPage.waitDetailsOpened(publicLinkIssue.title)
await clearIssuesDetailsPage.checkIssue({
...publicLinkIssue,
status: 'Backlog'
Expand Down
Loading