From 42905ba3bdd9ab8b7792f603c132ebc6262135c9 Mon Sep 17 00:00:00 2001 From: spiral Date: Sat, 31 Dec 2022 02:22:38 +0000 Subject: [PATCH] fix(api): fix autoproxy mode check when patching member --- PluralKit.API/Controllers/v2/AutoproxyControllerV2.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PluralKit.API/Controllers/v2/AutoproxyControllerV2.cs b/PluralKit.API/Controllers/v2/AutoproxyControllerV2.cs index 25227322..d72c6d78 100644 --- a/PluralKit.API/Controllers/v2/AutoproxyControllerV2.cs +++ b/PluralKit.API/Controllers/v2/AutoproxyControllerV2.cs @@ -68,7 +68,10 @@ public class AutoproxyControllerV2: PKControllerBase patch.AssertIsValid(); if (updateMember && member == null) patch.Errors.Add(new("autoproxy_member", "Member not found.")); - if (updateMember && ((patch.AutoproxyMode.IsPresent && patch.AutoproxyMode.Value == AutoproxyMode.Latch) || oldData.AutoproxyMode == AutoproxyMode.Latch)) + if (updateMember && !( + (patch.AutoproxyMode.IsPresent && patch.AutoproxyMode.Value == AutoproxyMode.Member) + || (!patch.AutoproxyMode.IsPresent && oldData.AutoproxyMode == AutoproxyMode.Member)) + ) patch.Errors.Add(new("autoproxy_member", "Cannot update autoproxy member if autoproxy mode is set to latch")); if (patch.Errors.Count > 0) throw new ModelParseError(patch.Errors);