Quantcast
Channel: Customized Commerce 13 and earlier versions
Viewing all articles
Browse latest Browse all 9642

The expired page is still displayed

$
0
0
I have a problem which consists of it that the page that is not in the master language, despite setting it as expired, is still visible (sic!)

The page has several languages:
- "en" is master language and the page is active.
- "ru-RU" is set as expired

It seems that the page expiration check is based on the master language.
Call stack ExpiredRoutedContentEvaluator:

The below value of  routedContentData was passed to ExpiredRoutedContentEvaluator

  {EPiServer.Web.Routing.ContentRouteData}
    Content: {ID = 108085, Name = \\\"Name\\\", Page Type = \\\"HomePage\\\"}
    MatchedHost: {https://localhost:49928/, en-US (Primary)}
    PartialRoutedObject: null
    RemainingPath: ""
    RouteLanguage: "ru-RU"

ExpiredRoutedContentEvaluator:
namespace EPiServer.Web.Routing.Internal
{
  internal class ExpiredRoutedContentEvaluator : IRoutedContentEvaluator
  {
    private readonly IRoutableEvaluator _routableEvaluator;
    public ExpiredRoutedContentEvaluator(IRoutableEvaluator routableEvaluator) => this._routableEvaluator = routableEvaluator;
    public Task<RoutedContentEvaluationResult> EvaluateRoutedContentAsync(
      ContentRouteData routedContentData)
    {
      return Task.FromResult<RoutedContentEvaluationResult>(this._routableEvaluator.IsRoutable(routedContentData.Content) ? RoutedContentEvaluationResult.OK : RoutedContentEvaluationResult.NotFound);
    }
  }
}
 
In DefaultPublishedStateAssessor the master language is evaluated, not ru-RU which makes the site still available.
the cast content on IVersionable causes the content is in the master language.
    protected virtual bool IsPublishedCore(
      IContent content,
      PublishedStateCondition condition,
      ISet<ContentReference> checkedContent)
    {
      if (content == null)
        throw new ArgumentNullException(nameof (content));
      if (checkedContent == null)
        checkedContent = (ISet<ContentReference>) new HashSet<ContentReference>((IEqualityComparer<ContentReference>) ContentReferenceComparer.IgnoreVersion);
      checkedContent.Add(content.ContentLink);
      if (!condition.HasFlag((Enum) PublishedStateCondition.IgnoreDeleted) && content.IsDeleted)
        return false;
      if (content is IVersionable versionable)
      {
        int num = this.ContentIsReplacedByProject(content) ? 1 : 0;
        DateTime requestTime = this._timeProvider.RequestTime;
        if (num == 0)
        {
          if (versionable.IsPendingPublish || versionable.Status != VersionStatus.Published)
            return false;
          if (!condition.HasFlag((Enum) PublishedStateCondition.IgnoreStartPublish) && versionable.StartPublish.HasValue)
          {
            DateTime? startPublish = versionable.StartPublish;
            DateTime dateTime = requestTime;
            if ((startPublish.HasValue ? (startPublish.GetValueOrDefault() > dateTime ? 1 : 0) : 0) != 0)
              return false;
          }
        }
        if (!condition.HasFlag((Enum) PublishedStateCondition.IgnoreStopPublish) && versionable.StopPublish.HasValue)
        {
          DateTime? stopPublish = versionable.StopPublish;
          DateTime dateTime = requestTime;
          if ((stopPublish.HasValue ? (stopPublish.GetValueOrDefault() < dateTime ? 1 : 0) : 0) != 0)
            return false;
        }
      }
      if (!condition.HasFlag((Enum) PublishedStateCondition.IgnoreLinkedContentState))
      {
        IContent fetchedContent = this.GetFetchedContent(content, (ICollection<ContentReference>) checkedContent);
        if (fetchedContent != null)
          return this.IsPublishedCore(fetchedContent, condition, checkedContent);
      }
      return true;
    }




Viewing all articles
Browse latest Browse all 9642

Trending Articles