From 7868126e15b530864a0c7362ba1c3bde0b8c2220 Mon Sep 17 00:00:00 2001
From: Alexander Platov <sas_lord@mail.ru>
Date: Mon, 3 Apr 2023 22:08:08 +0300
Subject: [PATCH] TSK-1016. The avatar for attachments is the same as for
 Comments (#2878)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
---
 plugins/activity-resources/package.json       |  3 ++-
 .../src/components/TxView.svelte              | 19 +++++++++++++++----
 .../src/components/TagItem.svelte             |  2 +-
 .../src/components/BooleanPresenter.svelte    |  6 +++---
 4 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/plugins/activity-resources/package.json b/plugins/activity-resources/package.json
index c23ae4d3e6..a6b29b7190 100644
--- a/plugins/activity-resources/package.json
+++ b/plugins/activity-resources/package.json
@@ -42,6 +42,7 @@
     "@hcengineering/contact": "^0.6.11",
     "@hcengineering/notification": "^0.6.8",
     "@hcengineering/view": "^0.6.2",
-    "@hcengineering/view-resources": "^0.6.0"
+    "@hcengineering/view-resources": "^0.6.0",
+    "@hcengineering/attachment": "^0.6.1"
   }
 }
diff --git a/plugins/activity-resources/src/components/TxView.svelte b/plugins/activity-resources/src/components/TxView.svelte
index 839221d04b..e524060b34 100644
--- a/plugins/activity-resources/src/components/TxView.svelte
+++ b/plugins/activity-resources/src/components/TxView.svelte
@@ -16,7 +16,7 @@
 <script lang="ts">
   import type { TxViewlet } from '@hcengineering/activity'
   import contact, { Employee, EmployeeAccount, getName } from '@hcengineering/contact'
-  import core, { AnyAttribute, Doc, getCurrentAccount, Ref } from '@hcengineering/core'
+  import core, { AnyAttribute, Doc, getCurrentAccount, Ref, Class } from '@hcengineering/core'
   import { Asset } from '@hcengineering/platform'
   import { createQuery, getClient } from '@hcengineering/presentation'
   import {
@@ -31,6 +31,7 @@
     TimeSince
   } from '@hcengineering/ui'
   import type { AttributeModel } from '@hcengineering/view'
+  import attachment from '@hcengineering/attachment'
   import { Menu, ObjectPresenter } from '@hcengineering/view-resources'
   import { ActivityKey, DisplayTx } from '../activity'
   import activity from '../plugin'
@@ -130,6 +131,9 @@
   function isMessageType (attr?: AnyAttribute): boolean {
     return attr?.type._class === core.class.TypeMarkup
   }
+  function isAttachment (_class?: Ref<Class<Doc>>): boolean {
+    return _class === attachment.class.Attachment
+  }
 
   async function updateMessageType (model: AttributeModel[], tx: DisplayTx): Promise<boolean> {
     for (const m of model) {
@@ -148,14 +152,21 @@
     hasMessageType = res
   })
   $: isComment = viewlet && viewlet?.editable
+  $: isAttach = isAttachment(tx.tx.objectClass)
   $: isMention = viewlet?.display === 'emphasized' || isMessageType(model[0]?.attribute)
   $: isColumn = isComment || isMention || hasMessageType
 </script>
 
 {#if (viewlet !== undefined && !((viewlet?.hideOnRemove ?? false) && tx.removed)) || model.length > 0}
-  <div class="msgactivity-container" class:showIcon class:withAvatar={isComment} class:isNew class:isNextNew>
+  <div
+    class="msgactivity-container"
+    class:showIcon
+    class:withAvatar={isComment || isAttach}
+    class:isNew
+    class:isNextNew
+  >
     {#if showIcon}
-      {#if isComment}
+      {#if isComment || isAttach}
         <div class="msgactivity-avatar">
           <Component is={contact.component.Avatar} props={{ avatar: employee?.avatar, size: 'medium' }} />
         </div>
@@ -172,7 +183,7 @@
       {/if}
     {/if}
 
-    <div class="msgactivity-content" class:content={isColumn} class:comment={isComment}>
+    <div class="msgactivity-content" class:content={isColumn} class:comment={isComment || isAttach}>
       <div class="msgactivity-content__header">
         <div class="msgactivity-content__title labels-row">
           <span class="bold">
diff --git a/plugins/tags-resources/src/components/TagItem.svelte b/plugins/tags-resources/src/components/TagItem.svelte
index 7d4b1028fd..e0e4e6c3ea 100644
--- a/plugins/tags-resources/src/components/TagItem.svelte
+++ b/plugins/tags-resources/src/components/TagItem.svelte
@@ -110,7 +110,7 @@
       position: absolute;
       content: '';
       top: 50%;
-      left: 0;
+      left: 0.125rem;
       width: 0.25rem;
       height: 0.25rem;
       background-color: var(--tag-color);
diff --git a/plugins/view-resources/src/components/BooleanPresenter.svelte b/plugins/view-resources/src/components/BooleanPresenter.svelte
index 6041e34027..595fe65abd 100644
--- a/plugins/view-resources/src/components/BooleanPresenter.svelte
+++ b/plugins/view-resources/src/components/BooleanPresenter.svelte
@@ -18,10 +18,11 @@
   import { getBooleanLabel } from '../utils'
 
   export let value: any
+  export let inline: boolean = false
 </script>
 
-<div class="flex-row-center yesno-container">
-  <BooleanIcon {value} />
+<div class="{inline ? 'inline-presenter' : 'flex-presenter'} yesno-container">
+  <div class="icon small-gap"><BooleanIcon {value} /></div>
   <span><Label label={getBooleanLabel(value)} /></span>
 </div>
 
@@ -31,7 +32,6 @@
     user-select: none;
 
     span {
-      margin-left: 0.25rem;
       width: 1.6rem;
       white-space: nowrap;
       text-transform: capitalize;