mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
feat(api): try harder at checking whether user is in guild
This commit is contained in:
parent
539fc82342
commit
6fea94f990
4 changed files with 45 additions and 11 deletions
|
|
@ -7,4 +7,5 @@ public class ApiConfig
|
|||
public string? ClientSecret { get; set; }
|
||||
public bool TrustAuth { get; set; } = false;
|
||||
public string? AvatarServiceUrl { get; set; }
|
||||
public bool SearchGuildSettings = false;
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ public class DiscordControllerV2: PKControllerBase
|
|||
if (ContextFor(system) != LookupContext.ByOwner)
|
||||
throw Errors.GenericMissingPermissions;
|
||||
|
||||
var settings = await _repo.GetSystemGuild(guild_id, system.Id, false);
|
||||
var settings = await _repo.GetSystemGuild(guild_id, system.Id, false, _config.SearchGuildSettings);
|
||||
if (settings == null)
|
||||
throw Errors.SystemGuildNotFound;
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ public class DiscordControllerV2: PKControllerBase
|
|||
if (ContextFor(system) != LookupContext.ByOwner)
|
||||
throw Errors.GenericMissingPermissions;
|
||||
|
||||
var settings = await _repo.GetSystemGuild(guild_id, system.Id, false);
|
||||
var settings = await _repo.GetSystemGuild(guild_id, system.Id, false, _config.SearchGuildSettings);
|
||||
if (settings == null)
|
||||
throw Errors.SystemGuildNotFound;
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ public class DiscordControllerV2: PKControllerBase
|
|||
if (member.System != system.Id)
|
||||
throw Errors.NotOwnMemberError;
|
||||
|
||||
var settings = await _repo.GetMemberGuild(guild_id, member.Id, false);
|
||||
var settings = await _repo.GetMemberGuild(guild_id, member.Id, false, _config.SearchGuildSettings ? system.Id : null);
|
||||
if (settings == null)
|
||||
throw Errors.MemberGuildNotFound;
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ public class DiscordControllerV2: PKControllerBase
|
|||
if (member.System != system.Id)
|
||||
throw Errors.NotOwnMemberError;
|
||||
|
||||
var settings = await _repo.GetMemberGuild(guild_id, member.Id, false);
|
||||
var settings = await _repo.GetMemberGuild(guild_id, member.Id, false, _config.SearchGuildSettings ? system.Id : null);
|
||||
if (settings == null)
|
||||
throw Errors.MemberGuildNotFound;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue