public void DeleteSingleVariantProduct(VariationContent variant) { _log.Information("DeleteSingleVariantProduct: " + variant.Code); if (!_configuration.ProductsImportUrl.IsValidProductsImportUrl()) { _log.Information("Skipped single variant product delete because url is not valid: " + _configuration.ProductsImportUrl); return; } // Bail if not published if (!_publishedStateAssessor.IsPublished(variant)) { _log.Information("Skipped single variant product delete because it's not yet published"); return; } var ids = new List <string>(); ids.Add(variant.Code.SanitizeKey()); // Call the external endpoint asynchronously and return immediately. Task.Factory.StartNew(() => APIFacade.DeleteAsync( ids, _configuration.ProductsImportUrl) .ConfigureAwait(false)); }
public bool IsRoutable(IContent content) { if (_publishedStateAssessor.IsPublished(content)) { return(true); } var eventCheck = _pagePreviewEvents.IsRoutable?.Invoke(content); // used to check if conditions were met in partial routing return(eventCheck ?? _contextModeResolver.CurrentMode.EditOrPreview()); // perhaps one day we can get a FullPreview context mode! }
public bool IsPublished(IContent content, PublishedStateCondition condition) { if (ExternalReview.IsInExternalReviewContext && ExternalReview.CustomLoaded.Contains(content.ContentLink.ToString())) { var cachedContent = ExternalReview.GetCachedContent(_languageResolver.GetPreferredCulture(), content.ContentLink); if (cachedContent != null) { return(true); } } return(_defaultService.IsPublished(content, condition)); }
private ProjectExperimentMapping GetProjectExperimentMapping() { //Currently a single instance of experiment > project mapping stored as a ProjectExperimentMapping held at the site block root var projectMappings = _contentRepo.Value.GetChildren <ProjectExperimentMapping>(ContentReference.SiteBlockFolder); if (projectMappings != null) { if (_publishedStateAssessor.IsPublished(projectMappings.First() as IContent)) { return(projectMappings?.First()); } } return(null); }