Fix directs activity (#7991)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2025-02-12 17:23:14 +07:00
committed by GitHub
parent 69dbd06863
commit f904f263ab
3 changed files with 14 additions and 5 deletions
+2 -4
View File
@@ -298,13 +298,11 @@ export const chunterOperation: MigrateOperation = {
}
},
{
state: 'remove-direct-members-messages',
state: 'remove-direct-doc-update-messages',
func: async (client) => {
await client.deleteMany<DocUpdateMessage>(DOMAIN_ACTIVITY, {
_class: activity.class.DocUpdateMessage,
attachedToClass: chunter.class.DirectMessage,
action: 'update',
'attributeUpdates.attrKey': 'members'
attachedToClass: chunter.class.DirectMessage
})
}
}
+11
View File
@@ -614,6 +614,17 @@ export async function createDirect (employeeIds: Array<Ref<Person>>): Promise<Re
if (context.hidden) {
await client.updateDoc(context._class, context.space, context._id, { hidden: false })
}
} else {
const space = await client.findOne(contact.class.PersonSpace, { person: me }, { projection: { _id: 1 } })
if (space == null) return dmId
await client.createDoc(notification.class.DocNotifyContext, space._id, {
user: myAcc.primarySocialId,
objectId: dmId,
objectClass: chunter.class.DirectMessage,
objectSpace: core.space.Space,
hidden: false,
isPinned: false
})
}
return dmId
@@ -275,7 +275,7 @@ export async function generateDocUpdateMessages (
if (controlRules.length > 0) {
for (const r of controlRules) {
for (const s of r.skip) {
if (matchQuery([tx], s, r.objectClass, hierarchy).length > 0) {
if (matchQuery([tx], s, core.class.TxCUD, hierarchy).length > 0) {
// Match found, we need to skip
return res
}