diff --git a/src/Umbraco.Core/Models/ContentExtensions.cs b/src/Umbraco.Core/Models/ContentExtensions.cs index bc155e313d..6a8ee044bf 100644 --- a/src/Umbraco.Core/Models/ContentExtensions.cs +++ b/src/Umbraco.Core/Models/ContentExtensions.cs @@ -366,22 +366,6 @@ namespace Umbraco.Core.Models } #endregion - internal static bool IsInRecycleBin(this IContent content) - { - return IsInRecycleBin(content, Constants.System.RecycleBinContent); - } - - internal static bool IsInRecycleBin(this IMedia media) - { - return IsInRecycleBin(media, Constants.System.RecycleBinMedia); - } - - internal static bool IsInRecycleBin(this IContentBase content, int recycleBinId) - { - return content.Path.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) - .Contains(recycleBinId.ToInvariantString()); - } - /// /// Removes characters that are not valide XML characters from all entity properties /// of type string. See: http://stackoverflow.com/a/961504/5018 diff --git a/src/Umbraco.Tests/Models/ContentTests.cs b/src/Umbraco.Tests/Models/ContentTests.cs index 7b2863d583..0f2ba9994e 100644 --- a/src/Umbraco.Tests/Models/ContentTests.cs +++ b/src/Umbraco.Tests/Models/ContentTests.cs @@ -37,50 +37,6 @@ namespace Umbraco.Tests.Models } - [TestCase("-1,-20,12,34,56", false)] - [TestCase("-1,-21,12,34,56", true)] - [TestCase("-1,12,34,56", false)] - public void Is_Media_In_Recycle_Bin(string path, bool isInBin) - { - var mediaType = MockedContentTypes.CreateImageMediaType(); - var media = MockedMedia.CreateMediaFile(mediaType, -1); - - // this is NOT how we should do it, we should "move to recycle bin" - // as it causes various things to change... IsInRecycleBin looks for - // the path but Trashed looks for the flag! - // fixme .Trashed is weird anyways, should be refactored - media.Path = path; - ((Media)media).Trashed = isInBin; - - media.Id = 34; - - Assert.AreEqual(isInBin, media.IsInRecycleBin()); - if (isInBin) - Assert.IsTrue(media.Trashed); - } - - [TestCase("-1,-20,12,34,56", true)] - [TestCase("-1,-21,12,34,56", false)] - [TestCase("-1,12,34,56", false)] - public void Is_Content_In_Recycle_Bin(string path, bool isInBin) - { - var contentType = MockedContentTypes.CreateSimpleContentType(); - var content = MockedContent.CreateSimpleContent(contentType); - - // this is NOT how we should do it, we should "move to recycle bin" - // as it causes various things to change... IsInRecycleBin looks for - // the path but Trashed looks for the flag! - // fixme .Trashed is weird anyways, should be refactored - content.Path = path; - content.Trashed = isInBin; - - content.Id = 34; - - Assert.AreEqual(isInBin, content.IsInRecycleBin()); - if (isInBin) - Assert.IsTrue(content.Trashed); - } - [Test] public void Get_Non_Grouped_Properties() { diff --git a/src/Umbraco.Tests/Services/ContentServiceTests.cs b/src/Umbraco.Tests/Services/ContentServiceTests.cs index deaa39435d..c8774e0109 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTests.cs @@ -1384,7 +1384,7 @@ namespace Umbraco.Tests.Services Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName, TestObjects.GetDefaultSqlSyntaxProviders(Logger), Logger, - new TestScopeContextAdapter(), + new TestScopeContextAdapter(), MappingResolver); var repositoryFactory = MockRepositoryFactory(); var provider = new NPocoUnitOfWorkProvider(databaseFactory, repositoryFactory); diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index 5733427269..9d53cc1b63 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -431,7 +431,7 @@ namespace Umbraco.Web.Editors } //if the current item is in the recycle bin - if (foundContent.IsInRecycleBin() == false) + if (foundContent.Trashed == false) { var moveResult = Services.ContentService.WithResult().MoveToRecycleBin(foundContent, Security.GetUserId()); if (moveResult == false) diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs index 3c7e151473..06badfafda 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -237,7 +237,7 @@ namespace Umbraco.Web.Editors } //if the current item is in the recycle bin - if (foundMedia.IsInRecycleBin() == false) + if (foundMedia.Trashed == false) { var moveResult = Services.MediaService.WithResult().MoveToRecycleBin(foundMedia, (int)Security.CurrentUser.Id); if (moveResult == false)