Added support for nsfw and disabled for groups

This commit is contained in:
CakeAndBanana
2025-10-15 23:22:07 +02:00
parent 80086f6817
commit 3a6203844e
2 changed files with 10 additions and 9 deletions

View File

@@ -749,16 +749,11 @@ public partial class LightlessHub
.FirstOrDefaultAsync(g => g.Group.GID == dto.Group.GID || g.Group.Alias == dto.Group.GID, cancellationToken) .FirstOrDefaultAsync(g => g.Group.GID == dto.Group.GID || g.Group.Alias == dto.Group.GID, cancellationToken)
.ConfigureAwait(false); .ConfigureAwait(false);
var profileDto = new GroupProfileDto(dto.Group, Description: null, Tags: null, PictureBase64: null); var profileDto = new GroupProfileDto(dto.Group, Description: null, Tags: null, PictureBase64: null, IsNsfw: false, IsDisabled: false);
if (data is not null) if (data is not null)
{ {
profileDto = profileDto with profileDto = data.ToDTO();
{
Description = data.Description,
Tags = data.Tags,
PictureBase64 = data.Base64GroupProfileImage,
};
} }
return profileDto; return profileDto;
@@ -791,7 +786,8 @@ public partial class LightlessHub
{ {
groupProfileDb.Base64GroupProfileImage = dto.PictureBase64; groupProfileDb.Base64GroupProfileImage = dto.PictureBase64;
} }
else if (dto.Tags != null)
if (dto.Tags != null)
{ {
groupProfileDb.Tags = dto.Tags; groupProfileDb.Tags = dto.Tags;
} }
@@ -801,6 +797,11 @@ public partial class LightlessHub
groupProfileDb.Description = dto.Description; groupProfileDb.Description = dto.Description;
} }
if (dto.IsNsfw != null)
{
groupProfileDb.IsNSFW = dto.IsNsfw.Value;
}
await Clients.Users(groupPairs).Client_GroupSendProfile(groupProfileDb.ToDTO()).ConfigureAwait(false); await Clients.Users(groupPairs).Client_GroupSendProfile(groupProfileDb.ToDTO()).ConfigureAwait(false);
} }
else else

View File

@@ -11,7 +11,7 @@ public static class Extensions
{ {
public static GroupProfileDto ToDTO(this GroupProfile groupProfile) public static GroupProfileDto ToDTO(this GroupProfile groupProfile)
{ {
return new GroupProfileDto(groupProfile.Group.ToGroupData(), groupProfile.Description, groupProfile.Tags, groupProfile.Base64GroupProfileImage); return new GroupProfileDto(groupProfile.Group.ToGroupData(), groupProfile.Description, groupProfile.Tags, groupProfile.Base64GroupProfileImage, groupProfile.IsNSFW, groupProfile.ProfileDisabled);
} }
public static GroupData ToGroupData(this Group group) public static GroupData ToGroupData(this Group group)