Fixed actor data and avatar fetching and display.

This commit is contained in:
ThePendulum 2020-01-02 17:13:57 +01:00
parent 5a6bf2b42f
commit e77dbca954
3 changed files with 11 additions and 4 deletions

View File

@ -9,7 +9,6 @@ import { curateRelease } from '../curate';
function curateActor(actor) {
const curatedActor = {
...actor,
avatar: actor.avatar.media,
height: actor.heightMetric && {
metric: actor.heightMetric,
imperial: actor.heightImperial,
@ -30,6 +29,10 @@ function curateActor(actor) {
},
};
if (actor.avatar) {
curatedActor.avatar = actor.avatar.media;
}
if (actor.releases) {
curatedActor.releases = actor.releases.map(release => curateRelease(release.release));
}
@ -145,6 +148,8 @@ function initActorActions(store, _router) {
id
name
slug
age
birthdate
avatar: actorsAvatarByActorId {
media {
thumbnail

View File

@ -211,7 +211,9 @@ async function storePhotos(photos, {
.first();
if (primaryPhoto) {
await upsert(`${domain}s_${role}s`, photoAssociations, [`${domain}_id`, 'media_id']);
const remainingAssociations = photoAssociations.filter(association => association.media_id === primaryPhoto.media_id);
await upsert(`${domain}s_${role}s`, remainingAssociations, [`${domain}_id`, 'media_id']);
return;
}
@ -219,6 +221,8 @@ async function storePhotos(photos, {
upsert(`${domain}s_${primaryRole}s`, photoAssociations.slice(0, 1), [`${domain}_id`, 'media_id']),
upsert(`${domain}s_${role}s`, photoAssociations.slice(1), [`${domain}_id`, 'media_id']),
]);
return;
}
await upsert(`${domain}s_${role}s`, photoAssociations, [`${domain}_id`, 'media_id']);

View File

@ -306,7 +306,6 @@ async function storeReleaseAssets(release, releaseId) {
targetId: releaseId,
subpath,
}, identifier),
/*
storePhotos(release.covers, {
role: 'cover',
targetId: releaseId,
@ -316,7 +315,6 @@ async function storeReleaseAssets(release, releaseId) {
targetId: releaseId,
subpath,
}, identifier),
*/
]);
} catch (error) {
console.log(release.url, error);