mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 19:11:33 +03:00
Get rid of 'ne' in inbox queries (#6258)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
parent
c1508305bc
commit
32f0a7d9b2
@ -228,7 +228,7 @@ export class TInboxNotification extends TDoc implements InboxNotification {
|
||||
isViewed!: boolean
|
||||
|
||||
@Prop(TypeBoolean(), core.string.Boolean)
|
||||
archived?: boolean
|
||||
archived!: boolean
|
||||
|
||||
title?: IntlString
|
||||
body?: IntlString
|
||||
|
@ -25,7 +25,8 @@ import notification, {
|
||||
notificationId,
|
||||
NotificationStatus,
|
||||
type BrowserNotification,
|
||||
type DocNotifyContext
|
||||
type DocNotifyContext,
|
||||
type InboxNotification
|
||||
} from '@hcengineering/notification'
|
||||
import { DOMAIN_PREFERENCE } from '@hcengineering/preference'
|
||||
|
||||
@ -166,6 +167,26 @@ export const notificationOperation: MigrateOperation = {
|
||||
DOMAIN_USER_NOTIFY
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
state: 'fill-notification-archived-field-v1',
|
||||
func: async (client) => {
|
||||
await client.update<InboxNotification>(
|
||||
DOMAIN_NOTIFICATION,
|
||||
{ _class: notification.class.ActivityInboxNotification, archived: { $exists: false } },
|
||||
{ archived: false }
|
||||
)
|
||||
await client.update<InboxNotification>(
|
||||
DOMAIN_NOTIFICATION,
|
||||
{ _class: notification.class.CommonInboxNotification, archived: { $exists: false } },
|
||||
{ archived: false }
|
||||
)
|
||||
await client.update<InboxNotification>(
|
||||
DOMAIN_NOTIFICATION,
|
||||
{ _class: notification.class.MentionInboxNotification, archived: { $exists: false } },
|
||||
{ archived: false }
|
||||
)
|
||||
}
|
||||
}
|
||||
])
|
||||
await client.deleteMany<BrowserNotification>(DOMAIN_USER_NOTIFY, {
|
||||
|
@ -110,8 +110,8 @@
|
||||
)
|
||||
|
||||
archivedOtherNotificationsQuery.query(
|
||||
notification.class.InboxNotification,
|
||||
{ _class: { $ne: notification.class.ActivityInboxNotification }, archived: true, user: me._id },
|
||||
notification.class.CommonInboxNotification,
|
||||
{ archived: true, user: me._id },
|
||||
(res) => {
|
||||
archivedOtherNotifications = res
|
||||
},
|
||||
|
@ -34,6 +34,7 @@ import notification, {
|
||||
} from '@hcengineering/notification'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { derived, get, writable } from 'svelte/store'
|
||||
|
||||
import { isActivityNotification } from './utils'
|
||||
|
||||
/**
|
||||
@ -101,10 +102,9 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
||||
}
|
||||
)
|
||||
this.otherInboxNotificationsQuery.query(
|
||||
notification.class.InboxNotification,
|
||||
notification.class.CommonInboxNotification,
|
||||
{
|
||||
_class: { $ne: notification.class.ActivityInboxNotification },
|
||||
archived: { $ne: true },
|
||||
archived: false,
|
||||
user: getCurrentAccount()._id
|
||||
},
|
||||
(result: InboxNotification[]) => {
|
||||
@ -120,7 +120,7 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
||||
this.activityInboxNotificationsQuery.query(
|
||||
notification.class.ActivityInboxNotification,
|
||||
{
|
||||
archived: { $ne: true },
|
||||
archived: false,
|
||||
user: getCurrentAccount()._id
|
||||
},
|
||||
(result: ActivityInboxNotification[]) => {
|
||||
@ -242,7 +242,7 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
||||
notification.class.InboxNotification,
|
||||
{
|
||||
user: getCurrentAccount()._id,
|
||||
archived: { $ne: true }
|
||||
archived: false
|
||||
},
|
||||
{ projection: { _id: 1, _class: 1, space: 1 } }
|
||||
)
|
||||
@ -267,8 +267,8 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
||||
notification.class.InboxNotification,
|
||||
{
|
||||
user: getCurrentAccount()._id,
|
||||
isViewed: { $ne: true },
|
||||
archived: { $ne: true }
|
||||
isViewed: false,
|
||||
archived: false
|
||||
},
|
||||
{ projection: { _id: 1, _class: 1, space: 1 } }
|
||||
)
|
||||
@ -293,7 +293,7 @@ export class InboxNotificationsClientImpl implements InboxNotificationsClient {
|
||||
{
|
||||
user: getCurrentAccount()._id,
|
||||
isViewed: true,
|
||||
archived: { $ne: true }
|
||||
archived: false
|
||||
},
|
||||
{
|
||||
projection: { _id: 1, _class: 1, space: 1, docNotifyContext: 1 },
|
||||
|
@ -186,7 +186,7 @@ export async function archiveContextNotifications (doc?: DocNotifyContext): Prom
|
||||
try {
|
||||
const notifications = await ops.findAll(
|
||||
notification.class.InboxNotification,
|
||||
{ docNotifyContext: doc._id, archived: { $ne: true } },
|
||||
{ docNotifyContext: doc._id, archived: false },
|
||||
{ projection: { _id: 1, _class: 1, space: 1 } }
|
||||
)
|
||||
|
||||
|
@ -234,7 +234,7 @@ export interface InboxNotification extends Doc {
|
||||
body?: IntlString
|
||||
intlParams?: Record<string, string | number>
|
||||
intlParamsNotLocalized?: Record<string, IntlString>
|
||||
archived?: boolean
|
||||
archived: boolean
|
||||
}
|
||||
|
||||
export interface ActivityInboxNotification extends InboxNotification {
|
||||
|
@ -157,7 +157,8 @@ export async function getPersonNotificationTxes (
|
||||
mentionedIn: reference.attachedDocId ?? reference.srcDocId,
|
||||
mentionedInClass: reference.attachedDocClass ?? reference.srcDocClass,
|
||||
user: receiver._id,
|
||||
isViewed: false
|
||||
isViewed: false,
|
||||
archived: false
|
||||
}
|
||||
|
||||
const sender = (
|
||||
|
@ -381,6 +381,7 @@ export async function pushInboxNotifications (
|
||||
user: account._id,
|
||||
isViewed: false,
|
||||
docNotifyContext: docNotifyContextId,
|
||||
archived: false,
|
||||
...data
|
||||
}
|
||||
const notificationTx = control.txFactory.createTxCreateDoc(_class, space, notificationData)
|
||||
|
@ -38,6 +38,7 @@ export async function createNotification (
|
||||
message: data.message,
|
||||
props: data.props,
|
||||
isViewed: false,
|
||||
archived: false,
|
||||
docNotifyContext: docNotifyContext?._id as Ref<DocNotifyContext>
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user