feat: don't hide information from own system when directly requested

in lists, pk;m <ref> <prop>, etc
This commit is contained in:
spiral
2021-12-07 01:32:29 -05:00
parent 56e266190f
commit 9926bbbd8b
10 changed files with 38 additions and 31 deletions

View File

@@ -63,14 +63,13 @@ public class MemberEdit
public async Task Description(Context ctx, PKMember target)
{
ctx.CheckSystemPrivacy(target.System, target.DescriptionPrivacy);
var noDescriptionSetMessage = "This member does not have a description set.";
if (ctx.System?.Id == target.System)
noDescriptionSetMessage +=
$" To set one, type `pk;member {target.Reference()} description <description>`.";
if (!target.DescriptionPrivacy.CanAccess(ctx.LookupContextFor(target.System)))
throw target.System == ctx.System?.Id ? Errors.LookupHidden : Errors.LookupNotAllowed;
if (ctx.MatchRaw())
{
if (target.Description == null)
@@ -124,8 +123,7 @@ public class MemberEdit
if (ctx.System?.Id == target.System)
noPronounsSetMessage += $"To set some, type `pk;member {target.Reference()} pronouns <pronouns>`.";
if (!target.PronounPrivacy.CanAccess(ctx.LookupContextFor(target.System)))
throw target.System == ctx.System?.Id ? Errors.LookupHidden : Errors.LookupNotAllowed;
ctx.CheckSystemPrivacy(target.System, target.PronounPrivacy);
if (ctx.MatchRaw())
{
@@ -292,8 +290,7 @@ public class MemberEdit
}
else if (!ctx.HasNext())
{
if (!target.BirthdayPrivacy.CanAccess(ctx.LookupContextFor(target.System)))
throw target.System == ctx.System?.Id ? Errors.LookupHidden : Errors.LookupNotAllowed;
ctx.CheckSystemPrivacy(target.System, target.BirthdayPrivacy);
if (target.Birthday == null)
await ctx.Reply("This member does not have a birthdate set."