mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat(api): throw error when patching autoproxy member with autoproxy mode set to latch
This commit is contained in:
parent
59f0a5ec3e
commit
7bf6c2064f
2 changed files with 15 additions and 0 deletions
|
|
@ -68,6 +68,7 @@ public class DiscordControllerV2: PKControllerBase
|
|||
|
||||
// this is less than great, but at least it's legible
|
||||
if (patch.AutoproxyMember.Value == null)
|
||||
{
|
||||
if (patch.AutoproxyMode.IsPresent)
|
||||
{
|
||||
if (patch.AutoproxyMode.Value == AutoproxyMode.Member)
|
||||
|
|
@ -77,6 +78,19 @@ public class DiscordControllerV2: PKControllerBase
|
|||
{
|
||||
throw Errors.MissingAutoproxyMember;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (patch.AutoproxyMode.IsPresent)
|
||||
{
|
||||
if (patch.AutoproxyMode.Value == AutoproxyMode.Latch)
|
||||
throw Errors.PatchLatchMemberError;
|
||||
}
|
||||
else if (settings.AutoproxyMode == AutoproxyMode.Latch)
|
||||
{
|
||||
throw Errors.PatchLatchMemberError;
|
||||
}
|
||||
}
|
||||
|
||||
var newSettings = await _repo.UpdateSystemGuild(system.Id, guild_id, patch);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue