Fix wrong spaces (#6296)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-08-09 08:46:48 +04:00 committed by GitHub
parent 5975a4a135
commit 6dfa55964f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,6 +30,7 @@ import notification, {
} from '@hcengineering/notification'
import { DOMAIN_PREFERENCE } from '@hcengineering/preference'
import contact, { type PersonSpace } from '@hcengineering/contact'
import chunter from '@hcengineering/chunter'
import { DOMAIN_DOC_NOTIFY, DOMAIN_NOTIFICATION, DOMAIN_USER_NOTIFY } from './index'
import { DOMAIN_SPACE } from '@hcengineering/model-core'
@ -322,6 +323,26 @@ export const notificationOperation: MigrateOperation = {
{ objectSpace: contact.space.Contacts }
)
}
},
{
state: 'migrate-wrong-spaces-v1',
func: async () => {
await client.update<DocNotifyContext>(
DOMAIN_DOC_NOTIFY,
{ _class: notification.class.DocNotifyContext, objectClass: chunter.class.DirectMessage },
{ objectSpace: core.space.Space }
)
await client.update<DocNotifyContext>(
DOMAIN_DOC_NOTIFY,
{ _class: notification.class.DocNotifyContext, objectClass: chunter.class.Channel },
{ objectSpace: core.space.Space }
)
await client.update<DocNotifyContext>(
DOMAIN_DOC_NOTIFY,
{ _class: notification.class.DocNotifyContext, objectClass: 'recruit:class:Vacancy' as any },
{ objectSpace: core.space.Space }
)
}
}
])