diff --git a/src/TagzApp.Common/IMessagingService.cs b/src/TagzApp.Common/IMessagingService.cs index 22252a22..d2a11d83 100644 --- a/src/TagzApp.Common/IMessagingService.cs +++ b/src/TagzApp.Common/IMessagingService.cs @@ -1,5 +1,4 @@ using Microsoft.Extensions.Hosting; -using TagzApp.Common.Models; namespace TagzApp.Web.Services; @@ -12,8 +11,8 @@ public interface IMessagingService : IHostedService Task GetContentByIds(string provider, string providerId); Task> GetExistingContentForTag(string tag); - - Task> GetContentByTagForModeration(string tag); + // TODO: Needs checking if a non-nullable ModerationAction makes problems! + Task> GetContentByTagForModeration(string tag); Task> GetApprovedContentByTag(string tag); diff --git a/src/TagzApp.Common/InMemoryContentMessaging.cs b/src/TagzApp.Common/InMemoryContentMessaging.cs index c28f4548..5ce5c3ab 100644 --- a/src/TagzApp.Common/InMemoryContentMessaging.cs +++ b/src/TagzApp.Common/InMemoryContentMessaging.cs @@ -1,5 +1,4 @@ using System.Collections.Concurrent; -using TagzApp.Common.Models; namespace TagzApp.Common; @@ -74,9 +73,11 @@ public void StartProviders(IEnumerable providers, Cancella _ProviderTasks.Clear(); foreach (var providerItem in providers) { - _ProviderTasks.Add(Task.Factory.StartNew(async (object state) => + _ProviderTasks.Add(Task.Factory.StartNew(async (object? state) => { - var provider = (ISocialMediaProvider)state; + var provider = state as ISocialMediaProvider; + + if (provider is null) return; var lastQueryTime = DateTimeOffset.UtcNow.AddHours(-1); diff --git a/src/TagzApp.Web/Services/InMemoryMessagingService.cs b/src/TagzApp.Web/Services/InMemoryMessagingService.cs index c2e8cb90..7da5cd50 100644 --- a/src/TagzApp.Web/Services/InMemoryMessagingService.cs +++ b/src/TagzApp.Web/Services/InMemoryMessagingService.cs @@ -1,8 +1,6 @@ -using Microsoft.AspNetCore.SignalR; using System.Collections.Concurrent; -using TagzApp.Common.Models; + using TagzApp.Communication; -using TagzApp.Web.Hubs; namespace TagzApp.Web.Services;