From f0a90db912939651c1e6146e022ba445a229eeeb Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Wed, 30 Dec 2020 03:39:40 +0100 Subject: [PATCH] Only allow actor flush by name for non-entity specific actors. --- src/actors.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/actors.js b/src/actors.js index 2d1f47ae..802b0065 100644 --- a/src/actors.js +++ b/src/actors.js @@ -960,7 +960,11 @@ async function flushProfiles(actorIdsOrNames) { async function flushActors(actorIdsOrNames) { const actors = await knex('actors') .whereIn('id', actorIdsOrNames.filter(idOrName => typeof idOrName === 'number')) - .orWhereIn('name', actorIdsOrNames.filter(idOrName => typeof idOrName === 'string')); + .orWhere((builder) => { + builder + .whereIn('name', actorIdsOrNames.filter(idOrName => typeof idOrName === 'string')) + .whereNull('entity_id'); + }); const actorIds = actors.map(actor => actor.id);