Fix double rendering of first message when opening a chat with only 1 message

This commit is contained in:
Cohee
2024-03-16 18:22:33 +02:00
parent 2173b8b22a
commit 3ed7ccbc57
2 changed files with 9 additions and 8 deletions

View File

@@ -8328,7 +8328,15 @@ jQuery(async function () {
}
});
$(document).on('click', '#user_avatar_block .avatar-container', setUserAvatar);
$(document).on('click', '#user_avatar_block .avatar-container', function () {
const imgfile = $(this).attr('imgfile');
setUserAvatar(imgfile);
// force firstMes {{user}} update on persona switch
if (this_chid >= 0 && !selected_group && chat.length === 1) {
$('#firstmessage_textarea').trigger('input');
}
});
$(document).on('click', '#user_avatar_block .avatar_upload', function () {
$('#avatar_upload_overwrite').val('');
$('#avatar_upload_file').trigger('click');