Fixed scene actor tag revision display.

This commit is contained in:
2026-03-22 05:53:13 +01:00
parent fa65da75bc
commit b61631c33c
2 changed files with 32 additions and 3 deletions

View File

@@ -266,7 +266,7 @@ const expanded = ref(new Set());
const mappedKeys = { const mappedKeys = {
actors: actorsById, actors: actorsById,
tags: tagsById, // tags: tagsById,
movies: moviesById, movies: moviesById,
}; };
@@ -292,6 +292,16 @@ const curatedRevisions = computed(() => revisions.value.map((revision) => {
}))]; }))];
} }
if (key === 'tags') {
return [key, value.map((tag) => ({
id: tag.id,
name: tag.actorId
? `${actorsById.value[tag.actorId]?.name}: ${tagsById.value[tag.id]?.name}`
: tagsById.value[tag.id]?.name,
modified: revision.deltas.some((delta) => delta.key === key && !delta.value.some((deltaTag) => deltaTag.id === tag.id)),
}))];
}
if (key === 'socials') { if (key === 'socials') {
// new socials don't have IDs yet, so we need to compare the values // new socials don't have IDs yet, so we need to compare the values
return [key, value.map((item) => ({ return [key, value.map((item) => ({
@@ -323,6 +333,19 @@ const curatedRevisions = computed(() => revisions.value.map((revision) => {
}; };
} }
if (delta.key === 'tags') {
return {
...delta,
value: delta.value.map((tag) => ({
id: tag.id,
name: tag.actorId
? `${actorsById.value[tag.actorId]?.name}: ${tagsById.value[tag.id]?.name}`
: tagsById.value[tag.id]?.name,
modified: !revision.base[delta.key].some((deltaTag) => deltaTag.id === tag.id),
})),
};
}
if (delta.key === 'socials') { if (delta.key === 'socials') {
// new socials don't have IDs yet, so we need to compare the values // new socials don't have IDs yet, so we need to compare the values
return { return {

View File

@@ -729,8 +729,14 @@ export async function fetchSceneRevisions(revisionId, filters = {}, reqUser) {
.limit(limit) .limit(limit)
.offset((page - 1) * limit); .offset((page - 1) * limit);
const actorIds = Array.from(new Set(revisions.flatMap((revision) => [...revision.base.actors, ...(revision.deltas.find((delta) => delta.key === 'actors')?.value || [])]))); const actorIds = Array.from(new Set(revisions.flatMap((revision) => [
const tagIds = Array.from(new Set(revisions.flatMap((revision) => [...revision.base.tags, ...(revision.deltas.find((delta) => delta.key === 'tags')?.value || [])]))); ...revision.base.actors,
...(revision.deltas.find((delta) => delta.key === 'actors')?.value || []),
...revision.base.tags.map((tag) => tag.actorId),
...revision.deltas.find((delta) => delta.key === 'tags')?.value.map((tag) => tag.actorId) || [],
].filter(Boolean))));
const tagIds = Array.from(new Set(revisions.flatMap((revision) => [...revision.base.tags, ...(revision.deltas.find((delta) => delta.key === 'tags')?.value || [])].map((tag) => tag.id))));
const movieIds = Array.from(new Set(revisions.flatMap((revision) => [...revision.base.movies, ...(revision.deltas.find((delta) => delta.key === 'movies')?.value || [])]))); const movieIds = Array.from(new Set(revisions.flatMap((revision) => [...revision.base.movies, ...(revision.deltas.find((delta) => delta.key === 'movies')?.value || [])])));
const [actors, tags, movies] = await Promise.all([ const [actors, tags, movies] = await Promise.all([