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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
48df316256
commit
356ea7b430
2 files changed
+10
-10
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user