diff --git a/PluralKit.API/Controllers/v1/JsonModelExt.cs b/PluralKit.API/Controllers/v1/JsonModelExt.cs index f4c7b34f..9cbb7a00 100644 --- a/PluralKit.API/Controllers/v1/JsonModelExt.cs +++ b/PluralKit.API/Controllers/v1/JsonModelExt.cs @@ -45,7 +45,8 @@ namespace PluralKit.API var o = new JObject(); o.Add("id", member.Hid); o.Add("name", member.NamePrivacy.CanAccess(ctx) ? member.Name : member.DisplayName ?? member.Name); - o.Add("color", member.ColorPrivacy.CanAccess(ctx) ? member.Color : null); + // o.Add("color", member.ColorPrivacy.CanAccess(ctx) ? member.Color : null); + o.Add("color", member.Color); o.Add("display_name", member.NamePrivacy.CanAccess(ctx) ? member.DisplayName : null); o.Add("birthday", member.BirthdayPrivacy.CanAccess(ctx) && member.Birthday.HasValue ? DateTimeFormats.DateExportFormat.Format(member.Birthday.Value) : null); o.Add("pronouns", member.PronounPrivacy.CanAccess(ctx) ? member.Pronouns : null); @@ -66,7 +67,7 @@ namespace PluralKit.API o.Add("description_privacy", ctx == LookupContext.ByOwner ? (member.DescriptionPrivacy == PrivacyLevel.Private ? "private" : "public") : null); o.Add("birthday_privacy", ctx == LookupContext.ByOwner ? (member.BirthdayPrivacy == PrivacyLevel.Private ? "private" : "public") : null); o.Add("pronoun_privacy", ctx == LookupContext.ByOwner ? (member.PronounPrivacy == PrivacyLevel.Private ? "private" : "public") : null); - o.Add("color_privacy", ctx == LookupContext.ByOwner ? (member.ColorPrivacy == PrivacyLevel.Private ? "private" : "public") : null); + // o.Add("color_privacy", ctx == LookupContext.ByOwner ? (member.ColorPrivacy == PrivacyLevel.Private ? "private" : "public") : null); o.Add("metadata_privacy", ctx == LookupContext.ByOwner ? (member.MetadataPrivacy == PrivacyLevel.Private ? "private" : "public") : null); if(member.MetadataPrivacy.CanAccess(ctx)) @@ -124,7 +125,7 @@ namespace PluralKit.API member.DescriptionPrivacy = plevel; member.BirthdayPrivacy = plevel; member.PronounPrivacy = plevel; - member.ColorPrivacy = plevel; + // member.ColorPrivacy = plevel; member.MetadataPrivacy = plevel; } else @@ -134,7 +135,7 @@ namespace PluralKit.API if (o.ContainsKey("description_privacy")) member.DescriptionPrivacy = o.Value("description_privacy").ParsePrivacy("member"); if (o.ContainsKey("birthday_privacy")) member.BirthdayPrivacy = o.Value("birthday_privacy").ParsePrivacy("member"); if (o.ContainsKey("pronoun_privacy")) member.PronounPrivacy = o.Value("pronoun_privacy").ParsePrivacy("member"); - if (o.ContainsKey("color_privacy")) member.ColorPrivacy = o.Value("color_privacy").ParsePrivacy("member"); + // if (o.ContainsKey("color_privacy")) member.ColorPrivacy = o.Value("color_privacy").ParsePrivacy("member"); if (o.ContainsKey("metadata_privacy")) member.MetadataPrivacy = o.Value("metadata_privacy").ParsePrivacy("member"); } } diff --git a/PluralKit.Bot/Commands/CommandTree.cs b/PluralKit.Bot/Commands/CommandTree.cs index 909ca4f3..ed73391e 100644 --- a/PluralKit.Bot/Commands/CommandTree.cs +++ b/PluralKit.Bot/Commands/CommandTree.cs @@ -42,7 +42,7 @@ namespace PluralKit.Bot public static Command MemberServerName = new Command("member servername", "member servername [server name]", "Changes a member's display name in the current server"); public static Command MemberKeepProxy = new Command("member keepproxy", "member keepproxy [on|off]", "Sets whether to include a member's proxy tags when proxying"); public static Command MemberRandom = new Command("random", "random", "Looks up a random member from your system"); - public static Command MemberPrivacy = new Command("member privacy", "member privacy ", "Changes a members's privacy settings"); + public static Command MemberPrivacy = new Command("member privacy", "member privacy ", "Changes a members's privacy settings"); public static Command Switch = new Command("switch", "switch [member 2] [member 3...]", "Registers a switch"); public static Command SwitchOut = new Command("switch out", "switch out", "Registers a switch with no members"); public static Command SwitchMove = new Command("switch move", "switch move ", "Moves the latest switch in time"); diff --git a/PluralKit.Bot/Commands/MemberEdit.cs b/PluralKit.Bot/Commands/MemberEdit.cs index 8e8fc642..7fd9d887 100644 --- a/PluralKit.Bot/Commands/MemberEdit.cs +++ b/PluralKit.Bot/Commands/MemberEdit.cs @@ -153,8 +153,8 @@ namespace PluralKit.Bot } else if (!ctx.HasNext()) { - if (!target.ColorPrivacy.CanAccess(ctx.LookupContextFor(target.System))) - throw Errors.LookupNotAllowed; + // if (!target.ColorPrivacy.CanAccess(ctx.LookupContextFor(target.System))) + // throw Errors.LookupNotAllowed; if (target.Color == null) if (ctx.System?.Id == target.System) @@ -381,10 +381,10 @@ namespace PluralKit.Bot .AddField("Description", PrivacyLevelString(target.DescriptionPrivacy)) .AddField("Birthday", PrivacyLevelString(target.BirthdayPrivacy)) .AddField("Pronouns", PrivacyLevelString(target.PronounPrivacy)) - .AddField("Color", PrivacyLevelString(target.ColorPrivacy)) + // .AddField("Color", PrivacyLevelString(target.ColorPrivacy)) .AddField("Meta (message count, last front, last message)", PrivacyLevelString(target.MetadataPrivacy)) .AddField("Visibility", PrivacyLevelString(target.MemberVisibility)) - .WithDescription("To edit privacy settings, use the command:\n`pk;member privacy `\n\n- `subject` is one of `name`, `description`, `birthday`, `pronouns`, `color`, `created`, `messages`, `visibility`, or `all`\n- `level` is either `public` or `private`."); + .WithDescription("To edit privacy settings, use the command:\n`pk;member privacy `\n\n- `subject` is one of `name`, `description`, `birthday`, `pronouns`, `created`, `messages`, `visibility`, or `all`\n- `level` is either `public` or `private`."); await ctx.Reply(embed: eb.Build()); return; } @@ -413,7 +413,7 @@ namespace PluralKit.Bot } string levelStr, levelExplanation, subjectStr; - var subjectList = "`name`, `description`, `birthday`, `pronouns`, `color`, `metadata`, `visibility`, or `all`"; + var subjectList = "`name`, `description`, `birthday`, `pronouns`, `metadata`, `visibility`, or `all`"; if(ctx.Match("name")) { subjectStr = "name"; @@ -434,11 +434,11 @@ namespace PluralKit.Bot subjectStr = "pronouns"; target.PronounPrivacy = PopPrivacyLevel("pronouns", out levelStr, out levelExplanation); } - else if(ctx.Match("color","colour")) + /*else if(ctx.Match("color","colour")) { subjectStr = "color"; target.ColorPrivacy = PopPrivacyLevel("color", out levelStr, out levelExplanation); - } + }*/ else if(ctx.Match("meta","metadata")) { subjectStr = "metadata (date created, message count, last fronted, and last message)"; @@ -474,7 +474,7 @@ namespace PluralKit.Bot target.DescriptionPrivacy = level; target.BirthdayPrivacy = level; target.PronounPrivacy = level; - target.ColorPrivacy = level; + // target.ColorPrivacy = level; target.MetadataPrivacy = level; } else diff --git a/PluralKit.Bot/Services/EmbedService.cs b/PluralKit.Bot/Services/EmbedService.cs index fdddb0cc..00f44dc7 100644 --- a/PluralKit.Bot/Services/EmbedService.cs +++ b/PluralKit.Bot/Services/EmbedService.cs @@ -110,7 +110,8 @@ namespace PluralKit.Bot { var eb = new DiscordEmbedBuilder() // TODO: add URL of website when that's up .WithAuthor(name, iconUrl: DiscordUtils.WorkaroundForUrlBug(avatar)) - .WithColor(member.ColorPrivacy.CanAccess(ctx) ? color : DiscordUtils.Gray) + // .WithColor(member.ColorPrivacy.CanAccess(ctx) ? color : DiscordUtils.Gray) + .WithColor(color) .WithFooter($"System ID: {system.Hid} | Member ID: {member.Hid} {(member.MetadataPrivacy.CanAccess(ctx) ? $"| Created on {DateTimeFormats.ZonedDateTimeFormat.Format(member.Created.InZone(system.Zone))}":"")}"); var description = ""; @@ -133,7 +134,8 @@ namespace PluralKit.Bot { // --- For when this gets added to the member object itself or however they get added // if (member.LastMessage != null && member.MetadataPrivacy.CanAccess(ctx)) eb.AddField("Last message:" FormatTimestamp(DiscordUtils.SnowflakeToInstant(m.LastMessage.Value))); // if (member.LastSwitchTime != null && m.MetadataPrivacy.CanAccess(ctx)) eb.AddField("Last switched in:", FormatTimestamp(member.LastSwitchTime.Value)); - if (!member.Color.EmptyOrNull() && member.ColorPrivacy.CanAccess(ctx)) eb.AddField("Color", $"#{member.Color}", true); + // if (!member.Color.EmptyOrNull() && member.ColorPrivacy.CanAccess(ctx)) eb.AddField("Color", $"#{member.Color}", true); + if (!member.Color.EmptyOrNull()) eb.AddField("Color", $"#{member.Color}", true); if (!member.Description.EmptyOrNull() && member.DescriptionPrivacy.CanAccess(ctx)) eb.AddField("Description", member.Description.NormalizeLineEndSpacing(), false); diff --git a/PluralKit.Core/Database/Migrations/8.sql b/PluralKit.Core/Database/Migrations/8.sql index 28439e5f..366a9309 100644 --- a/PluralKit.Core/Database/Migrations/8.sql +++ b/PluralKit.Core/Database/Migrations/8.sql @@ -5,7 +5,7 @@ alter table members add column name_privacy integer check (name_privacy in (1, 2 alter table members add column birthday_privacy integer check (birthday_privacy in (1, 2)) not null default 1; alter table members add column pronoun_privacy integer check (pronoun_privacy in (1, 2)) not null default 1; alter table members add column metadata_privacy integer check (metadata_privacy in (1, 2)) not null default 1; -alter table members add column color_privacy integer check (color_privacy in (1, 2)) not null default 1; +-- alter table members add column color_privacy integer check (color_privacy in (1, 2)) not null default 1; -- Transfer existing settings -- update members set description_privacy = member_privacy; @@ -13,7 +13,7 @@ update members set name_privacy = member_privacy; update members set birthday_privacy = member_privacy; update members set pronoun_privacy = member_privacy; update members set metadata_privacy = member_privacy; -update members set color_privacy = member_privacy; +-- update members set color_privacy = member_privacy; -- Rename member_privacy to member_visibility -- alter table members rename column member_privacy to member_visibility; diff --git a/PluralKit.Core/Models/PKMember.cs b/PluralKit.Core/Models/PKMember.cs index 18ba7947..01eb004c 100644 --- a/PluralKit.Core/Models/PKMember.cs +++ b/PluralKit.Core/Models/PKMember.cs @@ -29,8 +29,8 @@ namespace PluralKit.Core { public PrivacyLevel BirthdayPrivacy { get; set; } public PrivacyLevel PronounPrivacy { get; set; } public PrivacyLevel MetadataPrivacy { get; set; } - public PrivacyLevel ColorPrivacy { get; set; } - + // public PrivacyLevel ColorPrivacy { get; set; } + /// Returns a formatted string representing the member's birthday, taking into account that a year of "0001" or "0004" is hidden /// Before Feb 10 2020, the sentinel year was 0001, now it is 0004. [JsonIgnore] public string BirthdayString diff --git a/PluralKit.Core/Services/PostgresDataStore.cs b/PluralKit.Core/Services/PostgresDataStore.cs index a0783b59..cf3490c7 100644 --- a/PluralKit.Core/Services/PostgresDataStore.cs +++ b/PluralKit.Core/Services/PostgresDataStore.cs @@ -150,7 +150,7 @@ namespace PluralKit.Core { public async Task SaveMember(PKMember member) { using (var conn = await _conn.Obtain()) - await conn.ExecuteAsync("update members set name = @Name, display_name = @DisplayName, description = @Description, color = @Color, avatar_url = @AvatarUrl, birthday = @Birthday, pronouns = @Pronouns, proxy_tags = @ProxyTags, keep_proxy = @KeepProxy, member_visibility = @MemberVisibility, description_privacy = @DescriptionPrivacy, name_privacy = @NamePrivacy, birthday_privacy = @BirthdayPrivacy, pronoun_privacy = @PronounPrivacy, metadata_privacy = @MetadataPrivacy, color_privacy = @ColorPrivacy where id = @Id", member); + await conn.ExecuteAsync("update members set name = @Name, display_name = @DisplayName, description = @Description, color = @Color, avatar_url = @AvatarUrl, birthday = @Birthday, pronouns = @Pronouns, proxy_tags = @ProxyTags, keep_proxy = @KeepProxy, member_visibility = @MemberVisibility, description_privacy = @DescriptionPrivacy, name_privacy = @NamePrivacy, birthday_privacy = @BirthdayPrivacy, pronoun_privacy = @PronounPrivacy, metadata_privacy = @MetadataPrivacy where id = @Id", member); _logger.Information("Updated member {@Member}", member); }