Ignoring actor merge avatar conflicts, put actor merge source IDs in post body.
This commit is contained in:
@@ -148,6 +148,10 @@ async function addActor() {
|
|||||||
gap: 1.25rem;
|
gap: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.load-container {
|
.load-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ function getActorNames() {
|
|||||||
async function merge() {
|
async function merge() {
|
||||||
submitted.value = true;
|
submitted.value = true;
|
||||||
|
|
||||||
await post(`/actors/${targetActor.value.id}/merge/${props.actors.map((actor) => actor.id).join(',')}`, {
|
await post(`/actors/${targetActor.value.id}/merge`, {
|
||||||
|
actorIds: props.actors.map((actor) => actor.id),
|
||||||
comment: comment.value || null,
|
comment: comment.value || null,
|
||||||
}, {
|
}, {
|
||||||
successFeedback: `Merged ${getActorNames()} into ${targetActor.value.name}`,
|
successFeedback: `Merged ${getActorNames()} into ${targetActor.value.name}`,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ const mockUser = {
|
|||||||
style="margin-top: 30px;"
|
style="margin-top: 30px;"
|
||||||
>Someone tried to assign this e-mail address to a traxxx account.</Heading>
|
>Someone tried to assign this e-mail address to a traxxx account.</Heading>
|
||||||
|
|
||||||
<Text style="font-size: 16px; margin: 20px 0;">If this was you with this account, your e-mail address is already set correctly. If this was you with another account, you will need to use another e-mail address. If this was not you, you can safely ignore this e-mail.</Text>
|
<Text style="font-size: 16px; margin: 20px 0;">If this was you with this account ({{ user.username }}), your e-mail address is already set correctly. If this was you with another account, you will need to use another e-mail address. If this was not you, you can safely ignore this e-mail.</Text>
|
||||||
</Container>
|
</Container>
|
||||||
</Body>
|
</Body>
|
||||||
</Html>
|
</Html>
|
||||||
|
|||||||
@@ -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
|
// 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')
|
trx('actors_avatars')
|
||||||
.update('actor_id', targetActorId)
|
.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
|
// multiple source actors may provide profiles for the same entity, but we can only assign one to the target actor; prefer the newest
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ export async function createActorApi(req, res) {
|
|||||||
export async function mergeActorsApi(req, res) {
|
export async function mergeActorsApi(req, res) {
|
||||||
const result = await mergeActors(
|
const result = await mergeActors(
|
||||||
Number(req.params.targetActorId),
|
Number(req.params.targetActorId),
|
||||||
req.params.sourceActorIds.split(',').map((actorId) => Number(actorId)),
|
req.body.actorIds,
|
||||||
req.body.comment,
|
req.body.comment,
|
||||||
req.user,
|
req.user,
|
||||||
);
|
);
|
||||||
@@ -225,7 +225,7 @@ export const actorsRouter = Router();
|
|||||||
actorsRouter.get('/api/actors', fetchActorsApi);
|
actorsRouter.get('/api/actors', fetchActorsApi);
|
||||||
actorsRouter.post('/api/actors', createActorApi);
|
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', fetchActorRevisionsApi);
|
||||||
actorsRouter.get('/api/revisions/actors/:revisionId', fetchActorRevisionsApi);
|
actorsRouter.get('/api/revisions/actors/:revisionId', fetchActorRevisionsApi);
|
||||||
|
|||||||
Reference in New Issue
Block a user