From 32b41de331ab7d8ef4ee6d0004cb154eef8aae35 Mon Sep 17 00:00:00 2001 From: spiral Date: Sun, 24 Apr 2022 14:39:05 -0400 Subject: [PATCH] fix: don't try to parse `privacy` from v1 JSON model as v2 privacy model --- PluralKit.Core/Models/Patch/MemberPatch.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/PluralKit.Core/Models/Patch/MemberPatch.cs b/PluralKit.Core/Models/Patch/MemberPatch.cs index 5cfcbaac..da02557d 100644 --- a/PluralKit.Core/Models/Patch/MemberPatch.cs +++ b/PluralKit.Core/Models/Patch/MemberPatch.cs @@ -111,7 +111,7 @@ public class MemberPatch: PatchObject if (isImport) { - // legacy: used in old export files and APIv1 + // legacy: used in old export files if (o.ContainsKey("prefix") || o.ContainsKey("suffix") && !o.ContainsKey("proxy_tags")) patch.ProxyTags = new[] { new ProxyTag(o.Value("prefix"), o.Value("suffix")) }; @@ -125,7 +125,6 @@ public class MemberPatch: PatchObject patch.BirthdayPrivacy = patch.ParsePrivacy(o, "birthday_privacy"); if (o.ContainsKey("pronoun_privacy")) patch.PronounPrivacy = patch.ParsePrivacy(o, "pronoun_privacy"); - // if (o.ContainsKey("color_privacy")) member.ColorPrivacy = o.ParsePrivacy("member"); if (o.ContainsKey("metadata_privacy")) patch.MetadataPrivacy = patch.ParsePrivacy(o, "metadata_privacy"); } @@ -137,7 +136,7 @@ public class MemberPatch: PatchObject .Where(p => p.Valid) .ToArray(); - if (o.ContainsKey("privacy") && o["privacy"].Type != JTokenType.Null) + if (o.ContainsKey("privacy") && o["privacy"].Type == JTokenType.Object) { var privacy = o.Value("privacy");