feat!: separate banner privacy from description privacy

This commit is contained in:
rladenson 2024-11-08 16:25:45 -07:00
parent 0c802ab0bd
commit a0f13b47af
15 changed files with 100 additions and 9 deletions

View file

@ -374,7 +374,7 @@ public class Groups
async Task ShowBannerImage()
{
ctx.CheckSystemPrivacy(target.System, target.DescriptionPrivacy);
ctx.CheckSystemPrivacy(target.System, target.BannerPrivacy);
if ((target.BannerImage?.Trim() ?? "").Length > 0)
{
@ -509,6 +509,7 @@ public class Groups
.Title($"Current privacy settings for {target.Name}")
.Field(new Embed.Field("Name", target.NamePrivacy.Explanation()))
.Field(new Embed.Field("Description", target.DescriptionPrivacy.Explanation()))
.Field(new Embed.Field("Description", target.BannerPrivacy.Explanation()))
.Field(new Embed.Field("Icon", target.IconPrivacy.Explanation()))
.Field(new Embed.Field("Member list", target.ListPrivacy.Explanation()))
.Field(new Embed.Field("Metadata (creation date)", target.MetadataPrivacy.Explanation()))
@ -539,6 +540,7 @@ public class Groups
{
GroupPrivacySubject.Name => "name privacy",
GroupPrivacySubject.Description => "description privacy",
GroupPrivacySubject.Banner => "banner privacy",
GroupPrivacySubject.Icon => "icon privacy",
GroupPrivacySubject.List => "member list",
GroupPrivacySubject.Metadata => "metadata",
@ -552,6 +554,8 @@ public class Groups
"This group's name is now hidden from other systems, and will be replaced by the group's display name.",
(GroupPrivacySubject.Description, PrivacyLevel.Private) =>
"This group's description is now hidden from other systems.",
(GroupPrivacySubject.Banner, PrivacyLevel.Private) =>
"This group's banner is now hidden from other systems.",
(GroupPrivacySubject.Icon, PrivacyLevel.Private) =>
"This group's icon is now hidden from other systems.",
(GroupPrivacySubject.Visibility, PrivacyLevel.Private) =>
@ -565,6 +569,8 @@ public class Groups
"This group's name is no longer hidden from other systems.",
(GroupPrivacySubject.Description, PrivacyLevel.Public) =>
"This group's description is no longer hidden from other systems.",
(GroupPrivacySubject.Banner, PrivacyLevel.Public) =>
"This group's banner is no longer hidden from other systems.",
(GroupPrivacySubject.Icon, PrivacyLevel.Public) =>
"This group's icon is no longer hidden from other systems.",
(GroupPrivacySubject.Visibility, PrivacyLevel.Public) =>

View file

@ -756,6 +756,7 @@ public class MemberEdit
.Field(new Embed.Field("Name (replaces name with display name if member has one)",
target.NamePrivacy.Explanation()))
.Field(new Embed.Field("Description", target.DescriptionPrivacy.Explanation()))
.Field(new Embed.Field("Banner", target.BannerPrivacy.Explanation()))
.Field(new Embed.Field("Avatar", target.AvatarPrivacy.Explanation()))
.Field(new Embed.Field("Birthday", target.BirthdayPrivacy.Explanation()))
.Field(new Embed.Field("Pronouns", target.PronounPrivacy.Explanation()))
@ -794,6 +795,7 @@ public class MemberEdit
{
MemberPrivacySubject.Name => "name privacy",
MemberPrivacySubject.Description => "description privacy",
MemberPrivacySubject.Banner => "banner privacy",
MemberPrivacySubject.Avatar => "avatar privacy",
MemberPrivacySubject.Pronouns => "pronoun privacy",
MemberPrivacySubject.Birthday => "birthday privacy",
@ -809,6 +811,8 @@ public class MemberEdit
"This member's name is now hidden from other systems, and will be replaced by the member's display name.",
(MemberPrivacySubject.Description, PrivacyLevel.Private) =>
"This member's description is now hidden from other systems.",
(MemberPrivacySubject.Banner, PrivacyLevel.Private) =>
"This member's banner is now hidden from other systems.",
(MemberPrivacySubject.Avatar, PrivacyLevel.Private) =>
"This member's avatar is now hidden from other systems.",
(MemberPrivacySubject.Birthday, PrivacyLevel.Private) =>
@ -826,6 +830,8 @@ public class MemberEdit
"This member's name is no longer hidden from other systems.",
(MemberPrivacySubject.Description, PrivacyLevel.Public) =>
"This member's description is no longer hidden from other systems.",
(MemberPrivacySubject.Banner, PrivacyLevel.Public) =>
"This member's banner is no longer hidden from other systems.",
(MemberPrivacySubject.Avatar, PrivacyLevel.Public) =>
"This member's avatar is no longer hidden from other systems.",
(MemberPrivacySubject.Birthday, PrivacyLevel.Public) =>

View file

@ -672,7 +672,7 @@ public class SystemEdit
public async Task BannerImage(Context ctx, PKSystem target)
{
ctx.CheckSystemPrivacy(target.Id, target.DescriptionPrivacy);
ctx.CheckSystemPrivacy(target.Id, target.BannerPrivacy);
var isOwnSystem = target.Id == ctx.System?.Id;
@ -835,6 +835,7 @@ public class SystemEdit
.Field(new Embed.Field("Name", target.NamePrivacy.Explanation()))
.Field(new Embed.Field("Avatar", target.AvatarPrivacy.Explanation()))
.Field(new Embed.Field("Description", target.DescriptionPrivacy.Explanation()))
.Field(new Embed.Field("Banner", target.BannerPrivacy.Explanation()))
.Field(new Embed.Field("Pronouns", target.PronounPrivacy.Explanation()))
.Field(new Embed.Field("Member list", target.MemberListPrivacy.Explanation()))
.Field(new Embed.Field("Group list", target.GroupListPrivacy.Explanation()))
@ -861,6 +862,7 @@ public class SystemEdit
SystemPrivacySubject.Name => "name",
SystemPrivacySubject.Avatar => "avatar",
SystemPrivacySubject.Description => "description",
SystemPrivacySubject.Banner => "banner",
SystemPrivacySubject.Pronouns => "pronouns",
SystemPrivacySubject.Front => "front",
SystemPrivacySubject.FrontHistory => "front history",

View file

@ -67,7 +67,7 @@ public class EmbedService
if (avatar != null)
eb.Thumbnail(new Embed.EmbedThumbnail(avatar));
if (system.DescriptionPrivacy.CanAccess(ctx))
if (system.BannerPrivacy.CanAccess(ctx))
eb.Image(new Embed.EmbedImage(system.BannerImage));
var latestSwitch = await _repo.GetLatestSwitch(system.Id);
@ -194,7 +194,7 @@ public class EmbedService
.Footer(new Embed.EmbedFooter(
$"System ID: {system.DisplayHid(ccfg)} | Member ID: {member.DisplayHid(ccfg)} {(member.MetadataPrivacy.CanAccess(ctx) ? $"| Created on {member.Created.FormatZoned(zone)}" : "")}"));
if (member.DescriptionPrivacy.CanAccess(ctx))
if (member.BannerPrivacy.CanAccess(ctx))
eb.Image(new Embed.EmbedImage(member.BannerImage));
var description = "";
@ -271,7 +271,7 @@ public class EmbedService
eb.Footer(new Embed.EmbedFooter($"System ID: {system.DisplayHid(ctx.Config)} | Group ID: {target.DisplayHid(ctx.Config)}{(target.MetadataPrivacy.CanAccess(pctx) ? $" | Created on {target.Created.FormatZoned(ctx.Zone)}" : "")}"));
if (target.DescriptionPrivacy.CanAccess(pctx))
if (target.BannerPrivacy.CanAccess(pctx))
eb.Image(new Embed.EmbedImage(target.BannerImage));
if (target.NamePrivacy.CanAccess(pctx) && target.DisplayName != null)