mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Improved LdapService thread safety, fixed user images sometimes not loading
This commit is contained in:
@@ -98,7 +98,6 @@ public class HomeController : Controller
|
||||
[ResponseCache(Duration = 3600, Location = ResponseCacheLocation.Any, VaryByQueryKeys = new[] { "uid", "size" })]
|
||||
public async Task<IActionResult> UserPhotoAsync(string uid, int? size)
|
||||
{
|
||||
Task<AdminSettingsModel> adminSettingsModelTask = _ldap.GetAdminSettingsModelAsync();
|
||||
UserModel? user = await _ldap.GetUserByUidAsync(uid, _ldap.UsersAttributes);
|
||||
if (user is null || user.JpegPhoto is null || user.JpegPhoto == "")
|
||||
{
|
||||
@@ -110,7 +109,7 @@ public class HomeController : Controller
|
||||
}
|
||||
if (size is not null)
|
||||
{
|
||||
AdminSettingsModel adminSettingsModel = await adminSettingsModelTask;
|
||||
AdminSettingsModel adminSettingsModel = await _ldap.GetAdminSettingsModelAsync();
|
||||
size = Math.Min((int)size, adminSettingsModel.MaxDownloadableUserImageSize);
|
||||
}
|
||||
byte[] encodedFile = ImageHelper.ResizeAndConvertToWebp(user.JpegPhoto, size ?? 32);
|
||||
|
||||
Reference in New Issue
Block a user