diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs index eebb332f65..ab52e1fa53 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs @@ -574,7 +574,7 @@ namespace Umbraco.Core.Persistence.Repositories if (tagProp.TagSupport.Behavior == PropertyTagBehavior.Remove) { //remove the specific tags - _tagRepository.RemoveTagsFromProperty( + _tagRepository.RemovePublishedTagsFromProperty( entity.Id, tagProp.Alias, tagProp.TagSupport.Tags.Select(x => new Tag { Text = x.Item1, Group = x.Item2 })); @@ -582,7 +582,7 @@ namespace Umbraco.Core.Persistence.Repositories else { //assign the tags - _tagRepository.AssignTagsToProperty( + _tagRepository.AssignPublishedTagsToProperty( entity.Id, tagProp.Alias, tagProp.TagSupport.Tags.Select(x => new Tag { Text = x.Item1, Group = x.Item2 }), diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITagsRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITagsRepository.cs index e060b8c285..0629c0ecb7 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITagsRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/ITagsRepository.cs @@ -11,7 +11,7 @@ namespace Umbraco.Core.Persistence.Repositories /// /// The content item id to get tags for /// - IEnumerable GetTagsForContent(int contentId); + IEnumerable GetPublishedTagsForContent(int contentId); /// /// Returns all tags that exist on the content item for the property specified - Content/Media/Member @@ -19,7 +19,7 @@ namespace Umbraco.Core.Persistence.Repositories /// The content item id to get tags for /// The property alias to get tags for /// - IEnumerable GetTagsForProperty(int contentId, string propertyAlias); + IEnumerable GetPublishedTagsForProperty(int contentId, string propertyAlias); /// /// Assigns the given tags to a content item's property @@ -35,7 +35,7 @@ namespace Umbraco.Core.Persistence.Repositories /// /// This can also be used to remove all tags from a property by specifying replaceTags = true and an empty tag list. /// - void AssignTagsToProperty(int contentId, string propertyAlias, IEnumerable tags, bool replaceTags); + void AssignPublishedTagsToProperty(int contentId, string propertyAlias, IEnumerable tags, bool replaceTags); /// /// Removes any of the given tags from the property association @@ -43,6 +43,6 @@ namespace Umbraco.Core.Persistence.Repositories /// /// /// The tags to remove from the property - void RemoveTagsFromProperty(int contentId, string propertyAlias, IEnumerable tags); + void RemovePublishedTagsFromProperty(int contentId, string propertyAlias, IEnumerable tags); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/TagsRepository.cs b/src/Umbraco.Core/Persistence/Repositories/TagsRepository.cs index 8c68d6cdb5..62f1c8792d 100644 --- a/src/Umbraco.Core/Persistence/Repositories/TagsRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/TagsRepository.cs @@ -160,7 +160,7 @@ namespace Umbraco.Core.Persistence.Repositories //TODO: Consider caching implications. - public IEnumerable GetTagsForContent(int contentId) + public IEnumerable GetPublishedTagsForContent(int contentId) { var sql = new Sql() .Select("DISTINCT cmsTags.*") @@ -174,7 +174,7 @@ namespace Umbraco.Core.Persistence.Repositories return Database.Fetch(sql).Select(factory.BuildEntity); } - public IEnumerable GetTagsForProperty(int contentId, string propertyAlias) + public IEnumerable GetPublishedTagsForProperty(int contentId, string propertyAlias) { var sql = new Sql() .Select("DISTINCT cmsTags.*") @@ -205,7 +205,7 @@ namespace Umbraco.Core.Persistence.Repositories /// /// This can also be used to remove all tags from a property by specifying replaceTags = true and an empty tag list. /// - public void AssignTagsToProperty(int contentId, string propertyAlias, IEnumerable tags, bool replaceTags) + public void AssignPublishedTagsToProperty(int contentId, string propertyAlias, IEnumerable tags, bool replaceTags) { //First we need to ensure there are no duplicates var asArray = tags.Distinct(new TagComparer()).ToArray(); @@ -294,7 +294,7 @@ namespace Umbraco.Core.Persistence.Repositories /// /// /// The tags to remove from the property - public void RemoveTagsFromProperty(int contentId, string propertyAlias, IEnumerable tags) + public void RemovePublishedTagsFromProperty(int contentId, string propertyAlias, IEnumerable tags) { var propertyTypeId = EnsureContentProperty(contentId, propertyAlias); diff --git a/src/Umbraco.Tests/Persistence/Repositories/TagRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/TagRepositoryTest.cs index d04ccbd9e7..8c1f18705e 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/TagRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/TagRepositoryTest.cs @@ -111,7 +111,7 @@ namespace Umbraco.Tests.Persistence.Repositories var unitOfWork = provider.GetUnitOfWork(); using (var repository = CreateRepository(unitOfWork)) { - Assert.Throws(() => repository.AssignTagsToProperty(1234, "hello", Enumerable.Empty(), true)); + Assert.Throws(() => repository.AssignPublishedTagsToProperty(1234, "hello", Enumerable.Empty(), true)); } } @@ -134,7 +134,7 @@ namespace Umbraco.Tests.Persistence.Repositories using (var repository = CreateRepository(unitOfWork)) { - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content.Id, contentType.PropertyTypes.First().Alias, new[] @@ -143,7 +143,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag2", Group = "test"}, }, false); - Assert.AreEqual(2, repository.GetTagsForContent(content.Id).Count()); + Assert.AreEqual(2, repository.GetPublishedTagsForContent(content.Id).Count()); } } } @@ -166,7 +166,7 @@ namespace Umbraco.Tests.Persistence.Repositories using (var repository = CreateRepository(unitOfWork)) { - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content.Id, contentType.PropertyTypes.First().Alias, new[] @@ -175,7 +175,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag2", Group = "test"}, }, false); - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content.Id, contentType.PropertyTypes.First().Alias, new[] @@ -184,7 +184,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag4", Group = "test"}, }, false); - Assert.AreEqual(4, repository.GetTagsForContent(content.Id).Count()); + Assert.AreEqual(4, repository.GetPublishedTagsForContent(content.Id).Count()); } } } @@ -207,7 +207,7 @@ namespace Umbraco.Tests.Persistence.Repositories using (var repository = CreateRepository(unitOfWork)) { - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content.Id, contentType.PropertyTypes.First().Alias, new[] @@ -216,7 +216,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag2", Group = "test"}, }, false); - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content.Id, contentType.PropertyTypes.First().Alias, new[] @@ -225,7 +225,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag4", Group = "test"}, }, true); - var result = repository.GetTagsForContent(content.Id); + var result = repository.GetPublishedTagsForContent(content.Id); Assert.AreEqual(2, result.Count()); Assert.AreEqual("tag3", result.ElementAt(0).Text); Assert.AreEqual("tag4", result.ElementAt(1).Text); @@ -251,7 +251,7 @@ namespace Umbraco.Tests.Persistence.Repositories using (var repository = CreateRepository(unitOfWork)) { - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content.Id, contentType.PropertyTypes.First().Alias, new[] @@ -260,7 +260,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag2", Group = "test"}, }, false); - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content.Id, contentType.PropertyTypes.First().Alias, new[] @@ -269,7 +269,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag3", Group = "test"}, }, false); - var result = repository.GetTagsForContent(content.Id); + var result = repository.GetPublishedTagsForContent(content.Id); Assert.AreEqual(3, result.Count()); } } @@ -293,7 +293,7 @@ namespace Umbraco.Tests.Persistence.Repositories using (var repository = CreateRepository(unitOfWork)) { - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content.Id, contentType.PropertyTypes.First().Alias, new[] @@ -302,12 +302,12 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag2", Group = "test"}, }, false); - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content.Id, contentType.PropertyTypes.First().Alias, Enumerable.Empty(), true); - var result = repository.GetTagsForContent(content.Id); + var result = repository.GetPublishedTagsForContent(content.Id); Assert.AreEqual(0, result.Count()); } } @@ -331,7 +331,7 @@ namespace Umbraco.Tests.Persistence.Repositories using (var repository = CreateRepository(unitOfWork)) { - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content.Id, contentType.PropertyTypes.First().Alias, new[] @@ -342,7 +342,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag4", Group = "test"} }, false); - repository.RemoveTagsFromProperty( + repository.RemovePublishedTagsFromProperty( content.Id, contentType.PropertyTypes.First().Alias, new[] @@ -351,7 +351,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag3", Group = "test"} }); - var result = repository.GetTagsForContent(content.Id); + var result = repository.GetPublishedTagsForContent(content.Id); Assert.AreEqual(2, result.Count()); Assert.AreEqual("tag1", result.ElementAt(0).Text); Assert.AreEqual("tag4", result.ElementAt(1).Text); @@ -379,7 +379,7 @@ namespace Umbraco.Tests.Persistence.Repositories using (var repository = CreateRepository(unitOfWork)) { - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content1.Id, contentType.PropertyTypes.First().Alias, new[] @@ -390,7 +390,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag4", Group = "test"} }, false); - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content2.Id, contentType.PropertyTypes.First().Alias, new[] @@ -399,7 +399,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag2", Group = "test"} }, false); - var result = repository.GetTagsForContent(content2.Id); + var result = repository.GetPublishedTagsForContent(content2.Id); Assert.AreEqual(2, result.Count()); } } @@ -423,7 +423,7 @@ namespace Umbraco.Tests.Persistence.Repositories using (var repository = CreateRepository(unitOfWork)) { - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content1.Id, contentType.PropertyTypes.First().Alias, new[] @@ -434,7 +434,7 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag4", Group = "test"} }, false); - repository.AssignTagsToProperty( + repository.AssignPublishedTagsToProperty( content1.Id, contentType.PropertyTypes.Last().Alias, new[] @@ -443,8 +443,8 @@ namespace Umbraco.Tests.Persistence.Repositories new Tag {Text = "tag2", Group = "test"} }, false); - var result1 = repository.GetTagsForProperty(content1.Id, contentType.PropertyTypes.First().Alias).ToArray(); - var result2 = repository.GetTagsForProperty(content1.Id, contentType.PropertyTypes.Last().Alias).ToArray(); + var result1 = repository.GetPublishedTagsForProperty(content1.Id, contentType.PropertyTypes.First().Alias).ToArray(); + var result2 = repository.GetPublishedTagsForProperty(content1.Id, contentType.PropertyTypes.Last().Alias).ToArray(); Assert.AreEqual(2, result2.Count()); } }