Throw "no registered switches" error also with frontpercent

This commit is contained in:
spiral 2021-06-16 08:56:52 -04:00
parent 272a3430a6
commit 8cbb2424d7
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31
2 changed files with 6 additions and 0 deletions

View File

@ -505,6 +505,9 @@ namespace PluralKit.Bot
var targetSystem = await GetGroupSystem(ctx, target, conn); var targetSystem = await GetGroupSystem(ctx, target, conn);
ctx.CheckSystemPrivacy(targetSystem, targetSystem.FrontHistoryPrivacy); ctx.CheckSystemPrivacy(targetSystem, targetSystem.FrontHistoryPrivacy);
var totalSwitches = await _db.Execute(conn => _repo.GetSwitchCount(conn, targetSystem.Id));
if (totalSwitches == 0) throw Errors.NoRegisteredSwitches;
string durationStr = ctx.RemainderOrNull() ?? "30d"; string durationStr = ctx.RemainderOrNull() ?? "30d";
var now = SystemClock.Instance.GetCurrentInstant(); var now = SystemClock.Instance.GetCurrentInstant();

View File

@ -117,6 +117,9 @@ namespace PluralKit.Bot
if (system == null) throw Errors.NoSystemError; if (system == null) throw Errors.NoSystemError;
ctx.CheckSystemPrivacy(system, system.FrontHistoryPrivacy); ctx.CheckSystemPrivacy(system, system.FrontHistoryPrivacy);
var totalSwitches = await _db.Execute(conn => _repo.GetSwitchCount(conn, system.Id));
if (totalSwitches == 0) throw Errors.NoRegisteredSwitches;
string durationStr = ctx.RemainderOrNull() ?? "30d"; string durationStr = ctx.RemainderOrNull() ?? "30d";
var now = SystemClock.Instance.GetCurrentInstant(); var now = SystemClock.Instance.GetCurrentInstant();