Ignoring actor merge avatar conflicts, put actor merge source IDs in post body.

This commit is contained in:
2026-07-23 22:54:35 +02:00
parent 62d19d1a04
commit b54174eb5e
5 changed files with 12 additions and 5 deletions

View File

@@ -870,7 +870,9 @@ export async function mergeActors(targetActorId, sourceActorIds, comment, reqUse
// some avatars are not matched to a profile, need to investigate why this happens and the avatar table needs a dedicated actor field
trx('actors_avatars')
.update('actor_id', targetActorId)
.whereIn('actor_id', sourceActorIds),
.whereIn('actor_id', sourceActorIds)
.onConflict(['profile_id', 'media_id'])
.ignore(),
]);
// multiple source actors may provide profiles for the same entity, but we can only assign one to the target actor; prefer the newest

View File

@@ -194,7 +194,7 @@ export async function createActorApi(req, res) {
export async function mergeActorsApi(req, res) {
const result = await mergeActors(
Number(req.params.targetActorId),
req.params.sourceActorIds.split(',').map((actorId) => Number(actorId)),
req.body.actorIds,
req.body.comment,
req.user,
);
@@ -225,7 +225,7 @@ export const actorsRouter = Router();
actorsRouter.get('/api/actors', fetchActorsApi);
actorsRouter.post('/api/actors', createActorApi);
actorsRouter.post('/api/actors/:targetActorId/merge/:sourceActorIds', mergeActorsApi);
actorsRouter.post('/api/actors/:targetActorId/merge', mergeActorsApi);
actorsRouter.get('/api/revisions/actors', fetchActorRevisionsApi);
actorsRouter.get('/api/revisions/actors/:revisionId', fetchActorRevisionsApi);