Merging actor avatars. Fixed faulty actor ID search in merge dialog.
This commit is contained in:
@@ -97,7 +97,7 @@ const submitted = ref(false);
|
||||
|
||||
async function searchActors() {
|
||||
const res = await get('/actors', {
|
||||
q: `${actorQuery.value}*`, // return partial matches
|
||||
q: actorQuery.value.charAt(0) === '#' ? actorQuery.value : `${actorQuery.value}*`, // return partial matches
|
||||
limit: 10,
|
||||
global: true,
|
||||
});
|
||||
|
||||
@@ -260,14 +260,17 @@ export async function fetchActorsById(actorIds, options = {}, reqUser) {
|
||||
knex('actors_avatars')
|
||||
.select(
|
||||
'media.*',
|
||||
'actors_avatars.actor_id',
|
||||
// 'actors_avatars.actor_id',
|
||||
'actors_profiles.actor_id',
|
||||
knex.raw('json_agg(actors_avatars.profile_id) as profile_ids'),
|
||||
knex.raw('row_to_json(sfw_media) as sfw_media'),
|
||||
)
|
||||
.whereIn('actor_id', actorIds)
|
||||
.whereIn('actors_profiles.actor_id', actorIds)
|
||||
.leftJoin('media', 'media.id', 'actors_avatars.media_id')
|
||||
.leftJoin('media as sfw_media', 'sfw_media.id', 'media.sfw_media_id')
|
||||
.groupBy('media.id', 'sfw_media.id', 'actors_avatars.actor_id')
|
||||
.leftJoin('actors_profiles', 'actors_profiles.id', 'actors_avatars.profile_id')
|
||||
// .groupBy('media.id', 'sfw_media.id', 'actors_avatars.actor_id')
|
||||
.groupBy('media.id', 'sfw_media.id', 'actors_profiles.actor_id')
|
||||
.orderBy(knex.raw('max(actors_avatars.created_at)'), 'desc'),
|
||||
knex('actors_socials')
|
||||
.whereIn('actor_id', actorIds),
|
||||
@@ -603,6 +606,11 @@ export async function mergeActors(targetActorId, sourceActorId, reqUser) {
|
||||
.where('actor_id', sourceActorId)
|
||||
.returning('id');
|
||||
|
||||
// some avatars are not matched to a profile, need to investigate why this happens and the avatar table needs a dedicated actor field
|
||||
await trx('actors_avatars')
|
||||
.update('actor_id', targetActorId)
|
||||
.where('actor_id', sourceActorId);
|
||||
|
||||
mergedScenes = await trx('releases_actors')
|
||||
.update({
|
||||
actor_id: targetActorId,
|
||||
|
||||
Reference in New Issue
Block a user