mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 21:17:23 +01:00
allow moderators to prune
This commit is contained in:
parent
801a3212cb
commit
ce0f123037
1 changed files with 1 additions and 2 deletions
|
|
@ -510,7 +510,6 @@ public partial class MareHub
|
|||
_logger.LogCallInfo(MareHubLogger.Args(dto, days, execute));
|
||||
|
||||
var (hasRights, group) = await TryValidateGroupModeratorOrOwner(dto.Group.GID).ConfigureAwait(false);
|
||||
var (isOwner, _) = await TryValidateOwner(dto.Group.GID).ConfigureAwait(false);
|
||||
if (!hasRights) return -1;
|
||||
|
||||
var allGroupUsers = await DbContext.GroupPairs.Include(p => p.GroupUser)
|
||||
|
|
@ -519,7 +518,7 @@ public partial class MareHub
|
|||
var usersToPrune = allGroupUsers.Where(p => !p.IsPinned && !p.IsModerator && p.GroupUserUID != UserUID
|
||||
&& p.GroupUser.LastLoggedIn.AddDays(days) < DateTime.UtcNow);
|
||||
|
||||
if (!execute || !isOwner) return usersToPrune.Count();
|
||||
if (!execute) return usersToPrune.Count();
|
||||
|
||||
DbContext.GroupPairs.RemoveRange(usersToPrune);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue