feat: config setting to default show/hide private info

This commit is contained in:
spiral
2021-12-06 04:01:42 -05:00
parent 455830a2b5
commit 32bea51e18
14 changed files with 71 additions and 17 deletions

View File

@@ -72,6 +72,13 @@ public class Config
"disabled"
));
items.Add(new(
"show private",
"Whether private information is shown to linked accounts by default",
ctx.Config.ShowPrivateInfo.ToString().ToLower(),
"true"
));
items.Add(new(
"Member limit",
"The maximum number of registered members for your system",
@@ -345,7 +352,7 @@ public class Config
if (!ctx.HasNext())
{
if (ctx.Config.MemberDefaultPrivate) { await ctx.Reply("Newly created groups will currently have their privacy settings set to private. To change this, type `pk;config private group off`"); }
if (ctx.Config.GroupDefaultPrivate) { await ctx.Reply("Newly created groups will currently have their privacy settings set to private. To change this, type `pk;config private group off`"); }
else { await ctx.Reply("Newly created groups will currently have their privacy settings set to public. To automatically set new groups' privacy settings to private, type `pk;config private group on`"); }
}
else
@@ -364,4 +371,30 @@ public class Config
}
}
}
public async Task ShowPrivateInfo(Context ctx)
{
ctx.CheckSystem();
if (!ctx.HasNext())
{
if (ctx.Config.ShowPrivateInfo) await ctx.Reply("Private information is currently **shown** when looking up your own info. Use the `-public` flag to hide it.");
else await ctx.Reply("Private information is currently **hidden** when looking up your own info. Use the `-private` flag to show it.");
return;
}
if (ctx.Match("true"))
{
await _repo.UpdateSystemConfig(ctx.System.Id, new() { ShowPrivateInfo = true });
await ctx.Reply("Private information will now be **shown** when looking up your own info. Use the `-public` flag to hide it.");
}
else if (ctx.Match("false"))
{
await _repo.UpdateSystemConfig(ctx.System.Id, new() { ShowPrivateInfo = false });
await ctx.Reply("Private information will now be **hidden** when looking up your own info. Use the `-private` flag to show it.");
}
else throw new PKError("You must pass 'true' or 'false' to this command.");
}
}