mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-15 18:20:11 +00:00
fix: do not reveal if displayname is set if name is private
This commit is contained in:
parent
bba86fe98b
commit
dbe7560059
1 changed files with 7 additions and 7 deletions
|
|
@ -388,7 +388,7 @@ public class MemberEdit
|
||||||
|
|
||||||
eb.Field(new Embed.Field("Display name", (target.DisplayName != null && showDisplayName)
|
eb.Field(new Embed.Field("Display name", (target.DisplayName != null && showDisplayName)
|
||||||
? boldIf(target.DisplayName, memberGuildConfig?.DisplayName == null)
|
? boldIf(target.DisplayName, memberGuildConfig?.DisplayName == null)
|
||||||
: "*(none)*"
|
: "*(no displayname set or name is private)*"
|
||||||
));
|
));
|
||||||
|
|
||||||
if (ctx.Guild != null)
|
if (ctx.Guild != null)
|
||||||
|
|
@ -417,18 +417,18 @@ public class MemberEdit
|
||||||
await ctx.Reply(successStr);
|
await ctx.Reply(successStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
var noDisplayNameSetMessage = "This member does not have a display name set.";
|
var isOwner = ctx.System?.Id == target.System;
|
||||||
if (ctx.System?.Id == target.System)
|
var noDisplayNameSetMessage = $"This member does not have a display name set{(isOwner ? "" : " or name is private")}."
|
||||||
noDisplayNameSetMessage +=
|
+ (isOwner ? $" To set one, type `{ctx.DefaultPrefix}member {target.Reference(ctx)} displayname <display name>`." : "");
|
||||||
$" To set one, type `{ctx.DefaultPrefix}member {target.Reference(ctx)} displayname <display name>`.";
|
|
||||||
|
|
||||||
// No perms check, display name isn't covered by member privacy
|
// Whether displayname is shown or not should depend on if member name privacy is set.
|
||||||
|
// If name privacy is on then displayname should look like name.
|
||||||
|
|
||||||
var format = ctx.MatchFormat();
|
var format = ctx.MatchFormat();
|
||||||
|
|
||||||
// if what's next is "raw"/"plaintext" we need to check for null
|
// if what's next is "raw"/"plaintext" we need to check for null
|
||||||
if (format != ReplyFormat.Standard)
|
if (format != ReplyFormat.Standard)
|
||||||
if (target.DisplayName == null)
|
if (target.DisplayName == null || !target.NamePrivacy.CanAccess(ctx.DirectLookupContextFor(target.System)))
|
||||||
{
|
{
|
||||||
await ctx.Reply(noDisplayNameSetMessage);
|
await ctx.Reply(noDisplayNameSetMessage);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue