Added actor revision overviews to actor and user pages.
This commit is contained in:
@@ -4,19 +4,37 @@ import { fetchUser } from '#/src/users.js';
|
||||
import { fetchUserStashes } from '#/src/stashes.js';
|
||||
import { fetchAlerts } from '#/src/alerts.js';
|
||||
import { fetchSceneRevisions } from '#/src/scenes.js';
|
||||
import { fetchActorRevisions } from '#/src/actors.js';
|
||||
|
||||
async function fetchRevisions(pageContext) {
|
||||
if (pageContext.routeParams.username !== pageContext.user?.username) {
|
||||
return {};
|
||||
}
|
||||
|
||||
if (pageContext.routeParams.section === 'revisions' && pageContext.routeParams.domain === 'scenes') {
|
||||
return fetchSceneRevisions(null, {
|
||||
userId: pageContext.user.id,
|
||||
limit: 100,
|
||||
}, pageContext.user);
|
||||
}
|
||||
|
||||
if (pageContext.routeParams.section === 'revisions' && pageContext.routeParams.domain === 'actors') {
|
||||
return fetchActorRevisions(null, {
|
||||
userId: pageContext.user.id,
|
||||
limit: 100,
|
||||
}, pageContext.user);
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
export async function onBeforeRender(pageContext) {
|
||||
const [profile, alerts, userRevisions] = await Promise.all([
|
||||
fetchUser(pageContext.routeParams.username, {}, pageContext.user),
|
||||
pageContext.routeParams.domain === 'stashes' && pageContext.routeParams.username === pageContext.user?.username
|
||||
pageContext.routeParams.section === 'alerts' && pageContext.routeParams.username === pageContext.user?.username
|
||||
? fetchAlerts(pageContext.user)
|
||||
: [],
|
||||
pageContext.routeParams.domain === 'revisions' && pageContext.routeParams.username === pageContext.user?.username
|
||||
? fetchSceneRevisions(null, {
|
||||
userId: pageContext.user.id,
|
||||
limit: 100,
|
||||
}, pageContext.user)
|
||||
: {},
|
||||
fetchRevisions(pageContext),
|
||||
]);
|
||||
|
||||
if (!profile) {
|
||||
@@ -28,8 +46,11 @@ export async function onBeforeRender(pageContext) {
|
||||
actors,
|
||||
tags,
|
||||
movies,
|
||||
avatars,
|
||||
} = userRevisions;
|
||||
|
||||
console.log(userRevisions);
|
||||
|
||||
const stashes = await fetchUserStashes(profile.id, pageContext.user);
|
||||
|
||||
return {
|
||||
@@ -43,6 +64,7 @@ export async function onBeforeRender(pageContext) {
|
||||
actors,
|
||||
tags,
|
||||
movies,
|
||||
avatars,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user