diff --git a/PluralKit.Bot/Commands/Groups.cs b/PluralKit.Bot/Commands/Groups.cs index 1d93dcb2..e442401e 100644 --- a/PluralKit.Bot/Commands/Groups.cs +++ b/PluralKit.Bot/Commands/Groups.cs @@ -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,12 +509,13 @@ 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("Banner", 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())) .Field(new Embed.Field("Visibility", target.Visibility.Explanation())) .Description( - $"To edit privacy settings, use the command:\n> pk;group **{target.Reference(ctx)}** privacy **** ****\n\n- `subject` is one of `name`, `description`, `icon`, `members`, `metadata`, `visibility`, or `all`\n- `level` is either `public` or `private`.") + $"To edit privacy settings, use the command:\n> pk;group **{target.Reference(ctx)}** privacy **** ****\n\n- `subject` is one of `name`, `description`, `banner`, `icon`, `members`, `metadata`, `visibility`, or `all`\n- `level` is either `public` or `private`.") .Build()); return; } @@ -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) => diff --git a/PluralKit.Bot/Commands/MemberEdit.cs b/PluralKit.Bot/Commands/MemberEdit.cs index 7b7b8a76..c9fc943b 100644 --- a/PluralKit.Bot/Commands/MemberEdit.cs +++ b/PluralKit.Bot/Commands/MemberEdit.cs @@ -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())) @@ -764,7 +765,7 @@ public class MemberEdit target.MetadataPrivacy.Explanation())) .Field(new Embed.Field("Visibility", target.MemberVisibility.Explanation())) .Description( - "To edit privacy settings, use the command:\n`pk;member privacy `\n\n- `subject` is one of `name`, `description`, `avatar`, `birthday`, `pronouns`, `proxies`, `metadata`, `visibility`, or `all`\n- `level` is either `public` or `private`.") + "To edit privacy settings, use the command:\n`pk;member privacy `\n\n- `subject` is one of `name`, `description`, `banner`, `avatar`, `birthday`, `pronouns`, `proxies`, `metadata`, `visibility`, or `all`\n- `level` is either `public` or `private`.") .Build()); return; } @@ -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) => diff --git a/PluralKit.Bot/Commands/SystemEdit.cs b/PluralKit.Bot/Commands/SystemEdit.cs index 1e4e7884..264761ec 100644 --- a/PluralKit.Bot/Commands/SystemEdit.cs +++ b/PluralKit.Bot/Commands/SystemEdit.cs @@ -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,13 +835,14 @@ 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())) .Field(new Embed.Field("Current fronter(s)", target.FrontPrivacy.Explanation())) .Field(new Embed.Field("Front/switch history", target.FrontHistoryPrivacy.Explanation())) .Description( - "To edit privacy settings, use the command:\n`pk;system privacy `\n\n- `subject` is one of `name`, `avatar`, `description`, `list`, `front`, `fronthistory`, `groups`, or `all` \n- `level` is either `public` or `private`."); + "To edit privacy settings, use the command:\n`pk;system privacy `\n\n- `subject` is one of `name`, `avatar`, `description`, `banner`, `list`, `front`, `fronthistory`, `groups`, or `all` \n- `level` is either `public` or `private`."); return ctx.Reply(embed: eb.Build()); } @@ -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", diff --git a/PluralKit.Bot/Services/EmbedService.cs b/PluralKit.Bot/Services/EmbedService.cs index 73874c7e..308a347b 100644 --- a/PluralKit.Bot/Services/EmbedService.cs +++ b/PluralKit.Bot/Services/EmbedService.cs @@ -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) diff --git a/PluralKit.Core/Database/Migrations/46.sql b/PluralKit.Core/Database/Migrations/46.sql new file mode 100644 index 00000000..a6e77691 --- /dev/null +++ b/PluralKit.Core/Database/Migrations/46.sql @@ -0,0 +1,12 @@ +-- database version 45 +-- adds banner privacy + +alter table members add column banner_privacy int not null default 1 check (banner_privacy = ANY (ARRAY[1,2])); +alter table groups add column banner_privacy int not null default 1 check (banner_privacy = ANY (ARRAY[1,2])); +alter table systems add column banner_privacy int not null default 1 check (banner_privacy = ANY (ARRAY[1,2])); + +update members set banner_privacy = 2 where description_privacy = 2; +update groups set banner_privacy = 2 where description_privacy = 2; +update systems set banner_privacy = 2 where description_privacy = 2; + +update info set schema_version = 45; \ No newline at end of file diff --git a/PluralKit.Core/Database/Utils/DatabaseMigrator.cs b/PluralKit.Core/Database/Utils/DatabaseMigrator.cs index 3ffb8544..0a1bcef9 100644 --- a/PluralKit.Core/Database/Utils/DatabaseMigrator.cs +++ b/PluralKit.Core/Database/Utils/DatabaseMigrator.cs @@ -9,7 +9,7 @@ namespace PluralKit.Core; internal class DatabaseMigrator { private const string RootPath = "PluralKit.Core.Database"; // "resource path" root for SQL files - private const int TargetSchemaVersion = 45; + private const int TargetSchemaVersion = 46; private readonly ILogger _logger; public DatabaseMigrator(ILogger logger) diff --git a/PluralKit.Core/Models/PKGroup.cs b/PluralKit.Core/Models/PKGroup.cs index 8c3da07b..cfca68cf 100644 --- a/PluralKit.Core/Models/PKGroup.cs +++ b/PluralKit.Core/Models/PKGroup.cs @@ -51,6 +51,7 @@ public class PKGroup public PrivacyLevel NamePrivacy { get; private set; } public PrivacyLevel DescriptionPrivacy { get; private set; } + public PrivacyLevel BannerPrivacy { get; private set; } public PrivacyLevel IconPrivacy { get; private set; } public PrivacyLevel ListPrivacy { get; private set; } public PrivacyLevel MetadataPrivacy { get; private set; } @@ -88,7 +89,7 @@ public static class PKGroupExt o.Add("display_name", group.NamePrivacy.CanAccess(ctx) ? group.DisplayName : null); o.Add("description", group.DescriptionPrivacy.Get(ctx, group.Description)); o.Add("icon", group.IconFor(ctx)); - o.Add("banner", group.DescriptionPrivacy.Get(ctx, group.BannerImage)); + o.Add("banner", group.BannerPrivacy.Get(ctx, group.BannerImage)); o.Add("color", group.Color); o.Add("created", group.CreatedFor(ctx)?.FormatExport()); @@ -102,6 +103,7 @@ public static class PKGroupExt p.Add("name_privacy", group.NamePrivacy.ToJsonString()); p.Add("description_privacy", group.DescriptionPrivacy.ToJsonString()); + p.Add("banner_privacy", group.BannerPrivacy.ToJsonString()); p.Add("icon_privacy", group.IconPrivacy.ToJsonString()); p.Add("list_privacy", group.ListPrivacy.ToJsonString()); p.Add("metadata_privacy", group.MetadataPrivacy.ToJsonString()); diff --git a/PluralKit.Core/Models/PKMember.cs b/PluralKit.Core/Models/PKMember.cs index 6b007472..c30381f8 100644 --- a/PluralKit.Core/Models/PKMember.cs +++ b/PluralKit.Core/Models/PKMember.cs @@ -63,6 +63,7 @@ public class PKMember public PrivacyLevel MemberVisibility { get; private set; } public PrivacyLevel DescriptionPrivacy { get; private set; } + public PrivacyLevel BannerPrivacy { get; private set; } public PrivacyLevel AvatarPrivacy { get; private set; } public PrivacyLevel NamePrivacy { get; private set; } //ignore setting if no display name is set public PrivacyLevel BirthdayPrivacy { get; private set; } @@ -140,7 +141,7 @@ public static class PKMemberExt o.Add("pronouns", member.PronounsFor(ctx)); o.Add("avatar_url", member.AvatarFor(ctx).TryGetCleanCdnUrl()); o.Add("webhook_avatar_url", member.AvatarPrivacy.Get(ctx, member.WebhookAvatarUrl?.TryGetCleanCdnUrl())); - o.Add("banner", member.DescriptionPrivacy.Get(ctx, member.BannerImage).TryGetCleanCdnUrl()); + o.Add("banner", member.BannerPrivacy.Get(ctx, member.BannerImage).TryGetCleanCdnUrl()); o.Add("description", member.DescriptionFor(ctx)); o.Add("created", member.CreatedFor(ctx)?.FormatExport()); o.Add("keep_proxy", member.KeepProxy); @@ -166,6 +167,7 @@ public static class PKMemberExt p.Add("visibility", member.MemberVisibility.ToJsonString()); p.Add("name_privacy", member.NamePrivacy.ToJsonString()); p.Add("description_privacy", member.DescriptionPrivacy.ToJsonString()); + p.Add("banner_privacy", member.BannerPrivacy.ToJsonString()); p.Add("birthday_privacy", member.BirthdayPrivacy.ToJsonString()); p.Add("pronoun_privacy", member.PronounPrivacy.ToJsonString()); p.Add("avatar_privacy", member.AvatarPrivacy.ToJsonString()); diff --git a/PluralKit.Core/Models/PKSystem.cs b/PluralKit.Core/Models/PKSystem.cs index c0becc7c..d14236d2 100644 --- a/PluralKit.Core/Models/PKSystem.cs +++ b/PluralKit.Core/Models/PKSystem.cs @@ -55,6 +55,7 @@ public class PKSystem public PrivacyLevel NamePrivacy { get; } public PrivacyLevel AvatarPrivacy { get; } public PrivacyLevel DescriptionPrivacy { get; } + public PrivacyLevel BannerPrivacy { get; } public PrivacyLevel MemberListPrivacy { get; } public PrivacyLevel FrontPrivacy { get; } public PrivacyLevel FrontHistoryPrivacy { get; } @@ -85,7 +86,7 @@ public static class PKSystemExt o.Add("pronouns", system.PronounPrivacy.Get(ctx, system.Pronouns)); o.Add("avatar_url", system.AvatarFor(ctx)); - o.Add("banner", system.DescriptionPrivacy.Get(ctx, system.BannerImage).TryGetCleanCdnUrl()); + o.Add("banner", system.BannerPrivacy.Get(ctx, system.BannerImage).TryGetCleanCdnUrl()); o.Add("color", system.Color); o.Add("created", system.Created.FormatExport()); @@ -100,6 +101,7 @@ public static class PKSystemExt p.Add("name_privacy", system.NamePrivacy.ToJsonString()); p.Add("avatar_privacy", system.AvatarPrivacy.ToJsonString()); p.Add("description_privacy", system.DescriptionPrivacy.ToJsonString()); + p.Add("banner_privacy", system.BannerPrivacy.ToJsonString()); p.Add("pronoun_privacy", system.PronounPrivacy.ToJsonString()); p.Add("member_list_privacy", system.MemberListPrivacy.ToJsonString()); p.Add("group_list_privacy", system.GroupListPrivacy.ToJsonString()); diff --git a/PluralKit.Core/Models/Patch/GroupPatch.cs b/PluralKit.Core/Models/Patch/GroupPatch.cs index de90e9fc..bc1b6867 100644 --- a/PluralKit.Core/Models/Patch/GroupPatch.cs +++ b/PluralKit.Core/Models/Patch/GroupPatch.cs @@ -17,6 +17,7 @@ public class GroupPatch: PatchObject public Partial NamePrivacy { get; set; } public Partial DescriptionPrivacy { get; set; } + public Partial BannerPrivacy { get; set; } public Partial IconPrivacy { get; set; } public Partial ListPrivacy { get; set; } public Partial MetadataPrivacy { get; set; } @@ -32,6 +33,7 @@ public class GroupPatch: PatchObject .With("color", Color) .With("name_privacy", NamePrivacy) .With("description_privacy", DescriptionPrivacy) + .With("banner_privacy", BannerPrivacy) .With("icon_privacy", IconPrivacy) .With("list_privacy", ListPrivacy) .With("metadata_privacy", MetadataPrivacy) @@ -84,6 +86,9 @@ public class GroupPatch: PatchObject if (privacy.ContainsKey("description_privacy")) patch.DescriptionPrivacy = patch.ParsePrivacy(privacy, "description_privacy"); + if (privacy.ContainsKey("banner_privacy")) + patch.BannerPrivacy = patch.ParsePrivacy(privacy, "banner_privacy"); + if (privacy.ContainsKey("icon_privacy")) patch.IconPrivacy = patch.ParsePrivacy(privacy, "icon_privacy"); @@ -122,6 +127,7 @@ public class GroupPatch: PatchObject if ( NamePrivacy.IsPresent || DescriptionPrivacy.IsPresent + || BannerPrivacy.IsPresent || IconPrivacy.IsPresent || ListPrivacy.IsPresent || MetadataPrivacy.IsPresent @@ -136,6 +142,9 @@ public class GroupPatch: PatchObject if (DescriptionPrivacy.IsPresent) p.Add("description_privacy", DescriptionPrivacy.Value.ToJsonString()); + if (BannerPrivacy.IsPresent) + p.Add("banner_privacy", BannerPrivacy.Value.ToJsonString()); + if (IconPrivacy.IsPresent) p.Add("icon_privacy", IconPrivacy.Value.ToJsonString()); diff --git a/PluralKit.Core/Models/Patch/MemberPatch.cs b/PluralKit.Core/Models/Patch/MemberPatch.cs index c4f40597..6ec122ad 100644 --- a/PluralKit.Core/Models/Patch/MemberPatch.cs +++ b/PluralKit.Core/Models/Patch/MemberPatch.cs @@ -27,6 +27,7 @@ public class MemberPatch: PatchObject public Partial Visibility { get; set; } public Partial NamePrivacy { get; set; } public Partial DescriptionPrivacy { get; set; } + public Partial BannerPrivacy { get; set; } public Partial PronounPrivacy { get; set; } public Partial BirthdayPrivacy { get; set; } public Partial AvatarPrivacy { get; set; } @@ -53,6 +54,7 @@ public class MemberPatch: PatchObject .With("member_visibility", Visibility) .With("name_privacy", NamePrivacy) .With("description_privacy", DescriptionPrivacy) + .With("banner_privacy", BannerPrivacy) .With("pronoun_privacy", PronounPrivacy) .With("birthday_privacy", BirthdayPrivacy) .With("avatar_privacy", AvatarPrivacy) @@ -140,6 +142,8 @@ public class MemberPatch: PatchObject if (o.ContainsKey("name_privacy")) patch.NamePrivacy = patch.ParsePrivacy(o, "name_privacy"); if (o.ContainsKey("description_privacy")) patch.DescriptionPrivacy = patch.ParsePrivacy(o, "description_privacy"); + if (o.ContainsKey("banner_privacy")) + patch.BannerPrivacy = patch.ParsePrivacy(o, "banner_privacy"); if (o.ContainsKey("avatar_privacy")) patch.AvatarPrivacy = patch.ParsePrivacy(o, "avatar_privacy"); if (o.ContainsKey("birthday_privacy")) @@ -172,6 +176,9 @@ public class MemberPatch: PatchObject if (privacy.ContainsKey("description_privacy")) patch.DescriptionPrivacy = patch.ParsePrivacy(privacy, "description_privacy"); + if (privacy.ContainsKey("banner_privacy")) + patch.BannerPrivacy = patch.ParsePrivacy(privacy, "banner_privacy"); + if (privacy.ContainsKey("avatar_privacy")) patch.AvatarPrivacy = patch.ParsePrivacy(privacy, "avatar_privacy"); @@ -233,6 +240,7 @@ public class MemberPatch: PatchObject Visibility.IsPresent || NamePrivacy.IsPresent || DescriptionPrivacy.IsPresent + || BannerPrivacy.IsPresent || PronounPrivacy.IsPresent || BirthdayPrivacy.IsPresent || AvatarPrivacy.IsPresent @@ -251,6 +259,9 @@ public class MemberPatch: PatchObject if (DescriptionPrivacy.IsPresent) p.Add("description_privacy", DescriptionPrivacy.Value.ToJsonString()); + if (BannerPrivacy.IsPresent) + p.Add("banner_privacy", BannerPrivacy.Value.ToJsonString()); + if (PronounPrivacy.IsPresent) p.Add("pronoun_privacy", PronounPrivacy.Value.ToJsonString()); diff --git a/PluralKit.Core/Models/Patch/SystemPatch.cs b/PluralKit.Core/Models/Patch/SystemPatch.cs index fd9c5b6d..ee28d936 100644 --- a/PluralKit.Core/Models/Patch/SystemPatch.cs +++ b/PluralKit.Core/Models/Patch/SystemPatch.cs @@ -21,6 +21,7 @@ public class SystemPatch: PatchObject public Partial NamePrivacy { get; set; } public Partial AvatarPrivacy { get; set; } public Partial DescriptionPrivacy { get; set; } + public Partial BannerPrivacy { get; set; } public Partial MemberListPrivacy { get; set; } public Partial GroupListPrivacy { get; set; } public Partial FrontPrivacy { get; set; } @@ -42,6 +43,7 @@ public class SystemPatch: PatchObject .With("name_privacy", NamePrivacy) .With("avatar_privacy", AvatarPrivacy) .With("description_privacy", DescriptionPrivacy) + .With("banner_privacy", BannerPrivacy) .With("member_list_privacy", MemberListPrivacy) .With("group_list_privacy", GroupListPrivacy) .With("front_privacy", FrontPrivacy) @@ -86,6 +88,8 @@ public class SystemPatch: PatchObject { if (o.ContainsKey("description_privacy")) patch.DescriptionPrivacy = patch.ParsePrivacy(o, "description_privacy"); + if (o.ContainsKey("banner_privacy")) + patch.BannerPrivacy = patch.ParsePrivacy(o, "banner_privacy"); if (o.ContainsKey("member_list_privacy")) patch.MemberListPrivacy = patch.ParsePrivacy(o, "member_list_privacy"); if (o.ContainsKey("front_privacy")) patch.FrontPrivacy = patch.ParsePrivacy(o, "front_privacy"); @@ -106,6 +110,9 @@ public class SystemPatch: PatchObject if (privacy.ContainsKey("description_privacy")) patch.DescriptionPrivacy = patch.ParsePrivacy(privacy, "description_privacy"); + if (privacy.ContainsKey("banner_privacy")) + patch.BannerPrivacy = patch.ParsePrivacy(privacy, "banner_privacy"); + if (privacy.ContainsKey("pronoun_privacy")) patch.PronounPrivacy = patch.ParsePrivacy(privacy, "pronoun_privacy"); @@ -150,6 +157,7 @@ public class SystemPatch: PatchObject NamePrivacy.IsPresent || AvatarPrivacy.IsPresent || DescriptionPrivacy.IsPresent + || BannerPrivacy.IsPresent || PronounPrivacy.IsPresent || MemberListPrivacy.IsPresent || GroupListPrivacy.IsPresent @@ -168,6 +176,9 @@ public class SystemPatch: PatchObject if (DescriptionPrivacy.IsPresent) p.Add("description_privacy", DescriptionPrivacy.Value.ToJsonString()); + if (BannerPrivacy.IsPresent) + p.Add("banner_privacy", BannerPrivacy.Value.ToJsonString()); + if (PronounPrivacy.IsPresent) p.Add("pronoun_privacy", PronounPrivacy.Value.ToJsonString()); diff --git a/PluralKit.Core/Models/Privacy/GroupPrivacySubject.cs b/PluralKit.Core/Models/Privacy/GroupPrivacySubject.cs index cb5c8358..035a0f09 100644 --- a/PluralKit.Core/Models/Privacy/GroupPrivacySubject.cs +++ b/PluralKit.Core/Models/Privacy/GroupPrivacySubject.cs @@ -4,6 +4,7 @@ public enum GroupPrivacySubject { Name, Description, + Banner, Icon, List, Metadata, @@ -19,6 +20,7 @@ public static class GroupPrivacyUtils { GroupPrivacySubject.Name => group.NamePrivacy = level, GroupPrivacySubject.Description => group.DescriptionPrivacy = level, + GroupPrivacySubject.Banner => group.BannerPrivacy = level, GroupPrivacySubject.Icon => group.IconPrivacy = level, GroupPrivacySubject.List => group.ListPrivacy = level, GroupPrivacySubject.Metadata => group.MetadataPrivacy = level, @@ -53,6 +55,12 @@ public static class GroupPrivacyUtils case "intro": subject = GroupPrivacySubject.Description; break; + case "banner": + case "b": + case "splash": + case "cover": + subject = GroupPrivacySubject.Banner; + break; case "avatar": case "pfp": case "pic": diff --git a/PluralKit.Core/Models/Privacy/MemberPrivacySubject.cs b/PluralKit.Core/Models/Privacy/MemberPrivacySubject.cs index acfdadf4..a15f1c0d 100644 --- a/PluralKit.Core/Models/Privacy/MemberPrivacySubject.cs +++ b/PluralKit.Core/Models/Privacy/MemberPrivacySubject.cs @@ -5,6 +5,7 @@ public enum MemberPrivacySubject Visibility, Name, Description, + Banner, Avatar, Birthday, Pronouns, @@ -21,6 +22,7 @@ public static class MemberPrivacyUtils { MemberPrivacySubject.Name => member.NamePrivacy = level, MemberPrivacySubject.Description => member.DescriptionPrivacy = level, + MemberPrivacySubject.Banner => member.BannerPrivacy = level, MemberPrivacySubject.Avatar => member.AvatarPrivacy = level, MemberPrivacySubject.Pronouns => member.PronounPrivacy = level, MemberPrivacySubject.Birthday => member.BirthdayPrivacy = level, @@ -57,6 +59,12 @@ public static class MemberPrivacyUtils case "intro": subject = MemberPrivacySubject.Description; break; + case "banner": + case "b": + case "splash": + case "cover": + subject = MemberPrivacySubject.Banner; + break; case "avatar": case "pfp": case "pic": diff --git a/PluralKit.Core/Models/Privacy/SystemPrivacySubject.cs b/PluralKit.Core/Models/Privacy/SystemPrivacySubject.cs index bd3bde32..33c21c54 100644 --- a/PluralKit.Core/Models/Privacy/SystemPrivacySubject.cs +++ b/PluralKit.Core/Models/Privacy/SystemPrivacySubject.cs @@ -5,6 +5,7 @@ public enum SystemPrivacySubject Name, Avatar, Description, + Banner, Pronouns, MemberList, GroupList, @@ -22,6 +23,7 @@ public static class SystemPrivacyUtils SystemPrivacySubject.Name => system.NamePrivacy = level, SystemPrivacySubject.Avatar => system.AvatarPrivacy = level, SystemPrivacySubject.Description => system.DescriptionPrivacy = level, + SystemPrivacySubject.Banner => system.BannerPrivacy = level, SystemPrivacySubject.Pronouns => system.PronounPrivacy = level, SystemPrivacySubject.Front => system.FrontPrivacy = level, SystemPrivacySubject.FrontHistory => system.FrontHistoryPrivacy = level, @@ -63,6 +65,12 @@ public static class SystemPrivacyUtils case "intro": subject = SystemPrivacySubject.Description; break; + case "banner": + case "b": + case "splash": + case "cover": + subject = SystemPrivacySubject.Banner; + break; case "pronouns": case "pronoun": case "prns": diff --git a/dashboard/src/api/types.ts b/dashboard/src/api/types.ts index 04a92473..8a12a984 100644 --- a/dashboard/src/api/types.ts +++ b/dashboard/src/api/types.ts @@ -6,7 +6,8 @@ export interface SystemPrivacy { group_list_privacy?: string, pronoun_privacy?: string, avatar_privacy?: string, - name_privacy?: string + name_privacy?: string, + banner_privacy?: string, } export interface System { @@ -43,7 +44,8 @@ export interface MemberPrivacy { pronoun_privacy?: string, avatar_privacy?: string, metadata_privacy?: string, - proxy_privacy?: string + proxy_privacy?: string, + banner_privacy?: string, } interface proxytag { @@ -77,7 +79,8 @@ export interface GroupPrivacy { list_privacy?: string, visibility?: string, name_privacy?: string, - metadata_privacy?: string + metadata_privacy?: string, + banner_privacy?: string, } export interface Group { diff --git a/dashboard/src/components/group/NewGroup.svelte b/dashboard/src/components/group/NewGroup.svelte index 7905c1cf..e952817c 100644 --- a/dashboard/src/components/group/NewGroup.svelte +++ b/dashboard/src/components/group/NewGroup.svelte @@ -21,7 +21,8 @@ list_privacy: "public", icon_privacy: "public", name_privacy: "public", - visibility: "public" + visibility: "public", + banner_privacy: "public", } } @@ -162,6 +163,13 @@ + + + + + + +
{/if} diff --git a/dashboard/src/components/group/Privacy.svelte b/dashboard/src/components/group/Privacy.svelte index ea38685b..ed81031c 100644 --- a/dashboard/src/components/group/Privacy.svelte +++ b/dashboard/src/components/group/Privacy.svelte @@ -33,6 +33,7 @@ list_privacy: "Member list", metadata_privacy: "Metadata", visibility: "Visibility", + banner_privacy: "Banner", }; async function submit() { diff --git a/dashboard/src/components/member/NewMember.svelte b/dashboard/src/components/member/NewMember.svelte index 1079973c..855f9589 100644 --- a/dashboard/src/components/member/NewMember.svelte +++ b/dashboard/src/components/member/NewMember.svelte @@ -25,7 +25,8 @@ birthday_privacy: "public", name_privacy: "public", avatar_privacy: "public", - proxy_privacy: "public" + proxy_privacy: "public", + banner_privacy: "public", }, proxy_tags: [ { @@ -230,6 +231,13 @@ + + + + + + + {/if} {#if proxyTagMode} diff --git a/dashboard/src/components/member/Privacy.svelte b/dashboard/src/components/member/Privacy.svelte index 24320159..79dcdb21 100644 --- a/dashboard/src/components/member/Privacy.svelte +++ b/dashboard/src/components/member/Privacy.svelte @@ -34,7 +34,8 @@ name_privacy: "Name", pronoun_privacy: "Pronouns", visibility: "Visibility", - proxy_privacy: "Proxy Tags" + proxy_privacy: "Proxy Tags", + banner_privacy: "Banner", }; async function submit() { diff --git a/dashboard/src/components/system/Privacy.svelte b/dashboard/src/components/system/Privacy.svelte index a0687940..e575e787 100644 --- a/dashboard/src/components/system/Privacy.svelte +++ b/dashboard/src/components/system/Privacy.svelte @@ -19,7 +19,8 @@ group_list_privacy: "Group list", pronoun_privacy: "Pronouns", avatar_privacy: "Avatar", - name_privacy: "Name" + name_privacy: "Name", + banner_privacy: "Banner", }; diff --git a/dashboard/src/components/system/PrivacyEdit.svelte b/dashboard/src/components/system/PrivacyEdit.svelte index 5e010e8e..2b908847 100644 --- a/dashboard/src/components/system/PrivacyEdit.svelte +++ b/dashboard/src/components/system/PrivacyEdit.svelte @@ -27,7 +27,8 @@ group_list_privacy: "Group list", pronoun_privacy: "Pronouns", avatar_privacy: "Avatar", - name_privacy: "Name" + name_privacy: "Name", + banner_privacy: "Banner", }; async function submit() { diff --git a/dashboard/src/routes/Dash/System/BulkGroupPrivacy.svelte b/dashboard/src/routes/Dash/System/BulkGroupPrivacy.svelte index 3546d1dc..8cc8858b 100644 --- a/dashboard/src/routes/Dash/System/BulkGroupPrivacy.svelte +++ b/dashboard/src/routes/Dash/System/BulkGroupPrivacy.svelte @@ -23,6 +23,7 @@ icon_privacy: "no change", visibility: "no change", metadata_privacy: "no change", + banner_privacy: "no change", }; const privacyNames: { [P in keyof GroupPrivacy]-?: string; } = { @@ -32,6 +33,7 @@ list_privacy: "Member list", metadata_privacy: "Metadata", visibility: "Visibility", + banner_privacy: "Banner", }; async function submit() { diff --git a/dashboard/src/routes/Dash/System/BulkMemberPrivacy.svelte b/dashboard/src/routes/Dash/System/BulkMemberPrivacy.svelte index d6b7dddb..634628e1 100644 --- a/dashboard/src/routes/Dash/System/BulkMemberPrivacy.svelte +++ b/dashboard/src/routes/Dash/System/BulkMemberPrivacy.svelte @@ -24,6 +24,7 @@ visibility: "no change", metadata_privacy: "no change", proxy_privacy: "no change", + banner_privacy: "no change", }; const privacyNames: { [P in keyof MemberPrivacy]-?: string; } = { @@ -34,7 +35,8 @@ name_privacy: "Name", pronoun_privacy: "Pronouns", visibility: "Visibility", - proxy_privacy: "Proxy Tags" + proxy_privacy: "Proxy Tags", + banner_privacy: "Banner", }; async function submit() { diff --git a/dashboard/src/stores.ts b/dashboard/src/stores.ts index 7f8bf749..f10bd628 100644 --- a/dashboard/src/stores.ts +++ b/dashboard/src/stores.ts @@ -18,7 +18,8 @@ export const loggedIn = writable(false); member_list_privacy: null, front_privacy: null, front_history_privacy: null, - group_list_privacy: null + group_list_privacy: null, + banner_privacy: null, } }); */ diff --git a/docs/content/user-guide.md b/docs/content/user-guide.md index 04488b7b..7813cf20 100644 --- a/docs/content/user-guide.md +++ b/docs/content/user-guide.md @@ -667,6 +667,7 @@ There are various reasons you may not want information about your system or your At the moment, there are a few aspects of system privacy that can be configured. - System description +- System banner - System pronouns - Member list - Group list @@ -683,6 +684,7 @@ To update your system privacy settings, use the following commands: * `subject` is one of: * `description` + * `banner` * `pronouns` * `list` * `groups` @@ -707,6 +709,7 @@ There are also some options for configuring member privacy: - Name - Description +- Banner - Avatar - Birthday - Pronouns @@ -727,6 +730,7 @@ To update a member's privacy, you can use the command: * `subject` is one of: * `name` * `description` + * `banner` * `avatar` * `birthday` * `pronouns`