diff --git a/Iceshrimp.Backend/Controllers/Web/ProfileController.cs b/Iceshrimp.Backend/Controllers/Web/ProfileController.cs index d3ecdaf8..0bdcdf46 100644 --- a/Iceshrimp.Backend/Controllers/Web/ProfileController.cs +++ b/Iceshrimp.Backend/Controllers/Web/ProfileController.cs @@ -53,9 +53,7 @@ public class ProfileController( [HttpPut] [Consumes(MediaTypeNames.Application.Json)] [ProducesResults(HttpStatusCode.OK)] - public async Task UpdateProfile( - UserProfileEntity newProfile, [FromQuery] string? newAvatarAlt, [FromQuery] string? newBannerAlt - ) + public async Task UpdateProfile(UserProfileEntity newProfile) { var user = HttpContext.GetUserOrFail(); var profile = user.UserProfile ?? throw new Exception("Local user must have profile"); @@ -87,7 +85,7 @@ public class ProfileController( user.IsCat = newProfile.IsCat; user.SpeakAsCat = newProfile is { SpeakAsCat: true, IsCat: true }; - if (newAvatarAlt != null) + if (newProfile.AvatarAlt != null) { var avatar = await db.DriveFiles .FirstOrDefaultAsync(p => p.UserId == user.Id && p.UserAvatar != null); @@ -95,10 +93,10 @@ public class ProfileController( if (avatar != null) { user.Avatar = avatar; - user.Avatar.Comment = string.IsNullOrWhiteSpace(newAvatarAlt) ? null : newAvatarAlt.Trim(); + user.Avatar.Comment = string.IsNullOrWhiteSpace(newProfile.AvatarAlt) ? null : newProfile.AvatarAlt.Trim(); } } - if (newBannerAlt != null) + if (newProfile.BannerAlt != null) { var banner = await db.DriveFiles .FirstOrDefaultAsync(p => p.UserId == user.Id && p.UserBanner != null); @@ -106,7 +104,7 @@ public class ProfileController( if (banner != null) { user.Banner = banner; - user.Banner.Comment = string.IsNullOrWhiteSpace(newBannerAlt) ? null : newBannerAlt.Trim(); + user.Banner.Comment = string.IsNullOrWhiteSpace(newProfile.BannerAlt) ? null : newProfile.BannerAlt.Trim(); } } var prevAvatarId = user.AvatarId; diff --git a/Iceshrimp.Shared/Schemas/Web/UserProfileEntity.cs b/Iceshrimp.Shared/Schemas/Web/UserProfileEntity.cs index 0fe02b4c..ef67e646 100644 --- a/Iceshrimp.Shared/Schemas/Web/UserProfileEntity.cs +++ b/Iceshrimp.Shared/Schemas/Web/UserProfileEntity.cs @@ -18,6 +18,8 @@ public class UserProfileEntity public required List Fields { get; set; } public required FFVisibilityEnum FFVisibility { get; set; } public required string DisplayName { get; set; } + public string? AvatarAlt { get; set; } + public string? BannerAlt { get; set; } public required bool IsBot { get; set; } public required bool IsCat { get; set; }