From 358399daf20090a38fc0d639c272419585780ff3 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 1 Aug 2018 13:22:13 +0100 Subject: [PATCH 1/7] Bumping version number for hotfixes --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 47e24bd..36d9d40 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ image: Visual Studio 2017 # version format -version: 2.0.1.{build} +version: 2.0.2.{build} # UMBRACO_PACKAGE_PRERELEASE_SUFFIX if a rtm release build this should be blank, otherwise if empty will default to alpha # example UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta From 443eb1f04fe2d7be679244ba7d176792c638beb7 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Mon, 12 Nov 2018 17:38:02 +0000 Subject: [PATCH 2/7] :chocolate_bar: Updated NuGet API key --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 36d9d40..3a1f6da 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -47,7 +47,7 @@ deploy: - provider: NuGet server: api_key: - secure: 0+oAleUTnr9UuJrhLW5rphRR+QGz00XX1Ui3k5kwyr2kUdEamiQ3F+gW0q8MJbDT + secure: vEophXSqus5F60LRBY4/j1l6K/S5+n3/yYpiID3O7JJW1gyj+0q0enuHhN3tgdhl artifact: /.*\.nupkg/ on: branch: master From b1df94a8d9979a09e5628a80f42abef7025ff3ac Mon Sep 17 00:00:00 2001 From: Andy Felton Date: Tue, 11 Dec 2018 08:35:54 +0000 Subject: [PATCH 3/7] Create published Content Request prior to Rendering to support macros in RTS --- .../Our.Umbraco.StackedContent.csproj | 2 ++ .../StackedContentApiController.cs | 23 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj b/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj index 4ce5603..45b4908 100644 --- a/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj +++ b/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj @@ -43,7 +43,9 @@ False + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll False diff --git a/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs b/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs index cf21cb0..f2f4c12 100644 --- a/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs +++ b/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs @@ -1,13 +1,18 @@ -using System.Net.Http; +using System; +using System.Net.Http; using System.Net.Http.Headers; using System.Net.Mime; +using System.Web; using System.Web.Http; +using System.Web.Security; using Newtonsoft.Json.Linq; using Our.Umbraco.InnerContent.Helpers; using Our.Umbraco.StackedContent.Models; using Our.Umbraco.StackedContent.Web.Helpers; +using Umbraco.Core.Configuration; using Umbraco.Core.Models; using Umbraco.Web.Mvc; +using Umbraco.Web.Routing; using Umbraco.Web.WebApi; namespace Our.Umbraco.StackedContent.Web.Controllers @@ -30,6 +35,22 @@ public HttpResponseMessage GetPreviewMarkup([FromBody] JObject item, int pageId) // If unpublished, then fake PublishedContent (with IContent object) page = new UnpublishedContent(pageId, Services); } + + var baseUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Path, "/"); + var umbUrl = baseUrl + page.Url.TrimStart('/'); + + var pcr = new PublishedContentRequest( + new Uri(umbUrl), + UmbracoContext.RoutingContext, + UmbracoConfig.For.UmbracoSettings().WebRouting, + s => Roles.Provider.GetRolesForUser(s) + ); + + UmbracoContext.PublishedContentRequest = pcr; + UmbracoContext.PublishedContentRequest.PublishedContent = page; + + pcr.Prepare(); + } // Convert item From 3943f8324f9a07a19e0aced93c7d2aaaa79d0fba Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 12 Dec 2018 11:05:13 +0000 Subject: [PATCH 4/7] Tweaks to the `PublishedContentRequest` code - Added check if `PublishedContentRequest` already existed, (it shouldn't but we never know for sure). - Intentionally used the deprecated constructor, as Umbraco core still uses it internally and the other constructor has too much ceremony. I'd rather let Umbraco core just "do it's thang". - Removed the new dependency references, as they aren't needed because we're using the deprecated constructor. - Disabled the compiler warnings for the obsolete call. I'm comfortable with this. --- .../Our.Umbraco.StackedContent.csproj | 2 -- .../StackedContentApiController.cs | 28 ++++++++----------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj b/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj index 45b4908..4ce5603 100644 --- a/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj +++ b/src/Our.Umbraco.StackedContent/Our.Umbraco.StackedContent.csproj @@ -43,9 +43,7 @@ False - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll False diff --git a/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs b/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs index f2f4c12..0753a05 100644 --- a/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs +++ b/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs @@ -2,15 +2,13 @@ using System.Net.Http; using System.Net.Http.Headers; using System.Net.Mime; -using System.Web; using System.Web.Http; -using System.Web.Security; using Newtonsoft.Json.Linq; using Our.Umbraco.InnerContent.Helpers; using Our.Umbraco.StackedContent.Models; using Our.Umbraco.StackedContent.Web.Helpers; -using Umbraco.Core.Configuration; using Umbraco.Core.Models; +using Umbraco.Web; using Umbraco.Web.Mvc; using Umbraco.Web.Routing; using Umbraco.Web.WebApi; @@ -36,21 +34,17 @@ public HttpResponseMessage GetPreviewMarkup([FromBody] JObject item, int pageId) page = new UnpublishedContent(pageId, Services); } - var baseUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Path, "/"); - var umbUrl = baseUrl + page.Url.TrimStart('/'); - - var pcr = new PublishedContentRequest( - new Uri(umbUrl), - UmbracoContext.RoutingContext, - UmbracoConfig.For.UmbracoSettings().WebRouting, - s => Roles.Provider.GetRolesForUser(s) - ); - - UmbracoContext.PublishedContentRequest = pcr; - UmbracoContext.PublishedContentRequest.PublishedContent = page; - - pcr.Prepare(); + // Ensure PublishedContentRequest exists, just in case there are any RTE Macros to render + if (UmbracoContext.PublishedContentRequest == null) + { +#pragma warning disable CS0618 // Type or member is obsolete + var pcr = new PublishedContentRequest(new Uri(page.UrlAbsolute()), UmbracoContext.RoutingContext); +#pragma warning restore CS0618 // Type or member is obsolete + UmbracoContext.PublishedContentRequest = pcr; + UmbracoContext.PublishedContentRequest.PublishedContent = page; + UmbracoContext.PublishedContentRequest.Prepare(); + } } // Convert item From 8a2d653cd785495e845599d20d66d9107d4bf401 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 12 Dec 2018 11:06:35 +0000 Subject: [PATCH 5/7] Consolidated code to use a nullable operator Added TODO comment to review the preview code, for handling multiple calls on the same content page/node. --- .../Web/Controllers/StackedContentApiController.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs b/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs index 0753a05..c64e8b4 100644 --- a/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs +++ b/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs @@ -26,13 +26,9 @@ public HttpResponseMessage GetPreviewMarkup([FromBody] JObject item, int pageId) // If the page is new, then the ID will be zero if (pageId > 0) { - // Get page container node - page = UmbracoContext.ContentCache.GetById(pageId); - if (page == null) - { - // If unpublished, then fake PublishedContent (with IContent object) - page = new UnpublishedContent(pageId, Services); - } + // TODO: Review. Previewing multiple blocks on the same page will make subsequent calls to the ContentService. Is it cacheable? [LK:2018-12-12] + // Get page container node, otherwise it's unpublished then fake PublishedContent (by IContent object) + page = UmbracoContext.ContentCache.GetById(pageId) ?? new UnpublishedContent(pageId, Services); // Ensure PublishedContentRequest exists, just in case there are any RTE Macros to render if (UmbracoContext.PublishedContentRequest == null) From ff7b0c8811f900cc09c99db1b68eca4668d3c5fd Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 12 Dec 2018 13:20:57 +0000 Subject: [PATCH 6/7] Added TODO (code review) notes --- .../Web/Controllers/StackedContentApiController.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs b/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs index c64e8b4..32ed8b5 100644 --- a/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs +++ b/src/Our.Umbraco.StackedContent/Web/Controllers/StackedContentApiController.cs @@ -43,8 +43,10 @@ public HttpResponseMessage GetPreviewMarkup([FromBody] JObject item, int pageId) } } + // TODO: Review. The values in `item` are the "editor values", whereas for prevalue-based editors, the converter is expecting the "database value". [LK:2018-12-12] + // Convert item - var content = InnerContentHelper.ConvertInnerContentToPublishedContent(item, page); + var content = InnerContentHelper.ConvertInnerContentToPublishedContent(item, page, preview: true); // Construct preview model var model = new PreviewModel { Page = page, Item = content }; From f6d880b8d7ec0829fe4e7b35376dee3889fc4f4e Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 13 Dec 2018 16:40:01 +0000 Subject: [PATCH 7/7] Disabled the NuGet symbols deploy Apparently the SSL certificate for SymbolSource has expired, throwing a build error for our NuGet deploy. re: https://github.com/NuGet/Home/issues/6082#issuecomment-443633928 --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 3a1f6da..feb434d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,6 +46,7 @@ deploy: # NuGet Deployment for releases - provider: NuGet server: + skip_symbols: true api_key: secure: vEophXSqus5F60LRBY4/j1l6K/S5+n3/yYpiID3O7JJW1gyj+0q0enuHhN3tgdhl artifact: /.*\.nupkg/