From 356ea7b430b2221cf27cd3791f780ee2e37a34ae Mon Sep 17 00:00:00 2001 From: thepra Date: Wed, 7 Oct 2026 13:32:48 +0200 Subject: [PATCH] A picture picked is the form's at once, not once its preview is made Settings' profile kept a picked avatar or header only after the browser had made its small preview, so a Save clicked meanwhile saved the profile without it and said nothing; the composer added a picture to the post only after its thumbnail, so a Publish meanwhile left it out. Both now take the file (and the composer starts its upload) as soon as it is picked, and fill the preview in afterwards; a preview the browser can't make no longer drops the picture, PrivaPub decides. Found by the e2e suite under load. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw --- Components/Composer.razor | 5 +++-- Components/Settings/ProfileEditor.razor | 15 +++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Components/Composer.razor b/Components/Composer.razor index ea0ccc5..4948851 100644 --- a/Components/Composer.razor +++ b/Components/Composer.razor @@ -518,12 +518,13 @@ continue; } + // the post's at once, and uploading (a publish meanwhile waits for it); its small picture follows var media = new UploadMedia { File = file, FileName = file.Name, ContentType = type, Size = file.Size }; - if (type.StartsWith("image/")) - media.Preview = await Thumbnail(file); form.Media.Add(media); altTextConfirmed = false; Start(media); + if (type.StartsWith("image/")) + media.Preview = await Thumbnail(file); } } diff --git a/Components/Settings/ProfileEditor.razor b/Components/Settings/ProfileEditor.razor index 829ac55..2d9b8ac 100644 --- a/Components/Settings/ProfileEditor.razor +++ b/Components/Settings/ProfileEditor.razor @@ -200,8 +200,13 @@ else return; } - // the file is sent as it is when saving; only a small picture of it is kept to show it now + // the file is sent as it is when saving, and is the form's at once (a save meanwhile sends it); only a small picture + // of it is kept to show it, made afterwards, and PrivaPub decides about a file the browser can't draw var picture = new UploadMedia { File = file, FileName = file.Name, ContentType = file.ContentType, Size = file.Size }; + if (isAvatar) + form.Avatar = picture; + else + form.Header = picture; try { var small = await file.RequestImageFileAsync("image/jpeg", isAvatar ? 240 : 900, isAvatar ? 240 : 300); @@ -212,14 +217,8 @@ else } catch (Exception ex) { - await Logger.ProcessError(ex, $"{nameof(ProfileEditor)}.{nameof(Pick)}:{file.Name}"); - pictureErrors.Add(Localizer["The file \"{0}\" could not be read.", file.Name]); - return; + await Logger.ProcessWarning(ex.Message, $"{nameof(ProfileEditor)}.{nameof(Pick)}:{file.Name}"); } - if (isAvatar) - form.Avatar = picture; - else - form.Header = picture; } async Task RemovePicture(bool avatar)