Filter old email activity (#2983)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-04-14 11:43:36 +06:00 committed by GitHub
parent 99b6634cdd
commit 7c1a31c095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 23 deletions

View File

@ -14,10 +14,10 @@
-->
<script lang="ts">
import { DisplayTx } from '@hcengineering/activity'
import core, { AttachedDoc, Doc, TxCUD, TxCollectionCUD, TxProcessor } from '@hcengineering/core'
import core, { AttachedDoc, Doc, TxCUD, TxCollectionCUD, TxCreateDoc, TxProcessor } from '@hcengineering/core'
import { createQuery, getClient } from '@hcengineering/presentation'
import contact from '../../plugin'
import { Channel, Contact } from '@hcengineering/contact'
import { Channel, ChannelItem, Contact } from '@hcengineering/contact'
import { newDisplayTx } from '@hcengineering/activity-resources'
import { createEventDispatcher } from 'svelte'
@ -46,7 +46,7 @@
let newTxes: DisplayTx[] = []
const txQuery = createQuery()
$: txQuery.query(
$: txQuery.query<TxCollectionCUD<Channel, ChannelItem>>(
core.class.TxCollectionCUD,
{
objectId: { $in: channels.map((p) => p._id) },
@ -54,7 +54,8 @@
'tx.attributes.incoming': false
},
(res) => {
newTxes = createDisplayTxes(res)
const filtered = res.filter((p) => (p.tx as TxCreateDoc<ChannelItem>).attributes.sendOn >= object.createOn)
newTxes = createDisplayTxes(filtered)
}
)

View File

@ -58,6 +58,17 @@ export interface Channel extends AttachedDoc {
lastMessage?: Timestamp
}
/**
* @public
*/
export interface ChannelItem extends AttachedDoc {
attachedTo: Ref<Channel>
attachedToClass: Ref<Class<Channel>>
incoming: boolean
sendOn: Timestamp
attachments?: number
}
/**
* @public
*/

View File

@ -13,7 +13,7 @@
// limitations under the License.
//
import { Channel } from '@hcengineering/contact'
import { ChannelItem } from '@hcengineering/contact'
import type { Account, AttachedDoc, Class, Doc, Ref, Space, Timestamp } from '@hcengineering/core'
import type { Plugin } from '@hcengineering/platform'
import { Metadata, plugin } from '@hcengineering/platform'
@ -23,14 +23,10 @@ import type { AnyComponent } from '@hcengineering/ui'
/**
* @public
*/
export interface Message extends BaseMessage, AttachedDoc {
attachedTo: Ref<Channel>
attachedToClass: Ref<Class<Channel>>
export interface Message extends BaseMessage, ChannelItem {
messageId: string
from: string
textContent: string
incoming: boolean
sendOn: Timestamp
}
/**

View File

@ -13,13 +13,13 @@
// limitations under the License.
//
import { Metadata, plugin } from '@hcengineering/platform'
import { ChannelItem } from '@hcengineering/contact'
import type { AttachedDoc, Class, Doc, Ref, Space, Timestamp } from '@hcengineering/core'
import type { Plugin } from '@hcengineering/platform'
import type { Doc, Ref, Class, Space, AttachedDoc, Timestamp } from '@hcengineering/core'
import type { AnyComponent } from '@hcengineering/ui'
import type { IntegrationType, Handler } from '@hcengineering/setting'
import { Channel } from '@hcengineering/contact'
import { Metadata, plugin } from '@hcengineering/platform'
import type { Handler, IntegrationType } from '@hcengineering/setting'
import { TemplateField } from '@hcengineering/templates'
import type { AnyComponent } from '@hcengineering/ui'
/**
* @public
@ -32,14 +32,7 @@ export interface BaseTelegramMessage extends Doc {
/**
* @public
*/
export interface TelegramMessage extends BaseTelegramMessage, AttachedDoc {
attachedTo: Ref<Channel>
attachedToClass: Ref<Class<Channel>>
incoming: boolean
sendOn: Timestamp
}
export interface TelegramMessage extends BaseTelegramMessage, ChannelItem {}
/**
* @public