Fix activity for removed tags (#8761)

* Fix activity for removed tags

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>

* Fix text

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>

---------

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2025-04-29 11:48:17 +04:00 committed by GitHub
parent 5fa9daee8f
commit 80a14b3f08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 67 additions and 32 deletions

View File

@ -41,5 +41,5 @@
{#if data.action === 'create'}
<ActivityObjectValue {message} {card} />
{:else if data.update && data.action === 'update'}
<ActivityUpdateViewer update={data.update} model={attributeModel} />
<ActivityUpdateViewer update={data.update} model={attributeModel} content={message.content} />
{/if}

View File

@ -15,7 +15,7 @@
<script lang="ts">
import { getClient } from '@hcengineering/presentation'
import { IconDelete } from '@hcengineering/ui'
import { ActivityTagUpdate } from '@hcengineering/communication-types'
import { ActivityTagUpdate, RichText } from '@hcengineering/communication-types'
import cardPlugin from '@hcengineering/card'
import Icon from '../../Icon.svelte'
@ -24,30 +24,42 @@
import uiNext from '../../../plugin'
export let update: ActivityTagUpdate
export let content: RichText
const client = getClient()
const hierarchy = client.getHierarchy()
$: mixin = hierarchy.getClass(update.tag)
$: mixin = hierarchy.hasClass(update.tag) ? hierarchy.getClass(update.tag) : undefined
</script>
{#if update.action === 'add'}
<div class="flex-presenter overflow-label flex-gap-2">
<Icon icon={IconPlus} size="small" />
<Label label={uiNext.string.Added} />
<span class="lower"><Label label={cardPlugin.string.Tag} /></span>
<div class="tag no-word-wrap">
<Label label={mixin.label} />
{#if mixin !== undefined}
{#if update.action === 'add'}
<div class="flex-presenter overflow-label flex-gap-2">
<Icon icon={IconPlus} size="small" />
<Label label={uiNext.string.Added} />
<span class="lower"><Label label={cardPlugin.string.Tag} /></span>
<div class="tag no-word-wrap">
<Label label={mixin.label} />
</div>
</div>
</div>
{:else if update.action === 'remove'}
<div class="flex-presenter overflow-label flex-gap-2">
<Icon icon={IconDelete} size="small" />
<Label label={uiNext.string.Removed} />
<span class="lower"><Label label={cardPlugin.string.Tag} /></span>
<div class="tag no-word-wrap">
<Label label={mixin.label} />
{:else if update.action === 'remove'}
<div class="flex-presenter overflow-label flex-gap-2">
<Icon icon={IconDelete} size="small" />
<Label label={uiNext.string.Removed} />
<span class="lower"><Label label={cardPlugin.string.Tag} /></span>
<div class="tag no-word-wrap">
<Label label={mixin.label} />
</div>
</div>
{/if}
{:else}
<div class="flex-presenter overflow-label flex-gap-2">
{#if update.action === 'add'}
<Icon icon={IconPlus} size="small" />
{:else if update.action === 'remove'}
<Icon icon={IconDelete} size="small" />
{/if}
{content}
</div>
{/if}

View File

@ -14,17 +14,18 @@
-->
<script lang="ts">
import { AttributeModel } from '@hcengineering/view'
import { ActivityUpdate, ActivityUpdateType } from '@hcengineering/communication-types'
import { ActivityUpdate, ActivityUpdateType, RichText } from '@hcengineering/communication-types'
import ActivityUpdateTagViewer from './ActivityUpdateTagViewer.svelte'
import ActivityUpdateAttributeViewer from './ActivityUpdateAttributeViewer.svelte'
export let model: AttributeModel | undefined = undefined
export let update: ActivityUpdate
export let content: RichText
</script>
{#if update.type === ActivityUpdateType.Attribute && model}
<ActivityUpdateAttributeViewer {model} {update} />
{:else if update.type === ActivityUpdateType.Tag}
<ActivityUpdateTagViewer {update} />
<ActivityUpdateTagViewer {update} {content} />
{/if}

View File

@ -53,6 +53,8 @@
"UpdatedObject": "Aktualizovaný {object}",
"NewObjectType": "Nový {type}: {title}",
"RemovedObjectType": "Odstraněný {type} : {title}",
"AttributeSetTo": "{name} nastaveno na {value}"
"AttributeSetTo": "{name} nastaveno na {value}",
"AddedTag": "Přidaný štítek: {title}",
"RemovedTag": "Odebráný štítek: {title}"
}
}

View File

@ -53,6 +53,8 @@
"UpdatedObject": "{object} aktualisiert",
"NewObjectType": "Neues {objectType}",
"RemovedObjectType": "{objectType} entfernt",
"AttributeSetTo": "{attribute} auf {value} gesetzt"
"AttributeSetTo": "{attribute} auf {value} gesetzt",
"AddedTag": "Tag hinzugefügt: {title}",
"RemovedTag": "Tag entfernt: {title}"
}
}

View File

@ -53,6 +53,8 @@
"UpdatedObject": "Updated {object}",
"NewObjectType": "New {type}: {title}",
"RemovedObjectType": "Removed {type} : {title}",
"AddedTag": "Added tag: {title}",
"RemovedTag": "Removed tag: {title}",
"AttributeSetTo": "{name} set to {value}"
}
}

View File

@ -52,6 +52,8 @@
"UpdatedObject": "Actualizado {object}",
"NewObjectType": "Nuevo {type}: {title}",
"RemovedObjectType": "Eliminado {type} : {title}",
"AttributeSetTo": "{name} establecido en {value}"
"AttributeSetTo": "{name} establecido en {value}",
"AddedTag": "Etiqueta añadida: {title}",
"RemovedTag": "Etiqueta eliminada: {title}"
}
}

View File

@ -53,6 +53,8 @@
"UpdatedObject": "Mis à jour {object}",
"NewObjectType": "Nouveau {type}: {title}",
"RemovedObjectType": "Supprimé {type} : {title}",
"AttributeSetTo": "{name} défini sur {value}"
"AttributeSetTo": "{name} défini sur {value}",
"AddedTag": "Tag ajouté: {title}",
"RemovedTag": "Tag supprimé: {title}"
}
}

View File

@ -53,6 +53,8 @@
"UpdatedObject": "{object} aggiornato",
"NewObjectType": "Nuovo {type}: {title}",
"RemovedObjectType": "{type} rimosso: {title}",
"AttributeSetTo": "{name} impostato su {value}"
"AttributeSetTo": "{name} impostato su {value}",
"AddedTag": "Tag aggiunto: {title}",
"RemovedTag": "Tag rimosso: {title}"
}
}

View File

@ -53,7 +53,9 @@
"UpdatedObject": "{object} を更新しました",
"NewObjectType": "新しい {type}{title}",
"RemovedObjectType": "{type} を削除:{title}",
"AttributeSetTo": "{name} を {value} に設定しました"
"AttributeSetTo": "{name} を {value} に設定しました",
"AddedTag": "タグを追加しました:{title}",
"RemovedTag": "タグを削除しました:{title}"
}
}

View File

@ -52,6 +52,8 @@
"UpdatedObject": "Atualizado {object}",
"NewObjectType": "Novo {type}: {title}",
"RemovedObjectType": "Removido {type} : {title}",
"AttributeSetTo": "{name} definido para {value}"
"AttributeSetTo": "{name} definido para {value}",
"AddedTag": "Tag adicionado: {title}",
"RemovedTag": "Tag removido: {title}"
}
}

View File

@ -53,6 +53,8 @@
"UpdatedObject": "Обновил(а) {object}",
"NewObjectType": "Новый(ые) {type}: {title}",
"RemovedObjectType": "Удален(ы) {type} : {title}",
"AttributeSetTo": "{name} установлен на {value}"
"AttributeSetTo": "{name} установлен на {value}",
"AddedTag": "Добавлен тег: {title}",
"RemovedTag": "Удален тег: {title}"
}
}

View File

@ -53,6 +53,8 @@
"UpdatedObject": "更新 {object}",
"NewObjectType": "新 {type}: {title}",
"RemovedObjectType": "移除 {type} : {title}",
"AttributeSetTo": "{name} 设置为 {value}"
"AttributeSetTo": "{name} 设置为 {value}",
"AddedTag": "添加标签: {title}",
"RemovedTag": "移除标签: {title}"
}
}

View File

@ -320,7 +320,9 @@ export default plugin(activityId, {
UpdatedObject: '' as IntlString,
NewObjectType: '' as IntlString,
RemovedObjectType: '' as IntlString,
AttributeSetTo: '' as IntlString
AttributeSetTo: '' as IntlString,
AddedTag: '' as IntlString,
RemovedTag: '' as IntlString
},
component: {
Activity: '' as AnyComponent,

View File

@ -162,11 +162,11 @@ async function getUpdateText (update: ActivityUpdate, card: Card, hierarchy: Hie
const clazz = hierarchy.getClass(update.tag)
if (update.action === 'add') {
const tagName = await translate(clazz.label, {})
return await translate(activity.string.NewObjectType, { type: 'tag', title: tagName })
return await translate(activity.string.AddedTag, { title: tagName })
}
if (update.action === 'remove') {
const tagName = await translate(clazz.label, {})
return await translate(activity.string.RemovedObjectType, { type: 'tag', title: tagName })
return await translate(activity.string.RemovedTag, { title: tagName })
}
}
return undefined