mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
Fixed: Correctly delete trackfiles on AlbumDeletedEvent
GetFilesByAlbum performs a join on the album releases under the hood, which won't be populated once the album is deleted. Fix by providing a special delete method which omits the join and just looks at albumId.
This commit is contained in:
@@ -6,6 +6,7 @@ using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
@@ -140,5 +141,14 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
file.Artist.Value.Metadata.Value.Should().NotBeNull();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void delete_files_by_album_should_work_if_join_fails()
|
||||
{
|
||||
Db.Delete(album);
|
||||
Subject.DeleteFilesByAlbum(album.Id);
|
||||
|
||||
Db.All<TrackFile>().Where(x => x.AlbumId == album.Id).Should().HaveCount(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user