diff --git a/src/BUTR.Site.NexusMods.Client/Pages/Administration/RoleManager.razor b/src/BUTR.Site.NexusMods.Client/Pages/Administration/RoleManager.razor index 0b95ac0f..765ce726 100644 --- a/src/BUTR.Site.NexusMods.Client/Pages/Administration/RoleManager.razor +++ b/src/BUTR.Site.NexusMods.Client/Pages/Administration/RoleManager.razor @@ -53,24 +53,18 @@ { try { - if (await _userClient.SetRoleAsync(userId: (int) _model.UserId, role: _model.Role) is { Error: not null }) + if (await _userClient.SetRoleAsync(userId: (int) _model.UserId, role: _model.Role) is { Error: null }) { - await _notificationService.Success( - $"Assigned '{_model.Role}' to user with id '{_model.UserId}'!", - "Success!"); + await _notificationService.Success($"Assigned '{_model.Role}' to user with id '{_model.UserId}'!", "Success!"); } else { - await _notificationService.Error( - $"Failed to assign '{_model.Role}' to user with id '{_model.UserId}'!", - "Error!"); + await _notificationService.Error($"Failed to assign '{_model.Role}' to user with id '{_model.UserId}'!", "Error!"); } } catch { - await _notificationService.Error( - $"Failed to assign '{_model.Role}' to user with id '{_model.UserId}'!", - "Error!"); + await _notificationService.Error($"Failed to assign '{_model.Role}' to user with id '{_model.UserId}'!", "Error!"); } } diff --git a/src/BUTR.Site.NexusMods.Client/Pages/Basic/LoginNexusModsSSO.razor b/src/BUTR.Site.NexusMods.Client/Pages/Basic/LoginNexusModsSSO.razor index 5c43f3a8..2ecc77c9 100644 --- a/src/BUTR.Site.NexusMods.Client/Pages/Basic/LoginNexusModsSSO.razor +++ b/src/BUTR.Site.NexusMods.Client/Pages/Basic/LoginNexusModsSSO.razor @@ -154,7 +154,7 @@ public async ValueTask DisposeAsync() { - _cancellationTokenSource.Cancel(); + await _cancellationTokenSource.CancelAsync(); try { await _client.CloseAsync(WebSocketCloseStatus.NormalClosure, "Bye", CancellationToken.None); } catch (Exception) { /* ignored */ } await Task.WhenAny(_receiveTask, Task.Delay(2000)); diff --git a/src/BUTR.Site.NexusMods.Client/Pages/Basic/Settings.razor b/src/BUTR.Site.NexusMods.Client/Pages/Basic/Settings.razor index 2dfd720d..020d3894 100644 --- a/src/BUTR.Site.NexusMods.Client/Pages/Basic/Settings.razor +++ b/src/BUTR.Site.NexusMods.Client/Pages/Basic/Settings.razor @@ -80,17 +80,13 @@ private async Task OnSave() { await _localStorage.SetItemAsync("settings", _userSettings); - await _notificationService.Success( - "Saved the settings!", - "Success!"); + await _notificationService.Success("Saved the settings!", "Success!"); } private async Task OnCancel() { _userSettings = await _localStorage.GetItemAsync("settings") ?? new(); - await _notificationService.Success( - $"Reloaded the settings!", - "Success!"); + await _notificationService.Success($"Reloaded the settings!", "Success!"); } } \ No newline at end of file diff --git a/src/BUTR.Site.NexusMods.Client/Pages/Moderator/AllowUserModuleId.razor b/src/BUTR.Site.NexusMods.Client/Pages/Moderator/AllowUserModuleId.razor index a84e8062..8b825517 100644 --- a/src/BUTR.Site.NexusMods.Client/Pages/Moderator/AllowUserModuleId.razor +++ b/src/BUTR.Site.NexusMods.Client/Pages/Moderator/AllowUserModuleId.razor @@ -112,14 +112,14 @@ await _modalRef.Hide(); if (save && _dataGridRef?.Value is not null && _moduleIdToDelete is not null) { - if (await _userClient.RemoveModuleManualLinkAsync(userId: _dataGridRef.Value.NexusModsUserId, moduleId: _moduleIdToDelete) is { Error: not null }) + if (await _userClient.RemoveModuleManualLinkAsync(userId: _dataGridRef.Value.NexusModsUserId, moduleId: _moduleIdToDelete) is { Error: null }) { - await _notificationService.Success($"Disallowed succesfully!", "Success!"); + await _notificationService.Success("Disallowed succesfully!", "Success!"); await _dataGridRef.Reload(); } else { - await _notificationService.Error($"Failed to disallow!", "Error!"); + await _notificationService.Error("Failed to disallow!", "Error!"); } } } @@ -129,24 +129,18 @@ { if (await DoUserAllowMod(_model)) { - await _notificationService.Success( - $"Assigned '{_model.ModuleId}' to user '{_model.UserUrl}'!", - "Success!"); + await _notificationService.Success($"Assigned '{_model.ModuleId}' to user '{_model.UserUrl}'!", "Success!"); if (_dataGridRef is not null) await _dataGridRef.Reload(); } else { - await _notificationService.Error( - $"Failed to assign '{_model.ModuleId}' to user '{_model.UserUrl}'!", - "Error!"); + await _notificationService.Error($"Failed to assign '{_model.ModuleId}' to user '{_model.UserUrl}'!", "Error!"); } } catch { - await _notificationService.Error( - $"Failed to assign '{_model.ModuleId}' to user '{_model.UserUrl}'!", - "Error!"); + await _notificationService.Error($"Failed to assign '{_model.ModuleId}' to user '{_model.UserUrl}'!", "Error!"); } } @@ -174,7 +168,7 @@ return false; } - return await _userClient.AddModuleManualLinkAsync(moduleId: model.ModuleId, userId: hasUserId ? (int) userId : null, username: hasUsername ? username : null) is { Error: not null }; + return await _userClient.AddModuleManualLinkAsync(moduleId: model.ModuleId, userId: hasUserId ? (int) userId : null, username: hasUsername ? username : null) is { Error: null }; } private async Task DoUserDisallowMod(UserManuallyLinkedModuleModel model) { diff --git a/src/BUTR.Site.NexusMods.Client/Pages/Moderator/ManualModuleIdLink.razor b/src/BUTR.Site.NexusMods.Client/Pages/Moderator/ManualModuleIdLink.razor index 54b3f86c..35fbe14b 100644 --- a/src/BUTR.Site.NexusMods.Client/Pages/Moderator/ManualModuleIdLink.razor +++ b/src/BUTR.Site.NexusMods.Client/Pages/Moderator/ManualModuleIdLink.razor @@ -116,14 +116,14 @@ await _modalRef.Hide(); if (save && _dataGridRef?.Value is not null && _modIdToDelete is not null) { - if (await _modClient.RemoveModuleManualLinkAsync(moduleId: _dataGridRef.Value.ModuleId, modId: _modIdToDelete.Value) is { Error: not null }) + if (await _modClient.RemoveModuleManualLinkAsync(moduleId: _dataGridRef.Value.ModuleId, modId: _modIdToDelete.Value) is { Error: null }) { - await _notificationService.Success($"Disallowed succesfully!", "Success!"); + await _notificationService.Success("Disallowed succesfully!", "Success!"); await _dataGridRef.Reload(); } else { - await _notificationService.Error($"Failed to disallow!", "Error!"); + await _notificationService.Error("Failed to disallow!", "Error!"); } } } @@ -136,24 +136,18 @@ { if (await DoManualLink(_model)) { - await _notificationService.Success( - $"Linked '{_model.ModuleId}' to mod '{_model.NexusModsUrl}'!", - "Success!"); + await _notificationService.Success($"Linked '{_model.ModuleId}' to mod '{_model.NexusModsUrl}'!", "Success!"); if (_dataGridRef is not null) await _dataGridRef.Reload(); } else { - await _notificationService.Error( - $"Failed to link '{_model.ModuleId}' to mod '{_model.NexusModsUrl}'!", - "Error!"); + await _notificationService.Error($"Failed to link '{_model.ModuleId}' to mod '{_model.NexusModsUrl}'!", "Error!"); } } catch { - await _notificationService.Error( - $"Failed to link '{_model.ModuleId}' to mod '{_model.NexusModsUrl}'!", - "Error!"); + await _notificationService.Error($"Failed to link '{_model.ModuleId}' to mod '{_model.NexusModsUrl}'!", "Error!"); } _isLoading = false; @@ -179,7 +173,7 @@ if (!NexusModsUtils.TryParseModUrl(model.NexusModsUrl, out _, out var nexusModsId) && !uint.TryParse(model.NexusModsUrl, out nexusModsId)) return false; - return await _modClient.AddModuleManualLinkAsync(moduleId: model.ModuleId, modId: (int) nexusModsId) is { Error: not null }; + return await _modClient.AddModuleManualLinkAsync(moduleId: model.ModuleId, modId: (int) nexusModsId) is { Error: null }; } private async Task DoManualUnlink(LinkedByStaffModuleNexusModsModsModel model) { diff --git a/src/BUTR.Site.NexusMods.Client/Pages/Tools/GamePublicApiDiff.razor b/src/BUTR.Site.NexusMods.Client/Pages/Tools/GamePublicApiDiff.razor index ea2d39d5..fb909df8 100644 --- a/src/BUTR.Site.NexusMods.Client/Pages/Tools/GamePublicApiDiff.razor +++ b/src/BUTR.Site.NexusMods.Client/Pages/Tools/GamePublicApiDiff.razor @@ -21,7 +21,7 @@ @context.Path.Replace(".diff", ".dll") - @if (context.Type == NodeType.File && context.Visible) + @if (context is { Type: NodeType.File, Visible: true }) { if (context.Content.Count == 0) { diff --git a/src/BUTR.Site.NexusMods.Client/Pages/User/AllowUserMod.razor b/src/BUTR.Site.NexusMods.Client/Pages/User/AllowUserMod.razor index a43b9c4b..179cd3b4 100644 --- a/src/BUTR.Site.NexusMods.Client/Pages/User/AllowUserMod.razor +++ b/src/BUTR.Site.NexusMods.Client/Pages/User/AllowUserMod.razor @@ -110,14 +110,14 @@ await _modalRef.Hide(); if (save && _dataGridRef?.Value is not null && _userIdToDelete is not null) { - if (await _userClient.RemoveNexusModsModManualLinkAsync(userId: (int) _userIdToDelete, modId: _dataGridRef.Value.NexusModsModId, cancellationToken: CancellationToken.None) is { Error: not null }) + if (await _userClient.RemoveNexusModsModManualLinkAsync(userId: (int) _userIdToDelete, modId: _dataGridRef.Value.NexusModsModId, cancellationToken: CancellationToken.None) is { Error: null }) { - await _notificationService.Success($"Disallowed succesfully!", "Success!"); + await _notificationService.Success("Disallowed succesfully!", "Success!"); await _dataGridRef.Reload(); } else { - await _notificationService.Error($"Failed to disallow!", "Error!"); + await _notificationService.Error("Failed to disallow!", "Error!"); } } } @@ -127,24 +127,18 @@ { if (await DoUserAllowMod(_model)) { - await _notificationService.Success( - $"Assigned '{_model.ModUrl}' to user '{_model.UserUrl}'!", - "Success!"); + await _notificationService.Success($"Assigned '{_model.ModUrl}' to user '{_model.UserUrl}'!", "Success!"); if (_dataGridRef is not null) await _dataGridRef.Reload(); } else { - await _notificationService.Error( - $"Failed to assign '{_model.ModUrl}' to user '{_model.UserUrl}'!", - "Error!"); + await _notificationService.Error($"Failed to assign '{_model.ModUrl}' to user '{_model.UserUrl}'!", "Error!"); } } catch { - await _notificationService.Error( - $"Failed to assign '{_model.ModUrl}' to user '{_model.UserUrl}'!", - "Error!"); + await _notificationService.Error($"Failed to assign '{_model.ModUrl}' to user '{_model.UserUrl}'!", "Error!"); } } @@ -178,7 +172,7 @@ return false; } - return await _userClient.AddNexusModsModManualLinkAsync(modId: (int) modId, userId: hasUserId ? (int) userId : null, username: hasUsername ? username : null) is { Error: not null }; + return await _userClient.AddNexusModsModManualLinkAsync(modId: (int) modId, userId: hasUserId ? (int) userId : null, username: hasUsername ? username : null) is { Error: null }; } private async Task DoUserDisallowMod(UserManuallyLinkedModModel model) { diff --git a/src/BUTR.Site.NexusMods.Client/Pages/User/CrashReportsViewer.razor b/src/BUTR.Site.NexusMods.Client/Pages/User/CrashReportsViewer.razor index 2bba2850..be95b8f6 100644 --- a/src/BUTR.Site.NexusMods.Client/Pages/User/CrashReportsViewer.razor +++ b/src/BUTR.Site.NexusMods.Client/Pages/User/CrashReportsViewer.razor @@ -112,7 +112,7 @@ if (save && _datagridPagingRef?.Value is not null) { var updatedCrashReport = _datagridPagingRef.Value with { }; - if (await _crashReportsClient.UpdateAsync(updatedCrashReport.Id, updatedCrashReport.Status, updatedCrashReport.Comment) is { Error: not null }) + if (await _crashReportsClient.UpdateAsync(updatedCrashReport.Id, updatedCrashReport.Status, updatedCrashReport.Comment) is { Error: null }) { await _notificationService.Success("Saved Crash Report!", "Success!"); } diff --git a/src/BUTR.Site.NexusMods.Client/Pages/User/Mods.razor b/src/BUTR.Site.NexusMods.Client/Pages/User/Mods.razor index 9ecbe200..4729bfa1 100644 --- a/src/BUTR.Site.NexusMods.Client/Pages/User/Mods.razor +++ b/src/BUTR.Site.NexusMods.Client/Pages/User/Mods.razor @@ -109,12 +109,12 @@ if (!NexusModsUtils.TryParseModUrl(model.ModUrl, out _, out var modId) && !uint.TryParse(model.ModUrl, out modId)) return false; - return await _userClient.AddNexusModsModLinkAsync((int) modId) is { Error: not null }; + return await _userClient.AddNexusModsModLinkAsync((int) modId) is { Error: null }; } private async Task DoUnlinkMod(UserLinkedModModel model) { - return await _userClient.RemoveNexusModsModLinkAsync(modId: model.NexusModsModId) is { Error: not null }; + return await _userClient.RemoveNexusModsModLinkAsync(modId: model.NexusModsModId) is { Error: null }; } private async Task.ItemsResponse?> GetMods(int page, int pageSize, ICollection filters, ICollection sortings, CancellationToken ct = default)