Add some chat/activity fixes (#5387)

This commit is contained in:
Kristina 2024-04-17 17:14:47 +04:00 committed by GitHub
parent 7405b01d04
commit 128329804b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 46 additions and 15 deletions

View File

@ -394,6 +394,11 @@ function defineDocument (builder: Builder): void {
titleProvider: document.function.DocumentTitleProvider
})
builder.createDoc(activity.class.ActivityExtension, core.space.Model, {
ofClass: document.class.Document,
components: { input: chunter.component.ChatMessageInput }
})
// Search
builder.createDoc(

View File

@ -35,6 +35,12 @@
getDmPersons(client, value).then((res) => {
persons = res
})
let avatarSize = size
$: if (size === 'small') {
avatarSize = 'tiny'
}
</script>
{#if persons.length === 0 && value}
@ -42,7 +48,7 @@
{/if}
{#if persons.length === 1}
<Avatar avatar={persons[0].avatar} {size} name={persons[0].name} />
<Avatar avatar={persons[0].avatar} size={avatarSize} name={persons[0].name} />
{/if}
{#if persons.length > 1 && size === 'medium'}
@ -64,7 +70,12 @@
{/if}
{#if persons.length > 1 && size !== 'medium'}
<CombineAvatars _class={contact.class.Person} items={persons.map(({ _id }) => _id)} {size} limit={visiblePersons} />
<CombineAvatars
_class={contact.class.Person}
items={persons.map(({ _id }) => _id)}
size={avatarSize}
limit={visiblePersons}
/>
{/if}
<style lang="scss">

View File

@ -16,6 +16,9 @@
import { chunterId, DirectMessage } from '@hcengineering/chunter'
import { getClient } from '@hcengineering/presentation'
import { NavLink } from '@hcengineering/view-resources'
import { ObjectPresenterType } from '@hcengineering/view'
import { tooltip } from '@hcengineering/ui'
import { getEmbeddedLabel } from '@hcengineering/platform'
import { getDmName } from '../utils'
import DirectIcon from './DirectIcon.svelte'
@ -23,19 +26,24 @@
export let value: DirectMessage
export let disabled = false
export let shouldShowAvatar = true
export let type: ObjectPresenterType = 'link'
const client = getClient()
</script>
{#if value}
{#await getDmName(client, value) then name}
<NavLink app={chunterId} space={value._id} {disabled}>
<div class="flex-presenter">
{#if shouldShowAvatar}
<DirectIcon {value} />
{/if}
<span class="label">{name}</span>
</div>
</NavLink>
{#if type === 'link'}
<NavLink app={chunterId} space={value._id} {disabled}>
<div class="flex-presenter">
{#if shouldShowAvatar}
<DirectIcon {value} />
{/if}
<span class="label">{name}</span>
</div>
</NavLink>
{:else if type === 'text'}
<span class="overflow-label" use:tooltip={{ label: getEmbeddedLabel(name) }}>{name}</span>
{/if}
{/await}
{/if}

View File

@ -19,6 +19,7 @@
import activity from '@hcengineering/activity'
import { translate } from '@hcengineering/platform'
import { Action } from '@hcengineering/ui'
import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources'
import { ChatGroup, ChatNavGroupModel } from '../types'
import ChatNavSection from './ChatNavSection.svelte'
@ -37,6 +38,8 @@
const client = getClient()
const hierarchy = client.getHierarchy()
const inboxClient = InboxNotificationsClientImpl.getClient()
const contextByDocStore = inboxClient.contextByDoc
const contextsQuery = createQuery()
const objectsQueryByClass = new Map<Ref<Class<Doc>>, LiveQuery>()
@ -71,9 +74,7 @@
})
$: shouldPushObject =
object !== undefined &&
getObjectGroup(object) === model.id &&
!contexts.some(({ attachedTo }) => attachedTo === object?._id)
object !== undefined && getObjectGroup(object) === model.id && !$contextByDocStore.has(object._id)
function loadObjects (contexts: DocNotifyContext[]): void {
const contextsByClass = groupByArray(contexts, ({ attachedToClass }) => attachedToClass)

View File

@ -31,12 +31,14 @@
import NavItem from './NavItem.svelte'
import { ChatNavItemModel } from '../types'
import { openChannel } from '../../../navigation'
import chunter from '../../../plugin'
export let context: DocNotifyContext | undefined
export let item: ChatNavItemModel
export let isSelected = false
const client = getClient()
const hierarchy = client.getHierarchy()
const dispatch = createEventDispatcher()
const notificationClient = InboxNotificationsClientImpl.getClient()
@ -49,7 +51,12 @@
if (context === undefined) {
return
}
notifications = (res.get(context._id) ?? []).filter((n) => isMentionNotification(n) || isActivityNotification(n))
notifications = (res.get(context._id) ?? []).filter((n) => {
if (isActivityNotification(n)) return true
return isMentionNotification(n) && hierarchy.isDerived(n.mentionedInClass, chunter.class.ChatMessage)
})
})
$: void getNotificationsCount(context, notifications).then((res) => {

View File

@ -94,7 +94,6 @@
justify-content: center;
align-items: center;
flex-shrink: 0;
width: var(--global-min-Size);
height: var(--global-extra-small-Size);
}