Fix per-system member limit being ignored on import
This commit is contained in:
parent
d80d3c5f04
commit
019800f396
@ -120,6 +120,8 @@ namespace PluralKit.Core
|
|||||||
await _repo.AddAccount(conn, system.Id, accountId);
|
await _repo.AddAccount(conn, system.Id, accountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var memberLimit = system.MemberLimitOverride ?? Limits.MaxMemberCount;
|
||||||
|
|
||||||
// Apply system info
|
// Apply system info
|
||||||
var patch = new SystemPatch {Name = data.Name};
|
var patch = new SystemPatch {Name = data.Name};
|
||||||
if (data.Description != null) patch.Description = data.Description;
|
if (data.Description != null) patch.Description = data.Description;
|
||||||
@ -135,10 +137,10 @@ namespace PluralKit.Core
|
|||||||
// If creating the unmatched members would put us over the member limit, abort before creating any members
|
// If creating the unmatched members would put us over the member limit, abort before creating any members
|
||||||
var memberCountBefore = await _repo.GetSystemMemberCount(conn, system.Id);
|
var memberCountBefore = await _repo.GetSystemMemberCount(conn, system.Id);
|
||||||
var membersToAdd = data.Members.Count(m => imp.IsNewMember(m.Id, m.Name));
|
var membersToAdd = data.Members.Count(m => imp.IsNewMember(m.Id, m.Name));
|
||||||
if (memberCountBefore + membersToAdd > Limits.MaxMemberCount)
|
if (memberCountBefore + membersToAdd > memberLimit)
|
||||||
{
|
{
|
||||||
result.Success = false;
|
result.Success = false;
|
||||||
result.Message = $"Import would exceed the maximum number of members ({Limits.MaxMemberCount}).";
|
result.Message = $"Import would exceed the maximum number of members ({memberLimit}).";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user