Added avatar credit exclusion to profile interpolation.
This commit is contained in:
@@ -164,14 +164,14 @@ export async function interpolateProfiles(actorIdsOrNames, context, options = {}
|
|||||||
|
|
||||||
profile.avatar_media_id = actorProfiles
|
profile.avatar_media_id = actorProfiles
|
||||||
.map((actorProfile) => actorProfile.avatar)
|
.map((actorProfile) => actorProfile.avatar)
|
||||||
.filter((avatar) => avatar && (avatar.entropy === null || avatar.entropy > 5.5))
|
.filter((avatar) => avatar && (avatar.entropy === null || avatar.entropy > 5.5) && !options.avoidAvatarCredits?.includes(avatar.credit) && !options.excludeAvatarCredits?.includes(avatar.credit))
|
||||||
.sort((avatarA, avatarB) => avatarB.height - avatarA.height)[0]?.id || null;
|
.sort((avatarA, avatarB) => avatarB.height - avatarA.height)[0]?.id || null;
|
||||||
|
|
||||||
if (!profile.avatar_media_id) {
|
if (!profile.avatar_media_id) {
|
||||||
// try to settle for low quality avatar
|
// try to settle for low quality avatar
|
||||||
profile.avatar_media_id = actorProfiles
|
profile.avatar_media_id = actorProfiles
|
||||||
.map((actorProfile) => actorProfile.avatar)
|
.map((actorProfile) => actorProfile.avatar)
|
||||||
.filter((avatar) => avatar)
|
.filter((avatar) => !!avatar && !options?.excludeAvatarCredits?.includes(avatar.credit))
|
||||||
.sort((avatarA, avatarB) => avatarB.height - avatarA.height)[0]?.id || null;
|
.sort((avatarA, avatarB) => avatarB.height - avatarA.height)[0]?.id || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user