Fixed affiliate banner ratio on tags page. Added affiliate banners to actor page.
This commit is contained in:
parent
2afcdd6050
commit
45ed3be747
|
@ -6,6 +6,7 @@ import { fetchMovies } from '#/src/movies.js';
|
|||
import { curateScenesQuery } from '#/src/web/scenes.js';
|
||||
import { curateMoviesQuery } from '#/src/web/movies.js';
|
||||
import { fetchCountries } from '#/src/countries.js';
|
||||
import { getRandomCampaigns, getCampaignIndex } from '#/src/campaigns.js';
|
||||
|
||||
async function fetchReleases(pageContext) {
|
||||
if (pageContext.routeParams.domain === 'movies') {
|
||||
|
@ -40,16 +41,27 @@ export async function onBeforeRender(pageContext) {
|
|||
throw redirect(`/login?r=${encodeURIComponent(pageContext.urlOriginal)}`);
|
||||
}
|
||||
|
||||
const [[actor], actorReleases, countries] = await Promise.all([
|
||||
fetchActorsById([Number(pageContext.routeParams.actorId)], {}, pageContext.user),
|
||||
fetchReleases(pageContext),
|
||||
isEditing && fetchCountries(),
|
||||
]);
|
||||
const [actor] = await fetchActorsById([Number(pageContext.routeParams.actorId)], {}, pageContext.user);
|
||||
|
||||
if (!actor) {
|
||||
throw render(404, `Cannot find actor '${pageContext.routeParams.actorId}'.`);
|
||||
}
|
||||
|
||||
const [actorReleases, campaigns, countries] = await Promise.all([
|
||||
fetchReleases(pageContext),
|
||||
getRandomCampaigns([
|
||||
// don't show meta campaign, too intrusive under actor bio
|
||||
{ minRatio: 3 },
|
||||
pageContext.routeParams.domain === 'scenes'
|
||||
? { minRatio: 0.75, maxRatio: 1.25 }
|
||||
: null,
|
||||
].filter(Boolean), { tagFilter: pageContext.tagFilter }),
|
||||
isEditing && fetchCountries(),
|
||||
]);
|
||||
|
||||
const campaignIndex = getCampaignIndex(actorReleases.limit);
|
||||
const [paginationCampaign, sceneCampaign] = campaigns;
|
||||
|
||||
return {
|
||||
pageContext: {
|
||||
title: isEditing
|
||||
|
@ -60,6 +72,11 @@ export async function onBeforeRender(pageContext) {
|
|||
countries,
|
||||
...actorReleases,
|
||||
},
|
||||
campaigns: {
|
||||
index: campaignIndex,
|
||||
scenes: actorReleases.limit > 5 && sceneCampaign,
|
||||
pagination: paginationCampaign,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ export async function onBeforeRender(pageContext) {
|
|||
fetchTagsById([tagSlug], {}, pageContext.user),
|
||||
fetchReleases(pageContext),
|
||||
getRandomCampaigns([
|
||||
{ tagSlugs: [tagSlug], minRatio: 1.5 },
|
||||
{ tagSlugs: [tagSlug], minRatio: 1.5 },
|
||||
{ tagSlugs: [tagSlug], minRatio: 3 },
|
||||
{ tagSlugs: [tagSlug], minRatio: 3 },
|
||||
pageContext.routeParams.domain === 'scenes'
|
||||
? { tagSlugs: [tagSlug], minRatio: 0.75, maxRatio: 1.25 }
|
||||
: null,
|
||||
|
|
Loading…
Reference in New Issue