async function processDeleteActivity (activity: ActivityDelete) {
const actor = await getOrCreateActorAndServerAndModel(activity.actor)
+ const objectUrl = typeof activity.object === 'string' ? activity.object : activity.object.id
- if (actor.url === activity.id) {
+ if (actor.url === objectUrl) {
if (actor.type === 'Person') {
if (!actor.Account) throw new Error('Actor ' + actor.url + ' is a person but we cannot find it in database.')
}
{
- const videoCommentInstance = await VideoCommentModel.loadByUrlAndPopulateAccount(activity.id)
+ const videoCommentInstance = await VideoCommentModel.loadByUrlAndPopulateAccount(objectUrl)
if (videoCommentInstance) {
return processDeleteVideoComment(actor, videoCommentInstance)
}
}
{
- const videoInstance = await VideoModel.loadByUrlAndPopulateAccount(activity.id)
+ const videoInstance = await VideoModel.loadByUrlAndPopulateAccount(objectUrl)
if (videoInstance) {
return processDeleteVideo(actor, videoInstance)
}