]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/account/actor.model.ts
Fix avatars in notifications
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / account / actor.model.ts
index 6be6b75d0e63c948f138674a4fec39676ba7f8de..6e45ba588355b539f3b36a7e4500fae97e965e9f 100644 (file)
@@ -21,11 +21,11 @@ export abstract class Actor implements ServerActor {
   isLocal: boolean
 
   static GET_ACTOR_AVATAR_URL (actor: { avatars: { width: number, url?: string, path: string }[] }, size?: number) {
-    const avatars = actor.avatars.sort((a, b) => b.width - a.width)
+    const avatarsAscWidth = actor.avatars.sort((a, b) => a.width - b.width)
 
     const avatar = size
-      ? avatars.find(a => a.width >= size)
-      : avatars[0]
+      ? avatarsAscWidth.find(a => a.width >= size)
+      : avatarsAscWidth[avatarsAscWidth.length - 1] // Bigger one
 
     if (!avatar) return ''
     if (avatar.url) return avatar.url