Merge pull request #1876 from maeeeeee/group-img-fix

Fix broken avatar thumbnail upon deleting last member of a group
This commit is contained in:
Cohee 2024-03-01 21:24:34 +02:00 committed by GitHub
commit d0d6a7edb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -598,6 +598,11 @@ function getGroupAvatar(group) {
return groupAvatar;
}
// catch edge case where group had one member and that member is deleted
if (avatarCount === 0) {
return $('<div class="missing-avatar fa-solid fa-user-slash"></div>');
}
// default avatar
const groupAvatar = $('#group_avatars_template .collage_1').clone();
groupAvatar.find('.img_1').attr('src', group.avatar_url || system_avatar);