Fix broken avatar thumbnail upon deleting last member of a group

This commit is contained in:
Mae Thomson 2024-03-01 11:06:23 -05:00
parent 603acfc257
commit 63cd8b98dd

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);