From 730437e334faaa88df48e392d08c4ba6ede3a49b Mon Sep 17 00:00:00 2001 From: Kristina Date: Fri, 15 Mar 2024 16:53:50 +0400 Subject: [PATCH] Hide activity links for messages in context (#4964) Signed-off-by: Kristina Fefelova Signed-off-by: Alex Velichko Co-authored-by: Alex Velichko --- models/activity/src/index.ts | 1 - plugins/activity-assets/lang/en.json | 1 + plugins/activity-assets/lang/ru.json | 1 + .../src/components/Activity.svelte | 1 + .../ActivityInfoMessagePresenter.svelte | 2 ++ .../ActivityMessageHeader.svelte | 8 +++--- .../ActivityMessagePresenter.svelte | 2 ++ .../ActivityMessageTemplate.svelte | 8 ++++++ .../ActivityReferencePresenter.svelte | 3 ++- .../DocUpdateMessageHeader.svelte | 8 +++--- .../DocUpdateMessagePresenter.svelte | 27 +++++++++---------- plugins/activity/src/index.ts | 2 +- .../src/components/ChannelScrollView.svelte | 1 + .../chat-message/ChatMessageHeader.svelte | 8 +++--- .../chat-message/ChatMessagePopup.svelte | 6 ++--- .../chat-message/ChatMessagePresenter.svelte | 5 +++- .../model/tracker/common-tracker-page.ts | 2 +- tests/sanity/tests/playwright.config.ts | 24 ++++++++++------- .../sanity/tests/recruiting/vacancies.spec.ts | 2 +- tests/sanity/tests/tracker/milestone.spec.ts | 6 ++--- 20 files changed, 73 insertions(+), 45 deletions(-) diff --git a/models/activity/src/index.ts b/models/activity/src/index.ts index dd3bd0adb3..cdb45f7dfd 100644 --- a/models/activity/src/index.ts +++ b/models/activity/src/index.ts @@ -197,7 +197,6 @@ export class TDocUpdateMessageViewlet extends TDoc implements DocUpdateMessageVi action!: DocUpdateAction label?: IntlString - labelComponent?: AnyComponent valueAttr?: string diff --git a/plugins/activity-assets/lang/en.json b/plugins/activity-assets/lang/en.json index 17d76f910f..310f7305e6 100644 --- a/plugins/activity-assets/lang/en.json +++ b/plugins/activity-assets/lang/en.json @@ -17,6 +17,7 @@ "For": "For", "From": "from", "In": "In", + "At": "at", "LastReply": "Last reply", "New": "New", "NewestFirst": "Newest first", diff --git a/plugins/activity-assets/lang/ru.json b/plugins/activity-assets/lang/ru.json index 3141df940f..b654d338ba 100644 --- a/plugins/activity-assets/lang/ru.json +++ b/plugins/activity-assets/lang/ru.json @@ -17,6 +17,7 @@ "For": "Для", "From": "из", "In": "В", + "At": "В", "LastReply": "Последний ответ", "New": "Новые", "NewestFirst": "Сначала новые", diff --git a/plugins/activity-resources/src/components/Activity.svelte b/plugins/activity-resources/src/components/Activity.svelte index 26297155fe..53a28a07af 100644 --- a/plugins/activity-resources/src/components/Activity.svelte +++ b/plugins/activity-resources/src/components/Activity.svelte @@ -102,6 +102,7 @@ is={activity.component.ActivityMessagePresenter} props={{ value: message, + hideLink: true, boundary }} /> diff --git a/plugins/activity-resources/src/components/activity-message/ActivityInfoMessagePresenter.svelte b/plugins/activity-resources/src/components/activity-message/ActivityInfoMessagePresenter.svelte index 46f747c814..1b44c61a57 100644 --- a/plugins/activity-resources/src/components/activity-message/ActivityInfoMessagePresenter.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityInfoMessagePresenter.svelte @@ -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) @@ -95,6 +96,7 @@ object={undefined} parentObject={undefined} isEdited={false} + {hideLink} label={value.title} /> diff --git a/plugins/activity-resources/src/components/activity-message/ActivityMessageHeader.svelte b/plugins/activity-resources/src/components/activity-message/ActivityMessageHeader.svelte index 619cd4dc97..6b6c3d313e 100644 --- a/plugins/activity-resources/src/components/activity-message/ActivityMessageHeader.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityMessageHeader.svelte @@ -28,13 +28,15 @@ 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) => { - linkData = data - }) + $: !hideLink && + getLinkData(message, object, parentObject, person).then((data) => { + linkData = data + }) diff --git a/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte b/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte index 9abcd24a2d..49acceab1b 100644 --- a/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte @@ -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 diff --git a/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte b/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte index 2c0bf4d8af..9894503e65 100644 --- a/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte @@ -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} {/if} + + {#if !skipLabel && showDatePreposition} + + + {/if} + void) | undefined = undefined export let onReply: (() => void) | undefined = undefined @@ -121,7 +122,7 @@ - {#if targetDoc} + {#if !hideLink && targetDoc} {#if currentAccount.person === targetDoc._id} 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 5a80f9c9a6..226ea9809d 100644 --- a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageHeader.svelte +++ b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessageHeader.svelte @@ -31,14 +31,16 @@ 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) => { - linkData = data - }) + $: !hideLink && + getLinkData(message, object, parentObject, person).then((data) => { + linkData = data + }) function getTitle (): IntlString { const { attributeUpdates } = message 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 3855116ad4..8f9d6fcd56 100644 --- a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePresenter.svelte +++ b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePresenter.svelte @@ -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,24 +162,22 @@ {withFlatActions} {hoverable} {hoverStyles} + showDatePreposition={hideLink} {onClick} {onReply} > - {#if viewlet?.labelComponent && object} - - {:else if object} - - {/if} + {#if viewlet?.component && object} diff --git a/plugins/activity/src/index.ts b/plugins/activity/src/index.ts index 7cdd10211b..f15898c011 100644 --- a/plugins/activity/src/index.ts +++ b/plugins/activity/src/index.ts @@ -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, diff --git a/plugins/chunter-resources/src/components/ChannelScrollView.svelte b/plugins/chunter-resources/src/components/ChannelScrollView.svelte index 2bcabe1720..22647f1f68 100644 --- a/plugins/chunter-resources/src/components/ChannelScrollView.svelte +++ b/plugins/chunter-resources/src/components/ChannelScrollView.svelte @@ -586,6 +586,7 @@ withShowMore={false} attachmentImageSize="x-large" showLinksPreview={false} + hideLink /> {/each} diff --git a/plugins/chunter-resources/src/components/chat-message/ChatMessageHeader.svelte b/plugins/chunter-resources/src/components/chat-message/ChatMessageHeader.svelte index 51254a8c46..0bde5b84c2 100644 --- a/plugins/chunter-resources/src/components/chat-message/ChatMessageHeader.svelte +++ b/plugins/chunter-resources/src/components/chat-message/ChatMessageHeader.svelte @@ -28,12 +28,14 @@ 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) => { - linkData = data - }) + $: !hideLink && + getLinkData(message, object, parentObject, person).then((data) => { + linkData = data + }) {#if !skipLabel} diff --git a/plugins/chunter-resources/src/components/chat-message/ChatMessagePopup.svelte b/plugins/chunter-resources/src/components/chat-message/ChatMessagePopup.svelte index 4d6d0bf9f5..e60ca332c7 100644 --- a/plugins/chunter-resources/src/components/chat-message/ChatMessagePopup.svelte +++ b/plugins/chunter-resources/src/components/chat-message/ChatMessagePopup.svelte @@ -14,7 +14,7 @@ // limitations under the License. -->