Unlinked relation and copy revisions.
This commit is contained in:
@@ -254,16 +254,7 @@ async function reviewRevision(revision, isApproved) {
|
||||
revisionId: revision.id,
|
||||
});
|
||||
|
||||
// revisions generated by sharing a relation were reviewed along with this one
|
||||
const childIds = new Set(updatedRevision.revision.childRevisions?.map((child) => child.id) || []);
|
||||
const updatedChildren = await Promise.all(revisions.value
|
||||
.filter((rev) => childIds.has(rev.id))
|
||||
.map(async (rev) => (await get(`/revisions/${domain}/${rev.id}`, { revisionId: rev.id })).revision));
|
||||
|
||||
const updatedById = Object.fromEntries([updatedRevision.revision, ...updatedChildren].map((rev) => [rev.id, rev]));
|
||||
|
||||
childIds.forEach((childId) => reviewedRevisions.value.add(childId));
|
||||
revisions.value = revisions.value.map((rev) => updatedById[rev.id] || rev);
|
||||
revisions.value = revisions.value.map((rev) => (rev.id === updatedRevision.revision.id ? updatedRevision.revision : rev));
|
||||
}
|
||||
catch (error) {
|
||||
reviewedRevisions.value.delete(revision.id);
|
||||
@@ -360,11 +351,6 @@ async function banEditor(revision) {
|
||||
class="nolink"
|
||||
>{{ rev.review.username }}</a> {{ format(rev.review.reviewedAt, 'yyyy-MM-dd hh:mm') }}</span>
|
||||
|
||||
<span
|
||||
v-else-if="rev.parentRevisionId && context === 'admin'"
|
||||
class="rev-parent"
|
||||
>Reviewed with #{{ rev.parentRevisionId }}</span>
|
||||
|
||||
<template v-else-if="context === 'admin'">
|
||||
<Icon
|
||||
v-tooltip="{ content: 'Ban user from submitting revisions', ariaId: `rev-ban-${rev.id}` }"
|
||||
@@ -476,26 +462,6 @@ async function banEditor(revision) {
|
||||
>
|
||||
{{ rev.comment }}
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="rev.parentRevisionId || rev.childRevisions?.length > 0"
|
||||
class="rev-shared"
|
||||
>
|
||||
<template v-if="rev.parentRevisionId">Generated by sharing a relation in revision #{{ rev.parentRevisionId }}, reviewed and applied with it.</template>
|
||||
|
||||
<template v-else>
|
||||
Also applies
|
||||
<template
|
||||
v-for="(child, index) in rev.childRevisions"
|
||||
:key="`rev-${rev.id}-child-${child.id}`"
|
||||
>{{ index > 0 ? ', ' : '' }}<a
|
||||
:href="`/${domain.slice(0, -1)}/${child.sceneId}`"
|
||||
target="_blank"
|
||||
class="link"
|
||||
>#{{ child.id }} to scene {{ child.sceneId }}</a></template>
|
||||
for sharing a relation.
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div
|
||||
@@ -785,18 +751,6 @@ async function banEditor(revision) {
|
||||
border-top: solid 1px var(--glass-weak-30);
|
||||
}
|
||||
|
||||
.rev-shared {
|
||||
padding: .5rem;
|
||||
border-top: solid 1px var(--glass-weak-30);
|
||||
color: var(--glass-strong-10);
|
||||
font-size: .9rem;
|
||||
}
|
||||
|
||||
.rev-parent {
|
||||
color: var(--glass-strong-10);
|
||||
font-size: .9rem;
|
||||
}
|
||||
|
||||
.rev-compact {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
|
||||
Reference in New Issue
Block a user