mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-04-30 08:40:48 +02:00
Fixed: Don't delete tags used by indexer proxies
This commit is contained in:
parent
46e1cce632
commit
1d20b9d429
2 changed files with 28 additions and 1 deletions
|
|
@ -2,6 +2,8 @@
|
|||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.IndexerProxies;
|
||||
using NzbDrone.Core.IndexerProxies.Http;
|
||||
using NzbDrone.Core.Tags;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
@ -22,5 +24,30 @@ public void should_delete_unused_tags()
|
|||
Subject.Clean();
|
||||
AllStoredModels.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_delete_used_tags()
|
||||
{
|
||||
var tags = Builder<Tag>
|
||||
.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(x => x.Id = 0)
|
||||
.BuildList();
|
||||
|
||||
Db.InsertMany(tags);
|
||||
|
||||
var settings = Builder<HttpSettings>.CreateNew().Build();
|
||||
|
||||
var restrictions = Builder<IndexerProxyDefinition>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(x => x.Id = 0)
|
||||
.With(x => x.Settings = settings)
|
||||
.With(v => v.Tags.Add(tags[0].Id))
|
||||
.BuildList();
|
||||
Db.InsertMany(restrictions);
|
||||
|
||||
Subject.Clean();
|
||||
AllStoredModels.Should().HaveCount(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public void Clean()
|
|||
{
|
||||
using (var mapper = _database.OpenConnection())
|
||||
{
|
||||
var usedTags = new[] { "Notifications" }
|
||||
var usedTags = new[] { "Notifications", "IndexerProxies", "Indexers", "Applications" }
|
||||
.SelectMany(v => GetUsedTags(v, mapper))
|
||||
.Distinct()
|
||||
.ToArray();
|
||||
|
|
|
|||
Loading…
Reference in a new issue