Fixed: UI updates when new author book monitor state set

Fixes #1298
pull/1332/head
ta264 3 years ago
parent 2983b60026
commit a1c2986af8

@ -80,7 +80,7 @@ namespace NzbDrone.Core.Test.MusicTests.BookMonitoredServiceTests
Subject.SetBookMonitoredStatus(_author, new MonitoringOptions { Monitor = MonitorTypes.All }); Subject.SetBookMonitoredStatus(_author, new MonitoringOptions { Monitor = MonitorTypes.All });
Mocker.GetMock<IBookService>() Mocker.GetMock<IBookService>()
.Verify(v => v.UpdateMany(It.Is<List<Book>>(l => l.All(e => e.Monitored)))); .Verify(v => v.UpdateBook(It.Is<Book>(l => l.Monitored)), Times.Exactly(_books.Count));
} }
[Test] [Test]
@ -101,13 +101,13 @@ namespace NzbDrone.Core.Test.MusicTests.BookMonitoredServiceTests
private void VerifyMonitored(Func<Book, bool> predicate) private void VerifyMonitored(Func<Book, bool> predicate)
{ {
Mocker.GetMock<IBookService>() Mocker.GetMock<IBookService>()
.Verify(v => v.UpdateMany(It.Is<List<Book>>(l => l.Where(predicate).All(e => e.Monitored)))); .Verify(v => v.UpdateBook(It.Is<Book>(b => b.Monitored)), Times.AtLeast(_books.Where(predicate).Count()));
} }
private void VerifyNotMonitored(Func<Book, bool> predicate) private void VerifyNotMonitored(Func<Book, bool> predicate)
{ {
Mocker.GetMock<IBookService>() Mocker.GetMock<IBookService>()
.Verify(v => v.UpdateMany(It.Is<List<Book>>(l => l.Where(predicate).All(e => !e.Monitored)))); .Verify(v => v.UpdateBook(It.Is<Book>(b => !b.Monitored)), Times.AtLeast(_books.Where(predicate).Count()));
} }
} }
} }

@ -86,7 +86,11 @@ namespace NzbDrone.Core.Books
} }
} }
_bookService.UpdateMany(books); // Use individual update to ensure updates are sent to frontend
foreach (var book in books)
{
_bookService.UpdateBook(book);
}
} }
_authorService.UpdateAuthor(author); _authorService.UpdateAuthor(author);

Loading…
Cancel
Save