Compare commits
6 Commits
server-cha
...
fix-images
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6bff57e8da | ||
|
|
3a9446f9ae | ||
|
|
ae09d79577 | ||
| 6ac56d38c0 | |||
|
|
b7f7381dec | ||
| 1ce7a718bb |
@@ -803,8 +803,8 @@ public partial class LightlessHub
|
|||||||
cancellationToken)
|
cancellationToken)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
ImageCheckService.ImageLoadResult profileResult = null;
|
ImageCheckService.ImageLoadResult profileResult = new();
|
||||||
ImageCheckService.ImageLoadResult bannerResult = null;
|
ImageCheckService.ImageLoadResult bannerResult = new();
|
||||||
|
|
||||||
//Avatar image validation
|
//Avatar image validation
|
||||||
if (!string.IsNullOrEmpty(dto.PictureBase64))
|
if (!string.IsNullOrEmpty(dto.PictureBase64))
|
||||||
@@ -839,7 +839,7 @@ public partial class LightlessHub
|
|||||||
IsNSFW = dto.IsNsfw ?? false,
|
IsNSFW = dto.IsNsfw ?? false,
|
||||||
};
|
};
|
||||||
|
|
||||||
groupProfileDb.UpdateProfileFromDto(dto, profileResult.Base64Image, bannerResult.Base64Image);
|
groupProfileDb.UpdateProfileFromDto(dto, profileResult?.Base64Image, bannerResult?.Base64Image);
|
||||||
await DbContext.GroupProfiles.AddAsync(groupProfileDb, cancellationToken).ConfigureAwait(false);
|
await DbContext.GroupProfiles.AddAsync(groupProfileDb, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -850,7 +850,7 @@ public partial class LightlessHub
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
groupProfileDb.UpdateProfileFromDto(dto, profileResult.Base64Image, bannerResult.Base64Image);
|
groupProfileDb.UpdateProfileFromDto(dto, profileResult?.Base64Image, bannerResult?.Base64Image);
|
||||||
|
|
||||||
var userIds = await DbContext.GroupPairs
|
var userIds = await DbContext.GroupPairs
|
||||||
.Where(p => p.GroupGID == groupProfileDb.GroupGID)
|
.Where(p => p.GroupGID == groupProfileDb.GroupGID)
|
||||||
|
|||||||
@@ -17,22 +17,22 @@ public static class Extensions
|
|||||||
|
|
||||||
if (profile == null || dto == null) return;
|
if (profile == null || dto == null) return;
|
||||||
|
|
||||||
profile.Base64GroupProfileImage = string.IsNullOrWhiteSpace(base64PictureString) ? null : base64PictureString;
|
if (base64PictureString != null) profile.Base64GroupProfileImage = base64PictureString;
|
||||||
profile.Base64GroupBannerImage = string.IsNullOrWhiteSpace(base64BannerString) ? null : base64BannerString;
|
if (base64BannerString != null) profile.Base64GroupBannerImage = base64BannerString;
|
||||||
if (dto.Tags != null) profile.Tags = dto.Tags;
|
if (dto.Tags != null) profile.Tags = dto.Tags;
|
||||||
if (dto.Description != null) profile.Description = dto.Description;
|
if (dto.Description != null) profile.Description = dto.Description;
|
||||||
if (dto.IsNsfw.HasValue) profile.IsNSFW = dto.IsNsfw.Value;
|
if (dto.IsNsfw.HasValue) profile.IsNSFW = dto.IsNsfw.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateProfileFromDto(this UserProfileData profile, UserProfileDto dto, string? base64PictureString, string? base64BannerString = null)
|
public static void UpdateProfileFromDto(this UserProfileData profile, UserProfileDto dto, string? base64PictureString = null, string? base64BannerString = null)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(profile);
|
ArgumentNullException.ThrowIfNull(profile);
|
||||||
ArgumentNullException.ThrowIfNull(dto);
|
ArgumentNullException.ThrowIfNull(dto);
|
||||||
|
|
||||||
if (profile == null || dto == null) return;
|
if (profile == null || dto == null) return;
|
||||||
|
|
||||||
profile.Base64ProfileImage = string.IsNullOrWhiteSpace(base64PictureString) ? null : base64PictureString;
|
if (base64PictureString != null) profile.Base64ProfileImage = base64PictureString;
|
||||||
profile.Base64BannerImage = string.IsNullOrWhiteSpace(base64BannerString) ? null : base64BannerString;
|
if (base64BannerString != null) profile.Base64BannerImage = base64BannerString;
|
||||||
if (dto.Tags != null) profile.Tags = dto.Tags;
|
if (dto.Tags != null) profile.Tags = dto.Tags;
|
||||||
if (dto.Description != null) profile.UserDescription = dto.Description;
|
if (dto.Description != null) profile.UserDescription = dto.Description;
|
||||||
if (dto.IsNSFW.HasValue) profile.IsNSFW = dto.IsNSFW.Value;
|
if (dto.IsNSFW.HasValue) profile.IsNSFW = dto.IsNSFW.Value;
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ namespace LightlessSyncServer.Migrations
|
|||||||
type: "integer[]",
|
type: "integer[]",
|
||||||
nullable: true);
|
nullable: true);
|
||||||
|
|
||||||
migrationBuilder.Sql("UPDATE group_profiles SET tags = NULL;");
|
migrationBuilder.Sql(
|
||||||
|
"ALTER TABLE group_profiles ALTER COLUMN tags TYPE integer[] USING string_to_array(tags, ',')::integer[];"
|
||||||
|
);
|
||||||
|
|
||||||
migrationBuilder.AlterColumn<int[]>(
|
migrationBuilder.AlterColumn<int[]>(
|
||||||
name: "tags",
|
name: "tags",
|
||||||
|
|||||||
Reference in New Issue
Block a user