Hide activity links for messages in context (#4964)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
Signed-off-by: Alex Velichko <alex@hardcoreeng.com>
Co-authored-by: Alex Velichko <alex@hardcoreeng.com>
This commit is contained in:
Kristina 2024-03-15 16:53:50 +04:00 committed by GitHub
parent 61263c7ffe
commit 730437e334
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 73 additions and 45 deletions

View File

@ -197,7 +197,6 @@ export class TDocUpdateMessageViewlet extends TDoc implements DocUpdateMessageVi
action!: DocUpdateAction action!: DocUpdateAction
label?: IntlString label?: IntlString
labelComponent?: AnyComponent
valueAttr?: string valueAttr?: string

View File

@ -17,6 +17,7 @@
"For": "For", "For": "For",
"From": "from", "From": "from",
"In": "In", "In": "In",
"At": "at",
"LastReply": "Last reply", "LastReply": "Last reply",
"New": "New", "New": "New",
"NewestFirst": "Newest first", "NewestFirst": "Newest first",

View File

@ -17,6 +17,7 @@
"For": "Для", "For": "Для",
"From": "из", "From": "из",
"In": "В", "In": "В",
"At": "В",
"LastReply": "Последний ответ", "LastReply": "Последний ответ",
"New": "Новые", "New": "Новые",
"NewestFirst": "Сначала новые", "NewestFirst": "Сначала новые",

View File

@ -102,6 +102,7 @@
is={activity.component.ActivityMessagePresenter} is={activity.component.ActivityMessagePresenter}
props={{ props={{
value: message, value: message,
hideLink: true,
boundary boundary
}} }}
/> />

View File

@ -42,6 +42,7 @@
export let actions: Action[] = [] export let actions: Action[] = []
export let hoverable = true export let hoverable = true
export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover' export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover'
export let hideLink = false
export let onClick: (() => void) | undefined = undefined export let onClick: (() => void) | undefined = undefined
$: personAccount = $personAccountByIdStore.get((value.createdBy ?? value.modifiedBy) as Ref<PersonAccount>) $: personAccount = $personAccountByIdStore.get((value.createdBy ?? value.modifiedBy) as Ref<PersonAccount>)
@ -95,6 +96,7 @@
object={undefined} object={undefined}
parentObject={undefined} parentObject={undefined}
isEdited={false} isEdited={false}
{hideLink}
label={value.title} label={value.title}
/> />
</svelte:fragment> </svelte:fragment>

View File

@ -28,11 +28,13 @@
export let object: Doc | undefined export let object: Doc | undefined
export let parentObject: Doc | undefined export let parentObject: Doc | undefined
export let label: IntlString | undefined = undefined export let label: IntlString | undefined = undefined
export let hideLink = false
export let isEdited: boolean = false export let isEdited: boolean = false
let linkData: LinkData | undefined = undefined let linkData: LinkData | undefined = undefined
$: void getLinkData(message, object, parentObject, person).then((data) => { $: !hideLink &&
getLinkData(message, object, parentObject, person).then((data) => {
linkData = data linkData = data
}) })
</script> </script>

View File

@ -38,6 +38,7 @@
export let attachmentImageSize: 'x-large' | undefined = undefined export let attachmentImageSize: 'x-large' | undefined = undefined
export let showLinksPreview = true export let showLinksPreview = true
export let videoPreload = true export let videoPreload = true
export let hideLink = false
export let compact = false export let compact = false
export let onClick: (() => void) | undefined = undefined export let onClick: (() => void) | undefined = undefined
export let onReply: (() => void) | undefined = undefined export let onReply: (() => void) | undefined = undefined
@ -71,6 +72,7 @@
attachmentImageSize, attachmentImageSize,
showLinksPreview, showLinksPreview,
videoPreload, videoPreload,
hideLink,
compact, compact,
onClick, onClick,
onReply onReply

View File

@ -53,6 +53,7 @@
export let skipLabel = false export let skipLabel = false
export let hoverable = true export let hoverable = true
export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover' export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover'
export let showDatePreposition = false
export let onClick: (() => void) | undefined = undefined export let onClick: (() => void) | undefined = undefined
export let onReply: (() => void) | undefined = undefined export let onReply: (() => void) | undefined = undefined
@ -170,6 +171,13 @@
{#if !skipLabel} {#if !skipLabel}
<slot name="header" /> <slot name="header" />
{/if} {/if}
{#if !skipLabel && showDatePreposition}
<span class="text-sm lower">
<Label label={activity.string.At} />
</span>
{/if}
<span <span
class="text-sm" class="text-sm"
use:tooltip={{ use:tooltip={{

View File

@ -42,6 +42,7 @@
export let excludedActions: string[] = [] export let excludedActions: string[] = []
export let hoverable = true export let hoverable = true
export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover' export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover'
export let hideLink = false
export let compact = false export let compact = false
export let onClick: (() => void) | undefined = undefined export let onClick: (() => void) | undefined = undefined
export let onReply: (() => void) | undefined = undefined export let onReply: (() => void) | undefined = undefined
@ -121,7 +122,7 @@
<span class="text-sm lower ml-1"> <span class="text-sm lower ml-1">
<Label label={activity.string.Mentioned} /> <Label label={activity.string.Mentioned} />
</span> </span>
{#if targetDoc} {#if !hideLink && targetDoc}
<DocNavLink object={targetDoc} component={targetPanel?.component ?? view.component.EditDoc} shrink={0}> <DocNavLink object={targetDoc} component={targetPanel?.component ?? view.component.EditDoc} shrink={0}>
<span class="text-sm"> <span class="text-sm">
{#if currentAccount.person === targetDoc._id} {#if currentAccount.person === targetDoc._id}

View File

@ -31,12 +31,14 @@
export let parentObject: Doc | undefined export let parentObject: Doc | undefined
export let attributeModel: AttributeModel | undefined = undefined export let attributeModel: AttributeModel | undefined = undefined
export let collectionName: IntlString | undefined = undefined export let collectionName: IntlString | undefined = undefined
export let hideLink = false
const isOwn = message.objectId === message.attachedTo const isOwn = message.objectId === message.attachedTo
let linkData: LinkData | undefined = undefined let linkData: LinkData | undefined = undefined
$: void getLinkData(message, object, parentObject, person).then((data) => { $: !hideLink &&
getLinkData(message, object, parentObject, person).then((data) => {
linkData = data linkData = data
}) })

View File

@ -51,6 +51,7 @@
export let excludedActions: string[] = [] export let excludedActions: string[] = []
export let hoverable = true export let hoverable = true
export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover' export let hoverStyles: 'borderedHover' | 'filledHover' = 'borderedHover'
export let hideLink = false
export let onClick: (() => void) | undefined = undefined export let onClick: (() => void) | undefined = undefined
export let onReply: (() => void) | undefined = undefined export let onReply: (() => void) | undefined = undefined
@ -161,13 +162,11 @@
{withFlatActions} {withFlatActions}
{hoverable} {hoverable}
{hoverStyles} {hoverStyles}
showDatePreposition={hideLink}
{onClick} {onClick}
{onReply} {onReply}
> >
<svelte:fragment slot="header"> <svelte:fragment slot="header">
{#if viewlet?.labelComponent && object}
<Component is={viewlet.labelComponent} props={{ value: object }} />
{:else if object}
<DocUpdateMessageHeader <DocUpdateMessageHeader
message={value} message={value}
{object} {object}
@ -177,8 +176,8 @@
{objectName} {objectName}
{collectionName} {collectionName}
{attributeModel} {attributeModel}
{hideLink}
/> />
{/if}
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="content"> <svelte:fragment slot="content">
{#if viewlet?.component && object} {#if viewlet?.component && object}

View File

@ -237,7 +237,6 @@ export interface DocUpdateMessageViewlet extends ActivityMessageViewlet {
valueAttr?: string valueAttr?: string
label?: IntlString label?: IntlString
labelComponent?: AnyComponent
icon?: Asset icon?: Asset
component?: AnyComponent component?: AnyComponent
@ -345,6 +344,7 @@ export default plugin(activityId, {
To: '' as IntlString, To: '' as IntlString,
Unset: '' as IntlString, Unset: '' as IntlString,
In: '' as IntlString, In: '' as IntlString,
At: '' as IntlString,
NewestFirst: '' as IntlString, NewestFirst: '' as IntlString,
Edit: '' as IntlString, Edit: '' as IntlString,
Updated: '' as IntlString, Updated: '' as IntlString,

View File

@ -586,6 +586,7 @@
withShowMore={false} withShowMore={false}
attachmentImageSize="x-large" attachmentImageSize="x-large"
showLinksPreview={false} showLinksPreview={false}
hideLink
/> />
</div> </div>
{/each} {/each}

View File

@ -28,10 +28,12 @@
export let object: Doc | undefined export let object: Doc | undefined
export let parentObject: Doc | undefined export let parentObject: Doc | undefined
export let skipLabel = false export let skipLabel = false
export let hideLink = false
let linkData: LinkData | undefined = undefined let linkData: LinkData | undefined = undefined
$: getLinkData(message, object, parentObject, person).then((data) => { $: !hideLink &&
getLinkData(message, object, parentObject, person).then((data) => {
linkData = data linkData = data
}) })
</script> </script>

View File

@ -14,7 +14,7 @@
// limitations under the License. // limitations under the License.
--> -->
<script lang="ts"> <script lang="ts">
import { createEventDispatcher, onMount } from 'svelte' import { createEventDispatcher } from 'svelte'
import { Doc, Ref, SortingOrder } from '@hcengineering/core' import { Doc, Ref, SortingOrder } from '@hcengineering/core'
import { createQuery } from '@hcengineering/presentation' import { createQuery } from '@hcengineering/presentation'
import activity from '@hcengineering/activity' import activity from '@hcengineering/activity'
@ -87,7 +87,7 @@
{#each messages as message} {#each messages as message}
<div class="item"> <div class="item">
<Lazy> <Lazy>
<ChatMessagePresenter value={message} /> <ChatMessagePresenter value={message} hideLink />
</Lazy> </Lazy>
</div> </div>
{/each} {/each}
@ -125,7 +125,7 @@
.messages { .messages {
overflow: auto; overflow: auto;
flex: 1; flex: 1;
padding: 0 1rem; padding: 0.75rem 0.25rem;
min-width: 0; min-width: 0;
min-height: 0; min-height: 0;

View File

@ -49,6 +49,7 @@
export let attachmentImageSize: AttachmentImageSize = 'auto' export let attachmentImageSize: AttachmentImageSize = 'auto'
export let showLinksPreview = true export let showLinksPreview = true
export let videoPreload = true export let videoPreload = true
export let hideLink = false
export let compact = false export let compact = false
export let onClick: (() => void) | undefined = undefined export let onClick: (() => void) | undefined = undefined
export let onReply: (() => void) | undefined = undefined export let onReply: (() => void) | undefined = undefined
@ -183,11 +184,13 @@
{withFlatActions} {withFlatActions}
{hoverable} {hoverable}
{hoverStyles} {hoverStyles}
{skipLabel}
showDatePreposition={hideLink}
{onClick} {onClick}
{onReply} {onReply}
> >
<svelte:fragment slot="header"> <svelte:fragment slot="header">
<ChatMessageHeader {object} {parentObject} message={value} {viewlet} {person} {skipLabel} /> <ChatMessageHeader {object} {parentObject} message={value} {viewlet} {person} {skipLabel} {hideLink} />
</svelte:fragment> </svelte:fragment>
<svelte:fragment slot="content"> <svelte:fragment slot="content">
{#if !isEditing} {#if !isEditing}

View File

@ -160,7 +160,7 @@ export class CommonTrackerPage extends CalendarPage {
} }
async checkCommentExist (comment: string): Promise<void> { async checkCommentExist (comment: string): Promise<void> {
await expect(this.textComment.filter({ hasText: comment })).toBeVisible() await expect(this.textComment.filter({ hasText: comment }).first()).toBeVisible()
} }
async checkActivityExist (activity: string): Promise<void> { async checkActivityExist (activity: string): Promise<void> {

View File

@ -6,18 +6,22 @@ const config: PlaywrightTestConfig = {
projects: [ projects: [
{ {
name: 'Platform', name: 'Platform',
use: { ...devices['Desktop Chrome'] }
}
],
use: { use: {
...devices['Desktop Chrome'],
screenshot: 'only-on-failure', screenshot: 'only-on-failure',
viewport: {
width: 1440,
height: 900
},
trace: { trace: {
mode: 'retain-on-failure', mode: 'retain-on-failure',
snapshots: true, snapshots: true,
screenshots: true, screenshots: true,
sources: true sources: true
} }
}, }
}
],
retries: 1, retries: 1,
timeout: 60000, timeout: 60000,
maxFailures: 5, maxFailures: 5,

View File

@ -165,7 +165,7 @@ test.describe('Vacancy tests', () => {
const vacancyDetailsPage = new VacancyDetailsPage(page) const vacancyDetailsPage = new VacancyDetailsPage(page)
await vacancyDetailsPage.moreActionOn('Archive') await vacancyDetailsPage.moreActionOn('Archive')
await vacancyDetailsPage.pressYesForPopup(page) await vacancyDetailsPage.pressYesForPopup(page)
await vacancyDetailsPage.checkActivityExist('changed archived in') await vacancyDetailsPage.checkActivityExist('changed archived at')
await navigationMenuPage.buttonVacancies.click() await navigationMenuPage.buttonVacancies.click()
await vacanciesPage.checkVacancyNotExist( await vacanciesPage.checkVacancyNotExist(

View File

@ -62,9 +62,9 @@ test.describe('Tracker milestone tests', () => {
await milestonesDetailsPage.addComment(commentText) await milestonesDetailsPage.addComment(commentText)
await milestonesDetailsPage.checkCommentExist(commentText) await milestonesDetailsPage.checkCommentExist(commentText)
await milestonesDetailsPage.checkActivityExist('created milestone') await milestonesDetailsPage.checkActivityExist('created milestone')
await milestonesDetailsPage.checkActivityExist('changed target date in') await milestonesDetailsPage.checkActivityExist('changed target date at')
await milestonesDetailsPage.checkActivityExist('changed status in') await milestonesDetailsPage.checkActivityExist('changed status at')
await milestonesDetailsPage.checkActivityExist('changed description in') await milestonesDetailsPage.checkActivityExist('changed description at')
}) })
test('Delete a Milestone', async ({ page }) => { test('Delete a Milestone', async ({ page }) => {