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

@@ -41,9 +41,12 @@ public class MemberAvatar
private async Task AvatarShow(AvatarLocation location, Context ctx, PKMember target,
MemberGuildSettings? guildData)
{
// todo: this privacy code is really confusing
// for now, we skip privacy flag/config parsing for this, but it would be good to fix that at some point
var currentValue = location == AvatarLocation.Member ? target.AvatarUrl : guildData?.AvatarUrl;
var canAccess = location != AvatarLocation.Member ||
target.AvatarPrivacy.CanAccess(ctx.LookupContextFor(target.System));
target.AvatarPrivacy.CanAccess(ctx.DirectLookupContextFor(target.System));
if (string.IsNullOrEmpty(currentValue) || !canAccess)
{
if (location == AvatarLocation.Member)