Make sure "Block" object only stores strings (not array) in "actor|object"

* This is done so we can faster search for blocks without using $elemMatch on mongodb
This commit is contained in:
Niko 2022-02-16 14:30:22 +01:00
parent c7d8a075b9
commit 629de2d8b7
1 changed files with 8 additions and 1 deletions

View File

@ -46,8 +46,15 @@ module.exports = {
}
if (msg.activity.type === 'Block')
{
if (areActorsValid(msg.activity.object, true))
if (areActorsValid(msg.activity.object, true)) {
if (msg.activity.actor instanceof Array &&
msg.activity.actor.length > 0)
msg.activity.actor = msg.activity.actor[0]
if (msg.activity.object instanceof Array &&
msg.activity.object.length > 0)
msg.activity.object = msg.activity.object[0]
await apex.store.saveObject(msg.activity)
}
return true
}
if (msg.activity.type === 'Undo')