Fixed IsRaidSignUpAllowed

This commit is contained in:
t.ruspekhofer 2022-03-12 21:55:11 +01:00
parent ab6602710d
commit 35a1ff111b
3 changed files with 8 additions and 5 deletions

View file

@ -327,8 +327,11 @@ namespace Lieb.Data
return false;
}
if (!string.IsNullOrEmpty(raid.RequiredRole) && !user.RoleAssignments.Where(a => a.LiebRole.RoleName == raid.RequiredRole).Any() || raid.FreeForAllTimeUTC.UtcDateTime > DateTimeOffset.UtcNow)
if (!string.IsNullOrEmpty(raid.RequiredRole)
&& !user.RoleAssignments.Where(a => a.LiebRole.RoleName == raid.RequiredRole).Any()
&& raid.FreeForAllTimeUTC.UtcDateTime > DateTimeOffset.UtcNow)
{
bool userHasRole = user.RoleAssignments.Where(a => a.LiebRole.RoleName == raid.RequiredRole).Any();
errorMessage = $"The raid is still locked for {raid.RequiredRole}.";
return false;
}

View file

@ -89,7 +89,7 @@
protected override async Task OnInitializedAsync()
{
_isRaidSignUpAllowed = _user != null && RaidService.IsRaidSignUpAllowed(_user.LiebUserId, _raid.RaidId, out string _errorMessage);
_isRaidSignUpAllowed = _user != null && RaidService.IsRaidSignUpAllowed(_user.LiebUserId, _raid.RaidId, out _errorMessage);
_startTime = await TimeZoneService.GetLocalDateTime(_raid.StartTimeUTC);
_endTime = await TimeZoneService.GetLocalDateTime(_raid.EndTimeUTC);

View file

@ -111,7 +111,7 @@
}
<ValidationSummary />
<label class="validation-message" >@_errosMessage</label>
<label class="validation-message" >@_errorMessage</label>
<button type="submit">Submit</button>
</EditForm>
@ -126,7 +126,7 @@
public Raid _raid;
private string _errosMessage = string.Empty;
private string _errorMessage = string.Empty;
private DateTimeOffset _raidDate = DateTime.Now.Date;
private DateTimeOffset _startTime;
@ -189,7 +189,7 @@
if(_raid.Roles.Count == 0)
{
_errosMessage = "Roles are needed for a raid.";
_errorMessage = "Roles are needed for a raid.";
return;
}