mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-08 14:57:54 +00:00
feat: don't hide information from own system when directly requested
in lists, pk;m <ref> <prop>, etc
This commit is contained in:
parent
56e266190f
commit
9926bbbd8b
10 changed files with 38 additions and 31 deletions
|
|
@ -21,10 +21,10 @@ public static class ContextChecksExt
|
|||
throw new PKError("This command must be run in a DM.");
|
||||
}
|
||||
|
||||
public static Context CheckSystemPrivacy(this Context ctx, PKSystem target, PrivacyLevel level)
|
||||
public static Context CheckSystemPrivacy(this Context ctx, SystemId target, PrivacyLevel level)
|
||||
{
|
||||
if (level.CanAccess(ctx.LookupContextFor(target.Id))) return ctx;
|
||||
throw target.Id == ctx.System?.Id ? Errors.LookupHidden : Errors.LookupNotAllowed;
|
||||
if (level.CanAccess(ctx.DirectLookupContextFor(target))) return ctx;
|
||||
throw Errors.LookupNotAllowed;
|
||||
}
|
||||
|
||||
public static Context CheckOwnSystem(this Context ctx, PKSystem system)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue