diff --git a/src/Umbraco.Web/Editors/TemplateQueryController.cs b/src/Umbraco.Web/Editors/TemplateQueryController.cs index 2c38287d9a..b72992a9b0 100644 --- a/src/Umbraco.Web/Editors/TemplateQueryController.cs +++ b/src/Umbraco.Web/Editors/TemplateQueryController.cs @@ -83,6 +83,8 @@ namespace Umbraco.Web.Editors { var targetNode = umbraco.TypedContent(model.Source.Id); + //TODO: Null check!!!!!!!!!!!! + var aliases = this.GetChildContentTypeAliases(targetNode, currentPage).Reverse(); foreach (var contentTypeAlias in aliases) diff --git a/src/Umbraco.Web/TagQuery.cs b/src/Umbraco.Web/TagQuery.cs index ded4dea66e..807a0699cb 100644 --- a/src/Umbraco.Web/TagQuery.cs +++ b/src/Umbraco.Web/TagQuery.cs @@ -13,6 +13,11 @@ namespace Umbraco.Web /// public class TagQuery : ITagQuery { + + //TODO: This class also acts as a wrapper for ITagQuery due to breaking changes, need to fix in + // version 8: http://issues.umbraco.org/issue/U4-6899 + private readonly ITagQuery _wrappedQuery; + private readonly ITagService _tagService; private readonly ITypedPublishedContentQuery _typedContentQuery; @@ -22,7 +27,7 @@ namespace Umbraco.Web { } - [Obsolete("Use the alternate constructor specifying the ITypedPublishedContentQuery instead")] + [Obsolete("Use the alternate constructor specifying the ITypedPublishedContentQuery instead")] public TagQuery(ITagService tagService, PublishedContentQuery contentQuery) { if (tagService == null) throw new ArgumentNullException("tagService"); @@ -31,6 +36,16 @@ namespace Umbraco.Web _typedContentQuery = contentQuery; } + /// + /// Constructor for wrapping ITagQuery, see http://issues.umbraco.org/issue/U4-6899 + /// + /// + internal TagQuery(ITagQuery wrappedQuery) + { + if (wrappedQuery == null) throw new ArgumentNullException("wrappedQuery"); + _wrappedQuery = wrappedQuery; + } + /// /// Constructor /// @@ -52,6 +67,9 @@ namespace Umbraco.Web /// public IEnumerable GetContentByTag(string tag, string tagGroup = null) { + //TODO: http://issues.umbraco.org/issue/U4-6899 + if (_wrappedQuery != null) return _wrappedQuery.GetContentByTag(tag, tagGroup); + var ids = _tagService.GetTaggedContentByTag(tag, tagGroup) .Select(x => x.EntityId); return _typedContentQuery.TypedContent(ids) @@ -65,6 +83,9 @@ namespace Umbraco.Web /// public IEnumerable GetContentByTagGroup(string tagGroup) { + //TODO: http://issues.umbraco.org/issue/U4-6899 + if (_wrappedQuery != null) return _wrappedQuery.GetContentByTagGroup(tagGroup); + var ids = _tagService.GetTaggedContentByTagGroup(tagGroup) .Select(x => x.EntityId); return _typedContentQuery.TypedContent(ids) @@ -79,6 +100,9 @@ namespace Umbraco.Web /// public IEnumerable GetMediaByTag(string tag, string tagGroup = null) { + //TODO: http://issues.umbraco.org/issue/U4-6899 + if (_wrappedQuery != null) return _wrappedQuery.GetMediaByTag(tag, tagGroup); + var ids = _tagService.GetTaggedMediaByTag(tag, tagGroup) .Select(x => x.EntityId); return _typedContentQuery.TypedMedia(ids) @@ -92,6 +116,9 @@ namespace Umbraco.Web /// public IEnumerable GetMediaByTagGroup(string tagGroup) { + //TODO: http://issues.umbraco.org/issue/U4-6899 + if (_wrappedQuery != null) return _wrappedQuery.GetMediaByTagGroup(tagGroup); + var ids = _tagService.GetTaggedMediaByTagGroup(tagGroup) .Select(x => x.EntityId); return _typedContentQuery.TypedMedia(ids) @@ -113,6 +140,9 @@ namespace Umbraco.Web /// public IEnumerable GetAllTags(string group = null) { + //TODO: http://issues.umbraco.org/issue/U4-6899 + if (_wrappedQuery != null) return _wrappedQuery.GetAllTags(group); + return Mapper.Map>(_tagService.GetAllTags(group)); } @@ -123,6 +153,9 @@ namespace Umbraco.Web /// public IEnumerable GetAllContentTags(string group = null) { + //TODO: http://issues.umbraco.org/issue/U4-6899 + if (_wrappedQuery != null) return _wrappedQuery.GetAllContentTags(group); + return Mapper.Map>(_tagService.GetAllContentTags(group)); } @@ -133,6 +166,9 @@ namespace Umbraco.Web /// public IEnumerable GetAllMediaTags(string group = null) { + //TODO: http://issues.umbraco.org/issue/U4-6899 + if (_wrappedQuery != null) return _wrappedQuery.GetAllMediaTags(group); + return Mapper.Map>(_tagService.GetAllMediaTags(group)); } @@ -143,6 +179,9 @@ namespace Umbraco.Web /// public IEnumerable GetAllMemberTags(string group = null) { + //TODO: http://issues.umbraco.org/issue/U4-6899 + if (_wrappedQuery != null) return _wrappedQuery.GetAllMemberTags(group); + return Mapper.Map>(_tagService.GetAllMemberTags(group)); } @@ -155,6 +194,9 @@ namespace Umbraco.Web /// public IEnumerable GetTagsForProperty(int contentId, string propertyTypeAlias, string tagGroup = null) { + //TODO: http://issues.umbraco.org/issue/U4-6899 + if (_wrappedQuery != null) return _wrappedQuery.GetTagsForProperty(contentId, propertyTypeAlias, tagGroup); + return Mapper.Map>(_tagService.GetTagsForProperty(contentId, propertyTypeAlias, tagGroup)); } @@ -166,6 +208,9 @@ namespace Umbraco.Web /// public IEnumerable GetTagsForEntity(int contentId, string tagGroup = null) { + //TODO: http://issues.umbraco.org/issue/U4-6899 + if (_wrappedQuery != null) return _wrappedQuery.GetTagsForEntity(contentId, tagGroup); + return Mapper.Map>(_tagService.GetTagsForEntity(contentId, tagGroup)); } } diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index 53a4474827..e407edda4f 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -32,7 +32,7 @@ namespace Umbraco.Web private IUmbracoComponentRenderer _componentRenderer; private PublishedContentQuery _query; private MembershipHelper _membershipHelper; - private ITagQuery _tag; + private TagQuery _tag; private IDataTypeService _dataTypeService; private UrlProvider _urlProvider; private ICultureDictionary _cultureDictionary; @@ -40,8 +40,12 @@ namespace Umbraco.Web /// /// Lazy instantiates the tag context /// - public ITagQuery TagQuery + public TagQuery TagQuery { + //TODO: Unfortunately we cannot change this return value to be ITagQuery + // since it's a breaking change, need to fix it for v8 + // http://issues.umbraco.org/issue/U4-6899 + get { return _tag ?? @@ -159,7 +163,7 @@ namespace Umbraco.Web if (membershipHelper == null) throw new ArgumentNullException("membershipHelper"); _umbracoContext = umbracoContext; - _tag = tagQuery; + _tag = new TagQuery(tagQuery); _dataTypeService = dataTypeService; _urlProvider = urlProvider; _cultureDictionary = cultureDictionary;