Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
contents: read
runs-on: ubuntu-latest
steps:
- uses: frasermolyneux/actions/dotnet-web-ci@main
- uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v1.4
with:
dotnet-project: "XtremeIdiots.Portal.Web"
dotnet-version: 9.0.x
Expand All @@ -31,7 +31,7 @@ jobs:
concurrency:
group: ${{ github.repository }}-dev
steps:
- uses: frasermolyneux/actions/terraform-plan@main
- uses: frasermolyneux/actions/terraform-plan@terraform-plan/v1.4
with:
terraform-folder: "terraform"
terraform-var-file: "tfvars/dev.tfvars"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: frasermolyneux/actions/dotnet-web-ci@main
- uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v1.4
with:
dotnet-project: "XtremeIdiots.Portal.Web"
dotnet-version: 9.0.x
Expand All @@ -29,7 +29,7 @@ jobs:
concurrency:
group: ${{ github.repository }}-dev
steps:
- uses: frasermolyneux/actions/terraform-plan-and-apply@main
- uses: frasermolyneux/actions/terraform-plan-and-apply@terraform-plan-and-apply/v1.4
with:
terraform-folder: "terraform"
terraform-var-file: "tfvars/dev.tfvars"
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
concurrency:
group: ${{ github.repository }}-dev
steps:
- uses: frasermolyneux/actions/deploy-app-service@main
- uses: frasermolyneux/actions/deploy-app-service@deploy-app-service/v1.2
with:
web-artifact-name: "XtremeIdiots.Portal.Web"
web-app-name: ${{ needs.terraform-plan-and-apply-dev.outputs.web_app_name }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy-prd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: frasermolyneux/actions/dotnet-web-ci@main
- uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v1.4
with:
dotnet-project: "XtremeIdiots.Portal.Web"
dotnet-version: 9.0.x
Expand All @@ -37,7 +37,7 @@ jobs:
concurrency:
group: ${{ github.repository }}-dev
steps:
- uses: frasermolyneux/actions/terraform-plan-and-apply@main
- uses: frasermolyneux/actions/terraform-plan-and-apply@terraform-plan-and-apply/v1.4
with:
terraform-folder: "terraform"
terraform-var-file: "tfvars/dev.tfvars"
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
concurrency:
group: ${{ github.repository }}-dev
steps:
- uses: frasermolyneux/actions/deploy-app-service@main
- uses: frasermolyneux/actions/deploy-app-service@deploy-app-service/v1.2
with:
web-artifact-name: "XtremeIdiots.Portal.Web"
web-app-name: ${{ needs.terraform-plan-and-apply-dev.outputs.web_app_name }}
Expand All @@ -92,7 +92,7 @@ jobs:
concurrency:
group: ${{ github.repository }}-prd
steps:
- uses: frasermolyneux/actions/terraform-plan-and-apply@main
- uses: frasermolyneux/actions/terraform-plan-and-apply@terraform-plan-and-apply/v1.4
with:
terraform-folder: "terraform"
terraform-var-file: "tfvars/prd.tfvars"
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
concurrency:
group: ${{ github.repository }}-prd
steps:
- uses: frasermolyneux/actions/deploy-app-service@main
- uses: frasermolyneux/actions/deploy-app-service@deploy-app-service/v1.2
with:
web-artifact-name: "XtremeIdiots.Portal.Web"
web-app-name: ${{ needs.terraform-plan-and-apply-prd.outputs.web_app_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/destroy-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
concurrency:
group: ${{ github.repository }}-${{ inputs.environment }}
steps:
- uses: frasermolyneux/actions/terraform-destroy@main
- uses: frasermolyneux/actions/terraform-destroy@terraform-destroy/v1.2
with:
terraform-folder: "terraform"
terraform-var-file: ${{ inputs.environment == 'prd' && 'tfvars/prd.tfvars' || 'tfvars/dev.tfvars' }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pr-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: frasermolyneux/actions/dotnet-web-ci@main
- uses: frasermolyneux/actions/dotnet-web-ci@dotnet-web-ci/v1.4
with:
dotnet-project: "XtremeIdiots.Portal.Web"
dotnet-version: 9.0.x
Expand All @@ -43,7 +43,7 @@ jobs:
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
steps:
- uses: frasermolyneux/actions/terraform-plan@main
- uses: frasermolyneux/actions/terraform-plan@terraform-plan/v1.4
with:
terraform-folder: "terraform"
terraform-var-file: "tfvars/dev.tfvars"
Expand All @@ -64,7 +64,7 @@ jobs:
concurrency:
group: ${{ github.repository }}-dev
steps:
- uses: frasermolyneux/actions/terraform-plan-and-apply@main
- uses: frasermolyneux/actions/terraform-plan-and-apply@terraform-plan-and-apply/v1.4
with:
terraform-folder: "terraform"
terraform-var-file: "tfvars/dev.tfvars"
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
concurrency:
group: ${{ github.repository }}-dev
steps:
- uses: frasermolyneux/actions/deploy-app-service@main
- uses: frasermolyneux/actions/deploy-app-service@deploy-app-service/v1.2
with:
web-artifact-name: "XtremeIdiots.Portal.Web"
web-app-name: ${{ needs.terraform-plan-and-apply-dev.outputs.web_app_name }}
Expand All @@ -127,7 +127,7 @@ jobs:
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
steps:
- uses: frasermolyneux/actions/terraform-plan@main
- uses: frasermolyneux/actions/terraform-plan@terraform-plan/v1.4
with:
terraform-folder: "terraform"
terraform-var-file: "tfvars/prd.tfvars"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.Extensions.Logging;
using System.Globalization;
using XtremeIdiots.InvisionCommunity;
using MX.InvisionCommunity.Api.Abstractions;
using XtremeIdiots.Portal.Integrations.Forums.Extensions;
using XtremeIdiots.Portal.Repository.Abstractions.Constants.V1;

Expand Down Expand Up @@ -45,15 +45,19 @@
_ => 28
};

var postTopicResult = await forumsClient.Forums.PostTopic(forumId, userId, $"{username} - {type}", PostContent(type, playerId, username, created, text), type.ToString()).ConfigureAwait(false);

Check warning on line 48 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'PostTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 48 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'PostTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 48 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'PostTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 48 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'PostTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 48 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'PostTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 48 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'PostTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 48 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / quality / Code Quality

Forward the 'cancellationToken' parameter to the 'PostTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)
Comment thread
frasermolyneux marked this conversation as resolved.
Outdated

if (postTopicResult is null)
if (postTopicResult?.Result?.Data is null)
{
logger.LogWarning("Failed to create forum topic for admin action - null response");
logger.LogWarning("Failed to create forum topic for admin action - StatusCode: {StatusCode}, Errors: {Errors}",
postTopicResult?.StatusCode,
postTopicResult?.Result?.Errors is { Length: > 0 } errors
? string.Join("; ", errors.Select(e => $"{e.Code}: {e.Message}"))
: "no error details available");
return 0;
}

Comment thread
frasermolyneux marked this conversation as resolved.
return postTopicResult.TopicId;
return postTopicResult.Result.Data.TopicId;
}
catch (Exception ex)
{
Expand Down Expand Up @@ -84,7 +88,7 @@
if (adminId is not null)
userId = Convert.ToInt32(adminId);

await forumsClient.Forums.UpdateTopic(topicId, userId, PostContent(type, playerId, username, created, text)).ConfigureAwait(false);

Check warning on line 91 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'UpdateTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 91 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'UpdateTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 91 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'UpdateTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 91 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'UpdateTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 91 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'UpdateTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 91 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / build-and-test

Forward the 'cancellationToken' parameter to the 'UpdateTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)

Check warning on line 91 in src/XtremeIdiots.Portal.Integrations.Forums/AdminActionTopics.cs

View workflow job for this annotation

GitHub Actions / quality / Code Quality

Forward the 'cancellationToken' parameter to the 'UpdateTopic' method or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016)
}

private static string PostContent(AdminActionType type, Guid playerId, string username, DateTime created, string text)
Expand Down
5 changes: 3 additions & 2 deletions src/XtremeIdiots.Portal.Integrations.Forums/DemoManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using XtremeIdiots.InvisionCommunity;
using MX.InvisionCommunity.Api.Abstractions;
using XtremeIdiots.Portal.Integrations.Forums.Models;

namespace XtremeIdiots.Portal.Integrations.Forums;
Expand All @@ -17,7 +17,8 @@ public class DemoManager(IInvisionApiClient forumsClient) : IDemoManager
/// <exception cref="InvalidOperationException">Thrown when demo manager download file cannot be retrieved or URL is missing</exception>
public async Task<DemoManagerClientDto> GetDemoManagerClient()
{
var downloadFile = await forumsClient.Downloads.GetDownloadFile(2753).ConfigureAwait(false);
var downloadFileResult = await forumsClient.Downloads.GetDownloadFile(2753).ConfigureAwait(false);
var downloadFile = downloadFileResult?.Result?.Data;

return downloadFile is null
? throw new InvalidOperationException("Unable to retrieve demo manager download file from forums")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.17.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.3" />
<PackageReference Include="XtremeIdiots.InvisionCommunity" Version="1.1.132.1" />
<PackageReference Include="XtremeIdiots.Portal.Repository.Api.Client.V1" Version="2.1.113" />
<PackageReference Include="MX.InvisionCommunity.Api.Client" Version="1.0.18" />
<PackageReference Include="XtremeIdiots.Portal.Repository.Api.Client.V1" Version="2.1.135" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

using XtremeIdiots.InvisionCommunity;
using MX.InvisionCommunity.Api.Abstractions;
using XtremeIdiots.Portal.Repository.Abstractions.Constants.V1;

namespace XtremeIdiots.Portal.Web.ApiControllers;
Expand Down Expand Up @@ -41,8 +41,8 @@ public HealthCheckController(
try
{
var response = await this.forumsClient.Core.GetCoreHello().ConfigureAwait(false);
var checkResponse = response?.CommunityUrl == "https://www.xtremeidiots.com/";
return new Tuple<bool, string>(checkResponse, "OK");
var checkResponse = response?.Result?.Data?.CommunityUrl == "https://www.xtremeidiots.com/";
return new Tuple<bool, string>(checkResponse, checkResponse ? "OK" : "Unexpected or missing CommunityUrl in forums API response");
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using System.Security.Claims;
using XtremeIdiots.InvisionCommunity;
using XtremeIdiots.InvisionCommunity.Models;
using MX.InvisionCommunity.Api.Abstractions;
using MX.InvisionCommunity.Api.Abstractions.Models;
using XtremeIdiots.Portal.Repository.Abstractions.Models.V1.UserProfiles;
using XtremeIdiots.Portal.Repository.Api.Client.V1;

Expand Down Expand Up @@ -74,7 +74,8 @@ private async Task UpdateExistingUser(ExternalLoginInfo info, CancellationToken
{
cancellationToken.ThrowIfCancellationRequested();

var member = await forumsClient.Core.GetMember(id).ConfigureAwait(false) ?? throw new InvalidOperationException($"Member not found with ID: {id}");
var memberResult = await forumsClient.Core.GetMember(id, cancellationToken).ConfigureAwait(false);
var member = memberResult?.Result?.Data ?? throw new InvalidOperationException($"Member not found with ID: {id}");
Comment thread
frasermolyneux marked this conversation as resolved.
Outdated
var user = await userManager.FindByLoginAsync(info.LoginProvider, info.ProviderKey).ConfigureAwait(false) ?? throw new InvalidOperationException($"User not found for login provider: {info.LoginProvider}, key: {info.ProviderKey}");
cancellationToken.ThrowIfCancellationRequested();

Expand Down Expand Up @@ -126,7 +127,8 @@ private async Task RegisterNewUser(ExternalLoginInfo info, CancellationToken can
{
cancellationToken.ThrowIfCancellationRequested();

var member = await forumsClient.Core.GetMember(id).ConfigureAwait(false) ?? throw new InvalidOperationException($"Member not found with ID: {id}");
var memberResult = await forumsClient.Core.GetMember(id, cancellationToken).ConfigureAwait(false);
var member = memberResult?.Result?.Data ?? throw new InvalidOperationException($"Member not found with ID: {id}");
Comment thread
frasermolyneux marked this conversation as resolved.
Outdated
var user = new IdentityUser { Id = id, UserName = username, Email = email };
var createUserResult = await userManager.CreateAsync(user).ConfigureAwait(false);

Expand Down Expand Up @@ -167,7 +169,7 @@ private async Task RegisterNewUser(ExternalLoginInfo info, CancellationToken can
}
}

private async Task<UserProfileDto?> EnsureUserProfileExists(string memberId, Member member, CancellationToken cancellationToken = default)
private async Task<UserProfileDto?> EnsureUserProfileExists(string memberId, MemberDto member, CancellationToken cancellationToken = default)
{
if (string.IsNullOrWhiteSpace(memberId))
{
Expand Down
10 changes: 4 additions & 6 deletions src/XtremeIdiots.Portal.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Microsoft.EntityFrameworkCore;
using MX.GeoLocation.Api.Client.V1;
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
using XtremeIdiots.InvisionCommunity;
using MX.InvisionCommunity.Api.Client;
using XtremeIdiots.Portal.Integrations.Forums;
using XtremeIdiots.Portal.Integrations.Forums.Extensions;
using XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1;
Expand Down Expand Up @@ -48,11 +48,9 @@ public void ConfigureServices(IServiceCollection services)
services.AddServiceProfiler();
services.AddAzureAppConfiguration();

services.AddInvisionApiClient(options =>
{
options.BaseUrl = GetConfigValue("XtremeIdiots:Forums:BaseUrl", "XtremeIdiots:Forums:BaseUrl configuration is required");
options.ApiKey = GetConfigValue("XtremeIdiots:Forums:ApiKey", "XtremeIdiots:Forums:ApiKey configuration is required");
});
services.AddInvisionApiClient(options => options
.WithBaseUrl(GetConfigValue("XtremeIdiots:Forums:BaseUrl", "XtremeIdiots:Forums:BaseUrl configuration is required"))
.WithApiKeyAuthentication(GetConfigValue("XtremeIdiots:Forums:ApiKey", "XtremeIdiots:Forums:ApiKey configuration is required")));

services.AddAdminActionTopics();
services.AddScoped<IDemoManager, DemoManager>();
Expand Down
10 changes: 5 additions & 5 deletions src/XtremeIdiots.Portal.Web/XtremeIdiots.Portal.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.11">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.13">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.12" />
<PackageReference Include="MX.Api.Abstractions" Version="2.2.40" />
<PackageReference Include="XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1" Version="2.1.105" />
<PackageReference Include="XtremeIdiots.Portal.Repository.Api.Client.V1" Version="2.1.113" />
<PackageReference Include="MX.GeoLocation.Api.Client.V1" Version="1.1.20260212.3" />
<PackageReference Include="MX.Api.Abstractions" Version="2.3.25" />
<PackageReference Include="XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1" Version="2.1.109" />
<PackageReference Include="XtremeIdiots.Portal.Repository.Api.Client.V1" Version="2.1.135" />
<PackageReference Include="MX.GeoLocation.Api.Client.V1" Version="1.2.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading