Only allow actor flush by name for non-entity specific actors.

This commit is contained in:
DebaucheryLibrarian 2020-12-30 03:39:40 +01:00
parent 4fd262dc60
commit f0a90db912
1 changed files with 5 additions and 1 deletions

View File

@ -960,7 +960,11 @@ async function flushProfiles(actorIdsOrNames) {
async function flushActors(actorIdsOrNames) { async function flushActors(actorIdsOrNames) {
const actors = await knex('actors') const actors = await knex('actors')
.whereIn('id', actorIdsOrNames.filter(idOrName => typeof idOrName === 'number')) .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); const actorIds = actors.map(actor => actor.id);