Added actor merge comment.
This commit is contained in:
@@ -17,6 +17,7 @@ const emit = defineEmits(['close', 'merged']);
|
|||||||
|
|
||||||
const targetActor = ref(null);
|
const targetActor = ref(null);
|
||||||
const actorInput = ref(null);
|
const actorInput = ref(null);
|
||||||
|
const comment = ref(null);
|
||||||
const actorQuery = ref('');
|
const actorQuery = ref('');
|
||||||
const actorResults = ref([]);
|
const actorResults = ref([]);
|
||||||
const submitted = ref(false);
|
const submitted = ref(false);
|
||||||
@@ -51,7 +52,9 @@ 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(',')}`, null, {
|
await post(`/actors/${targetActor.value.id}/merge/${props.actors.map((actor) => actor.id).join(',')}`, {
|
||||||
|
comment: comment.value || null,
|
||||||
|
}, {
|
||||||
successFeedback: `Merged ${getActorNames()} into ${targetActor.value.name}`,
|
successFeedback: `Merged ${getActorNames()} into ${targetActor.value.name}`,
|
||||||
errorFeedback: `Failed to merge ${getActorNames()} into ${targetActor.value.name}`,
|
errorFeedback: `Failed to merge ${getActorNames()} into ${targetActor.value.name}`,
|
||||||
appendErrorMessage: true,
|
appendErrorMessage: true,
|
||||||
@@ -173,6 +176,13 @@ onMounted(() => {
|
|||||||
</VDropdown>
|
</VDropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<textarea
|
||||||
|
v-model="comment"
|
||||||
|
placeholder="Optional comment"
|
||||||
|
rows="2"
|
||||||
|
class="input comment"
|
||||||
|
/>
|
||||||
|
|
||||||
<div class="dialog-actions">
|
<div class="dialog-actions">
|
||||||
<Ellipsis v-if="submitted" />
|
<Ellipsis v-if="submitted" />
|
||||||
|
|
||||||
@@ -216,6 +226,10 @@ onMounted(() => {
|
|||||||
|
|
||||||
.input {
|
.input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
&.comment {
|
||||||
|
flex-basis: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.path {
|
.path {
|
||||||
|
|||||||
@@ -809,7 +809,7 @@ export async function createActor(newActor, context, reqUser) {
|
|||||||
return curateActor(actorEntry);
|
return curateActor(actorEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function mergeActors(targetActorId, sourceActorIds, reqUser) {
|
export async function mergeActors(targetActorId, sourceActorIds, comment, reqUser) {
|
||||||
if (!verifyAbility(reqUser, 'actor', 'merge')) {
|
if (!verifyAbility(reqUser, 'actor', 'merge')) {
|
||||||
throw new HttpError('You are not permitted to merge actors', 403);
|
throw new HttpError('You are not permitted to merge actors', 403);
|
||||||
}
|
}
|
||||||
@@ -981,6 +981,7 @@ export async function mergeActors(targetActorId, sourceActorIds, reqUser) {
|
|||||||
base: baseTargetActor,
|
base: baseTargetActor,
|
||||||
deltas: targetDeltas,
|
deltas: targetDeltas,
|
||||||
}),
|
}),
|
||||||
|
comment,
|
||||||
reviewed_by: reqUser.id,
|
reviewed_by: reqUser.id,
|
||||||
reviewed_at: knex.fn.now(),
|
reviewed_at: knex.fn.now(),
|
||||||
applied_at: knex.fn.now(),
|
applied_at: knex.fn.now(),
|
||||||
@@ -1009,6 +1010,7 @@ export async function mergeActors(targetActorId, sourceActorIds, reqUser) {
|
|||||||
base: baseSourceActor,
|
base: baseSourceActor,
|
||||||
deltas: targetDeltas,
|
deltas: targetDeltas,
|
||||||
}),
|
}),
|
||||||
|
comment,
|
||||||
reviewed_by: reqUser.id,
|
reviewed_by: reqUser.id,
|
||||||
reviewed_at: knex.fn.now(),
|
reviewed_at: knex.fn.now(),
|
||||||
applied_at: knex.fn.now(),
|
applied_at: knex.fn.now(),
|
||||||
|
|||||||
@@ -192,7 +192,12 @@ export async function createActorApi(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function mergeActorsApi(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.user);
|
const result = await mergeActors(
|
||||||
|
Number(req.params.targetActorId),
|
||||||
|
req.params.sourceActorIds.split(',').map((actorId) => Number(actorId)),
|
||||||
|
req.body.comment,
|
||||||
|
req.user,
|
||||||
|
);
|
||||||
|
|
||||||
res.send(result);
|
res.send(result);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user