示例#1
0
 public ContentTreeChangeNotification(
     IContent target,
     TreeChangeTypes changeTypes,
     EventMessages messages)
     : base(new TreeChange <IContent>(target, changeTypes), messages)
 {
 }
示例#2
0
 public ContentTreeChangeNotification(
     IEnumerable <IContent> target,
     TreeChangeTypes changeTypes,
     EventMessages messages)
     : base(target.Select(x => new TreeChange <IContent>(x, changeTypes)), messages)
 {
 }
示例#3
0
        private void RefreshById(int id, TreeChangeTypes changeTypes)
        {
            var item = _umbracoContextAccessor?.UmbracoContext?.Content.GetById(id);

            // if it's directly related to an articulate node
            if (item != null && item.ContentType.Alias.InvariantEquals(ArticulateContentTypeAlias))
            {
                //ensure routes are rebuilt
                _appCaches.RequestCache.GetCacheItem(RefreshRoutesToken, () => true);
                return;
            }

            // We need to handle cases where the state of siblings at a lower sort order directly affect an Articulate node's routing.
            // This will happen on copy, move, sort, unpublish, delete
            if (item == null)
            {
                item = _umbracoContextAccessor?.UmbracoContext?.Content.GetById(true, id);

                // This will occur on delete, then what?
                // TODO: How would we know this is a node that might be at the same level/above?
                // For now we have no choice, rebuild routes on each delete :/
                if (item == null)
                {
                    _appCaches.RequestCache.GetCacheItem(RefreshRoutesToken, () => true);
                    return;
                }
            }

            var articulateContentType = _umbracoContextAccessor?.UmbracoContext?.Content.GetContentType(ArticulateContentTypeAlias);

            if (articulateContentType != null)
            {
                var articulateNodes = _umbracoContextAccessor?.UmbracoContext?.Content.GetByContentType(articulateContentType);
                foreach (var node in articulateNodes)
                {
                    // if the item is same level with a lower sort order it can directly affect the articulate node's route
                    if (node.Level == item.Level && node.SortOrder > item.SortOrder)
                    {
                        //ensure routes are rebuilt
                        _appCaches.RequestCache.GetCacheItem(RefreshRoutesToken, () => true);
                        return;
                    }
                }
            }
        }
 public JsonPayload(int id, TreeChangeTypes changeTypes)
 {
     Id          = id;
     ChangeTypes = changeTypes;
 }
 public JsonPayload(int id, Guid?key, TreeChangeTypes changeTypes)
 {
     Id          = id;
     Key         = key;
     ChangeTypes = changeTypes;
 }
 public static bool HasTypesNone(this TreeChangeTypes change, TreeChangeTypes types)
 {
     return((change & types) == TreeChangeTypes.None);
 }
 public static bool HasTypesAll(this TreeChangeTypes change, TreeChangeTypes types)
 {
     return((change & types) == types);
 }
示例#8
0
 public TreeChange(TItem changedItem, TreeChangeTypes changeTypes)
 {
     Item        = changedItem;
     ChangeTypes = changeTypes;
 }
 public static bool HasTypesNone(this TreeChangeTypes change, TreeChangeTypes types) =>
 (change & types) == TreeChangeTypes.None;
 public static bool HasTypesAll(this TreeChangeTypes change, TreeChangeTypes types) => (change & types) == types;
 public MediaTreeChangeNotification(IMedia target, TreeChangeTypes changeTypes, EventMessages messages)
     : base(new TreeChange <IMedia>(target, changeTypes), messages)
 {
 }