From 3607dd14f1eaf97fad46eae9414be7defab526a9 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Thu, 1 Oct 2020 07:09:54 +0200 Subject: [PATCH] Clean up + Removed old SignalR code Signed-off-by: Bjarke Berg --- .../UmbracoTestServerTestBase.cs | 2 +- .../Views/template1.cshtml | 5 -- .../Views/template2.cshtml | 5 -- .../Views/test.cshtml | 5 -- src/Umbraco.Web/SignalR/IPreviewHub.cs | 12 ----- src/Umbraco.Web/SignalR/PreviewHub.cs | 7 --- .../SignalR/PreviewHubComponent.cs | 47 ------------------- src/Umbraco.Web/SignalR/PreviewHubComposer.cs | 17 ------- src/Umbraco.Web/Umbraco.Web.csproj | 4 -- 9 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 src/Umbraco.Tests.Integration/Views/template1.cshtml delete mode 100644 src/Umbraco.Tests.Integration/Views/template2.cshtml delete mode 100644 src/Umbraco.Tests.Integration/Views/test.cshtml delete mode 100644 src/Umbraco.Web/SignalR/IPreviewHub.cs delete mode 100644 src/Umbraco.Web/SignalR/PreviewHub.cs delete mode 100644 src/Umbraco.Web/SignalR/PreviewHubComponent.cs delete mode 100644 src/Umbraco.Web/SignalR/PreviewHubComposer.cs diff --git a/src/Umbraco.Tests.Integration/TestServerTest/UmbracoTestServerTestBase.cs b/src/Umbraco.Tests.Integration/TestServerTest/UmbracoTestServerTestBase.cs index c99a457c33..9f10ce968e 100644 --- a/src/Umbraco.Tests.Integration/TestServerTest/UmbracoTestServerTestBase.cs +++ b/src/Umbraco.Tests.Integration/TestServerTest/UmbracoTestServerTestBase.cs @@ -68,7 +68,6 @@ namespace Umbraco.Tests.Integration.TestServerTest builder.ConfigureServices((c, s) => { c.HostingEnvironment = TestHelper.GetWebHostEnvironment(); - s.AddSignalR(); }); // call startup @@ -142,6 +141,7 @@ namespace Umbraco.Tests.Integration.TestServerTest .WithRuntimeMinifier() .WithBackOffice() .WithBackOfficeIdentity() + .WithPreview() //.WithMiniProfiler() // we don't want this running in tests .WithMvcAndRazor(mvcBuilding: mvcBuilder => { diff --git a/src/Umbraco.Tests.Integration/Views/template1.cshtml b/src/Umbraco.Tests.Integration/Views/template1.cshtml deleted file mode 100644 index 64a9c8d55f..0000000000 --- a/src/Umbraco.Tests.Integration/Views/template1.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@using Umbraco.Web.PublishedModels; -@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage -@{ - Layout = null; -} \ No newline at end of file diff --git a/src/Umbraco.Tests.Integration/Views/template2.cshtml b/src/Umbraco.Tests.Integration/Views/template2.cshtml deleted file mode 100644 index 64a9c8d55f..0000000000 --- a/src/Umbraco.Tests.Integration/Views/template2.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@using Umbraco.Web.PublishedModels; -@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage -@{ - Layout = null; -} \ No newline at end of file diff --git a/src/Umbraco.Tests.Integration/Views/test.cshtml b/src/Umbraco.Tests.Integration/Views/test.cshtml deleted file mode 100644 index 64a9c8d55f..0000000000 --- a/src/Umbraco.Tests.Integration/Views/test.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@using Umbraco.Web.PublishedModels; -@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage -@{ - Layout = null; -} \ No newline at end of file diff --git a/src/Umbraco.Web/SignalR/IPreviewHub.cs b/src/Umbraco.Web/SignalR/IPreviewHub.cs deleted file mode 100644 index 2eb722c40d..0000000000 --- a/src/Umbraco.Web/SignalR/IPreviewHub.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Umbraco.Web.SignalR -{ - public interface IPreviewHub - { - // define methods implemented by client - // ReSharper disable InconsistentNaming - - void refreshed(int id); - - // ReSharper restore InconsistentNaming - } -} diff --git a/src/Umbraco.Web/SignalR/PreviewHub.cs b/src/Umbraco.Web/SignalR/PreviewHub.cs deleted file mode 100644 index 3fc3225fb8..0000000000 --- a/src/Umbraco.Web/SignalR/PreviewHub.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Microsoft.AspNet.SignalR; - -namespace Umbraco.Web.SignalR -{ - public class PreviewHub : Hub - { } -} diff --git a/src/Umbraco.Web/SignalR/PreviewHubComponent.cs b/src/Umbraco.Web/SignalR/PreviewHubComponent.cs deleted file mode 100644 index 1d8a10118b..0000000000 --- a/src/Umbraco.Web/SignalR/PreviewHubComponent.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using Microsoft.AspNet.SignalR; -using Umbraco.Core.Cache; -using Umbraco.Core.Composing; -using Umbraco.Core.Sync; -using Umbraco.Web.Cache; - -namespace Umbraco.Web.SignalR -{ - public class PreviewHubComponent : IComponent - { - private readonly Lazy> _hubContext; - - // using a lazy arg here means that we won't create the hub until necessary - // and therefore we won't have too bad an impact on boot time - public PreviewHubComponent(Lazy> hubContext) - { - _hubContext = hubContext; - } - - public void Initialize() - { - // ContentService.Saved is too soon - the content cache is not ready yet, - // so use the content cache refresher event, because when it triggers - // the cache has already been notified of the changes - - ContentCacheRefresher.CacheUpdated += HandleCacheUpdated; - } - - public void Terminate() - { - ContentCacheRefresher.CacheUpdated -= HandleCacheUpdated; - } - - private void HandleCacheUpdated(ContentCacheRefresher sender, CacheRefresherEventArgs args) - { - if (args.MessageType != MessageType.RefreshByPayload) return; - var payloads = (ContentCacheRefresher.JsonPayload[])args.MessageObject; - var hubContextInstance = _hubContext.Value; - foreach (var payload in payloads) - { - var id = payload.Id; // keep it simple for now, ignore ChangeTypes - hubContextInstance.Clients.All.refreshed(id); - } - } - } -} diff --git a/src/Umbraco.Web/SignalR/PreviewHubComposer.cs b/src/Umbraco.Web/SignalR/PreviewHubComposer.cs deleted file mode 100644 index cef1e166c2..0000000000 --- a/src/Umbraco.Web/SignalR/PreviewHubComposer.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.AspNet.SignalR; -using Umbraco.Core; -using Umbraco.Core.Composing; - -namespace Umbraco.Web.SignalR -{ - [RuntimeLevel(MinLevel = RuntimeLevel.Run)] - public class PreviewHubComposer : ComponentComposer, ICoreComposer - { - public override void Compose(Composition composition) - { - base.Compose(composition); - - composition.RegisterUnique(_ => GlobalHost.ConnectionManager.GetHubContext()); - } - } -} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 7a0f584baa..af9f9f76f6 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -214,7 +214,6 @@ - @@ -233,9 +232,6 @@ - - -