Showing avatar on release actor tile. Fixed social URL validation.

This commit is contained in:
ThePendulum 2020-05-17 05:24:46 +02:00
parent 61965d480c
commit af5543190a
4 changed files with 90 additions and 95 deletions

View File

@ -8,8 +8,6 @@ function curateActor(actor, release) {
}, },
}; };
if (actor.avatar) curatedActor.avatar = actor.avatar.media;
if (release && release.date && curatedActor.birthdate) { if (release && release.date && curatedActor.birthdate) {
curatedActor.ageThen = dayjs(release.date).diff(actor.birthdate, 'year'); curatedActor.ageThen = dayjs(release.date).diff(actor.birthdate, 'year');
} }

View File

@ -37,6 +37,12 @@ const actorFields = `
birthdate: dateOfBirth birthdate: dateOfBirth
age age
gender gender
avatar: avatarMedia {
id
path
thumbnail
lazy
}
network { network {
id id
name name
@ -47,15 +53,6 @@ const actorFields = `
name name
alias alias
} }
actorsProfiles {
actorsAvatarByProfileId {
media {
path
thumbnail
copyright
}
}
}
`; `;
const releaseActorsFragment = ` const releaseActorsFragment = `

View File

@ -196,7 +196,7 @@ async function curateProfile(profile) {
curatedProfile.social = Array.isArray(profile.social) curatedProfile.social = Array.isArray(profile.social)
? profile.social.map((social) => { ? profile.social.map((social) => {
try { try {
const { href } = new URL(); const { href } = new URL(social);
return href; return href;
} catch (error) { } catch (error) {
logger.warn(`Profile scraper for '${profile.site.name}' returned invalid social link: ${social}`); logger.warn(`Profile scraper for '${profile.site.name}' returned invalid social link: ${social}`);