Drastic actor page redesign. Storing one avatar per actor, other profile photos as 'photo' role; no longer assuming first photo is avatar.

This commit is contained in:
2019-11-28 05:36:22 +01:00
parent 884ef248e4
commit 4be508b388
300 changed files with 1110 additions and 213 deletions

View File

@@ -239,6 +239,8 @@ async function storeAvatars(profile, actor) {
return !existingAvatars.some(avatar => file.hash === avatar.hash);
});
const hasAvatar = existingAvatars.some(avatar => avatar.role === 'avatar');
await knex('media')
.insert(newAvatars.map((file, index) => ({
path: file.filepath,
@@ -249,7 +251,7 @@ async function storeAvatars(profile, actor) {
index,
domain: 'actors',
target_id: actor.id,
role: 'avatar',
role: index === 0 && !hasAvatar ? 'avatar' : 'photo',
})));
}