UBERF-5323: fix new messages marker (#4614)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-02-13 19:12:45 +04:00 committed by GitHub
parent 2265d6f8d0
commit 71ae492316
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 15 deletions

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
--> -->
<script lang="ts"> <script lang="ts">
import { Class, Doc, Ref, isOtherDay, Timestamp, getCurrentAccount } from '@hcengineering/core' import { Class, Doc, getCurrentAccount, isOtherDay, Ref, Timestamp } from '@hcengineering/core'
import { getClient } from '@hcengineering/presentation' import { getClient } from '@hcengineering/presentation'
import activity, { import activity, {
ActivityExtension, ActivityExtension,
@ -27,8 +27,8 @@
import { get } from 'svelte/store' import { get } from 'svelte/store'
import { Scroller, ScrollParams } from '@hcengineering/ui' import { Scroller, ScrollParams } from '@hcengineering/ui'
import { import {
ActivityMessagePresenter, ActivityExtension as ActivityExtensionComponent,
ActivityExtension as ActivityExtensionComponent ActivityMessagePresenter
} from '@hcengineering/activity-resources' } from '@hcengineering/activity-resources'
import ActivityMessagesSeparator from './ChannelMessagesSeparator.svelte' import ActivityMessagesSeparator from './ChannelMessagesSeparator.svelte'
@ -293,20 +293,17 @@
return 0 return 0
} }
const lastViewedMessageIdx = displayMessages.findIndex((message, index) => { const me = getCurrentAccount()._id
const nextMessage = displayMessages[index + 1]
if (message.createdBy === getCurrentAccount()._id) { return displayMessages.findIndex((message) => {
if (message.createdBy === me) {
return false return false
} }
const createdOn = message.createdOn ?? 0 const createdOn = message.createdOn ?? 0
const nextCreatedOn = nextMessage?.createdOn ?? 0
return lastViewedTimestamp >= createdOn && lastViewedTimestamp < nextCreatedOn return lastViewedTimestamp < createdOn
}) })
return lastViewedMessageIdx !== -1 ? lastViewedMessageIdx + 1 : -1
} }
$: separatorPosition = getNewPosition(displayMessages, lastViewedTimestamp) $: separatorPosition = getNewPosition(displayMessages, lastViewedTimestamp)

View File

@ -13,11 +13,10 @@
// limitations under the License. // limitations under the License.
--> -->
<script lang="ts"> <script lang="ts">
import { createEventDispatcher } from 'svelte' import { getCurrentAccount, Ref } from '@hcengineering/core'
import { Doc, getCurrentAccount, Ref } from '@hcengineering/core'
import notification, { DocNotifyContext } from '@hcengineering/notification' import notification, { DocNotifyContext } from '@hcengineering/notification'
import { createQuery, getClient } from '@hcengineering/presentation' import { createQuery, getClient } from '@hcengineering/presentation'
import { Action, IconAdd, Scroller, showPopup } from '@hcengineering/ui' import { Action, Scroller } from '@hcengineering/ui'
import activity from '@hcengineering/activity' import activity from '@hcengineering/activity'
import view from '@hcengineering/view' import view from '@hcengineering/view'
import { getResource } from '@hcengineering/platform' import { getResource } from '@hcengineering/platform'
@ -30,8 +29,6 @@
export let selectedContextId: Ref<DocNotifyContext> | undefined = undefined export let selectedContextId: Ref<DocNotifyContext> | undefined = undefined
export let model: ChatNavGroupModel export let model: ChatNavGroupModel
const dispatch = createEventDispatcher()
const client = getClient() const client = getClient()
const hierarchy = client.getHierarchy() const hierarchy = client.getHierarchy()