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
label?: IntlString
labelComponent?: AnyComponent
valueAttr?: string

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -49,6 +49,7 @@
export let attachmentImageSize: AttachmentImageSize = 'auto'
export let showLinksPreview = true
export let videoPreload = true
export let hideLink = false
export let compact = false
export let onClick: (() => void) | undefined = undefined
export let onReply: (() => void) | undefined = undefined
@ -183,11 +184,13 @@
{withFlatActions}
{hoverable}
{hoverStyles}
{skipLabel}
showDatePreposition={hideLink}
{onClick}
{onReply}
>
<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 slot="content">
{#if !isEditing}

View File

@ -160,7 +160,7 @@ export class CommonTrackerPage extends CalendarPage {
}
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> {

View File

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

View File

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

View File

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