Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Refresh.Database/GameDatabaseContext.Users.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,16 @@ public int GetActiveUserCount()
public void SetUserRole(GameUser user, GameUserRole role)
{
if(role == GameUserRole.Banned) throw new InvalidOperationException($"Cannot ban a user with this method. Please use {nameof(this.BanUser)}().");
this.Write(() =>

if (user.Role is GameUserRole.Banned or GameUserRole.Restricted)
{
if (user.Role is GameUserRole.Banned or GameUserRole.Restricted)
{
user.BanReason = null;
user.BanExpiryDate = null;
};

user.Role = role;
});
user.BanReason = null;
user.BanExpiryDate = null;
};

user.Role = role;
this.GameUsers.Update(user);
this.SaveChanges();
}

private void PunishUser(GameUser user, string reason, DateTimeOffset expiryDate, GameUserRole role)
Expand Down