From e9c7f3339407e0a3298121d5fc9205a8e2736eac Mon Sep 17 00:00:00 2001 From: Kristina Date: Thu, 25 Apr 2024 19:59:44 +0400 Subject: [PATCH] Do not display headers that duplicate content (#5468) Signed-off-by: Kristina Fefelova --- .../DocUpdateMessageHeader.svelte | 44 ++++++------------- .../DocUpdateMessagePresenter.svelte | 12 +---- .../attributes/SetAttributesPresenter.svelte | 9 +--- plugins/activity-resources/src/utils.ts | 7 +++ .../recruiting/common-recruiting-page.ts | 2 +- .../model/tracker/template-details-page.ts | 6 +-- .../sanity/tests/recruiting/vacancies.spec.ts | 2 +- tests/sanity/tests/tracker/mentions.spec.ts | 2 - tests/sanity/tests/tracker/milestone.spec.ts | 6 +-- tests/sanity/tests/tracker/template.spec.ts | 2 +- 10 files changed, 31 insertions(+), 61 deletions(-) diff --git a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageHeader.svelte b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageHeader.svelte index 226ea9809d..20a2275b1c 100644 --- a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageHeader.svelte +++ b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageHeader.svelte @@ -22,15 +22,14 @@ import { LinkData, getLinkData } from '../../activityMessagesUtils' import ActivityDocLink from '../ActivityDocLink.svelte' + import { getIsTextType } from '../../utils' export let message: DisplayDocUpdateMessage export let viewlet: DocUpdateMessageViewlet | undefined export let person: Person | undefined - export let objectName: IntlString | undefined = undefined export let object: Doc | undefined 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 @@ -42,7 +41,13 @@ linkData = data }) - function getTitle (): IntlString { + function getTitle (attributeModel: AttributeModel): IntlString | undefined { + const isTextType = getIsTextType(attributeModel) + + if (!isTextType) { + return undefined + } + const { attributeUpdates } = message const added = attributeUpdates?.added ?? [] const removed = attributeUpdates?.removed ?? [] @@ -60,35 +65,12 @@ {#if viewlet?.label} -{:else if message.previousMessages?.some(({ action }) => action !== message.action)} - {@const name = collectionName ?? objectName} - - -{:else if message.action === 'create' && objectName} - - -{:else if message.action === 'remove' && objectName} - - {:else if attributeModel} - - + {@const title = getTitle(attributeModel)} + {#if title} + + + {/if} {/if} {#if linkData} diff --git a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePresenter.svelte b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePresenter.svelte index 6b4034b93d..a449ef867b 100644 --- a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePresenter.svelte +++ b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePresenter.svelte @@ -173,17 +173,7 @@ {onClick} > - + {#if viewlet?.component && object} diff --git a/plugins/activity-resources/src/components/doc-update-message/attributes/SetAttributesPresenter.svelte b/plugins/activity-resources/src/components/doc-update-message/attributes/SetAttributesPresenter.svelte index 9f7d53183a..9a27b01fa4 100644 --- a/plugins/activity-resources/src/components/doc-update-message/attributes/SetAttributesPresenter.svelte +++ b/plugins/activity-resources/src/components/doc-update-message/attributes/SetAttributesPresenter.svelte @@ -15,10 +15,10 @@