Skip to content
This repository has been archived by the owner on Dec 13, 2021. It is now read-only.

Commit

Permalink
Merge pull request #58 from umco/develop
Browse files Browse the repository at this point in the history
Preparing v2.0.2 release
  • Loading branch information
leekelleher authored Dec 13, 2018
2 parents 941e1e1 + f6d880b commit 61dbe2d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
5 changes: 3 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -46,8 +46,9 @@ deploy:
# NuGet Deployment for releases
- provider: NuGet
server:
skip_symbols: true
api_key:
secure: 0+oAleUTnr9UuJrhLW5rphRR+QGz00XX1Ui3k5kwyr2kUdEamiQ3F+gW0q8MJbDT
secure: vEophXSqus5F60LRBY4/j1l6K/S5+n3/yYpiID3O7JJW1gyj+0q0enuHhN3tgdhl
artifact: /.*\.nupkg/
on:
branch: master
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Net.Http;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Mime;
using System.Web.Http;
Expand All @@ -7,7 +8,9 @@
using Our.Umbraco.StackedContent.Models;
using Our.Umbraco.StackedContent.Web.Helpers;
using Umbraco.Core.Models;
using Umbraco.Web;
using Umbraco.Web.Mvc;
using Umbraco.Web.Routing;
using Umbraco.Web.WebApi;

namespace Our.Umbraco.StackedContent.Web.Controllers
Expand All @@ -23,17 +26,27 @@ 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)
// 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)
{
// If unpublished, then fake PublishedContent (with IContent object)
page = new UnpublishedContent(pageId, Services);
#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();
}
}

// 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 };
Expand Down

0 comments on commit 61dbe2d

Please sign in to comment.