Added actor revision overviews to actor and user pages.
This commit is contained in:
@@ -79,6 +79,7 @@ export function curateActor(actor, context = {}) {
|
||||
city: actor.residence_city,
|
||||
state: actor.residence_state,
|
||||
},
|
||||
agency: actor.agency,
|
||||
avatar: curateMedia(actor.avatar),
|
||||
profiles: context.profiles?.map((profile) => ({
|
||||
id: profile.id,
|
||||
@@ -159,8 +160,6 @@ export async function fetchActorsById(actorIds, options = {}, reqUser) {
|
||||
: [],
|
||||
]);
|
||||
|
||||
console.log(actors);
|
||||
|
||||
if (options.order) {
|
||||
return actors.map((actorEntry) => curateActor(actorEntry, {
|
||||
stashes: stashes.filter((stash) => stash.actor_id === actorEntry.id),
|
||||
@@ -183,8 +182,6 @@ export async function fetchActorsById(actorIds, options = {}, reqUser) {
|
||||
});
|
||||
}).filter(Boolean);
|
||||
|
||||
console.log(curatedActors);
|
||||
|
||||
return curatedActors;
|
||||
}
|
||||
|
||||
@@ -448,11 +445,16 @@ export async function fetchActorRevisions(revisionId, filters = {}, reqUser) {
|
||||
.limit(limit)
|
||||
.offset((page - 1) * limit);
|
||||
|
||||
const avatarIds = Array.from(new Set(revisions.flatMap((revision) => [revision.base.avatar, revision.deltas.find((delta) => delta.key === 'avatar')?.value]))).filter(Boolean);
|
||||
const avatarEntries = await knex('media').whereIn('id', avatarIds);
|
||||
const avatars = avatarEntries.map((avatar) => curateMedia(avatar));
|
||||
|
||||
const curatedRevisions = revisions.map((revision) => curateRevision(revision));
|
||||
|
||||
return {
|
||||
revisions: curatedRevisions,
|
||||
revision: revisionId && curatedRevisions.find((revision) => revision.id === revisionId),
|
||||
avatars,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -483,8 +485,6 @@ const keyMap = {
|
||||
};
|
||||
|
||||
async function applyActorValueDelta(profileId, delta, trx) {
|
||||
console.log('value delta', profileId, delta, keyMap[delta.key], delta.value);
|
||||
|
||||
return knex('actors_profiles')
|
||||
.where('id', profileId)
|
||||
.update(keyMap[delta.key] || delta.key, delta.value)
|
||||
@@ -492,8 +492,6 @@ async function applyActorValueDelta(profileId, delta, trx) {
|
||||
}
|
||||
|
||||
async function applyActorDirectDelta(actorId, delta, trx) {
|
||||
console.log('value delta', delta);
|
||||
|
||||
return knex('actors')
|
||||
.where('id', actorId)
|
||||
.update(keyMap[delta.key] || delta.key, delta.value)
|
||||
@@ -601,6 +599,7 @@ async function applyActorRevision(revisionIds, reqUser) {
|
||||
'tattoos',
|
||||
'hasPiercings',
|
||||
'piercings',
|
||||
'agency',
|
||||
].includes(delta.key)) {
|
||||
return applyActorValueDelta(mainProfile.id, delta, trx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user