mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-04-20 03:40:49 +02:00
Fixed: Sync on a mass Indexer edit
This commit is contained in:
parent
6f25e1e6a2
commit
a3f7b169c9
3 changed files with 26 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ public class ApplicationService : IHandleAsync<ProviderAddedEvent<IIndexer>>,
|
|||
IHandleAsync<ProviderDeletedEvent<IIndexer>>,
|
||||
IHandleAsync<ProviderAddedEvent<IApplication>>,
|
||||
IHandleAsync<ProviderUpdatedEvent<IIndexer>>,
|
||||
IHandleAsync<ProviderBulkUpdatedEvent<IIndexer>>,
|
||||
IHandleAsync<ApiKeyChangedEvent>,
|
||||
IExecute<ApplicationIndexerSyncCommand>
|
||||
{
|
||||
|
|
@ -86,6 +87,15 @@ public void HandleAsync(ApiKeyChangedEvent message)
|
|||
SyncIndexers(enabledApps, indexers);
|
||||
}
|
||||
|
||||
public void HandleAsync(ProviderBulkUpdatedEvent<IIndexer> message)
|
||||
{
|
||||
var enabledApps = _applicationsFactory.SyncEnabled();
|
||||
|
||||
var indexers = message.Definitions.Select(d => (IndexerDefinition)d).ToList();
|
||||
|
||||
SyncIndexers(enabledApps, indexers);
|
||||
}
|
||||
|
||||
public void Execute(ApplicationIndexerSyncCommand message)
|
||||
{
|
||||
var enabledApps = _applicationsFactory.SyncEnabled();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
using System.Collections.Generic;
|
||||
using NzbDrone.Common.Messaging;
|
||||
|
||||
namespace NzbDrone.Core.ThingiProvider.Events
|
||||
{
|
||||
public class ProviderBulkUpdatedEvent<TProvider> : IEvent
|
||||
{
|
||||
public IEnumerable<ProviderDefinition> Definitions { get; private set; }
|
||||
|
||||
public ProviderBulkUpdatedEvent(IEnumerable<ProviderDefinition> definitions)
|
||||
{
|
||||
Definitions = definitions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -113,6 +113,7 @@ public virtual void Update(TProviderDefinition definition)
|
|||
public virtual void Update(IEnumerable<TProviderDefinition> definitions)
|
||||
{
|
||||
_providerRepository.UpdateMany(definitions.ToList());
|
||||
_eventAggregator.PublishEvent(new ProviderBulkUpdatedEvent<TProvider>(definitions));
|
||||
}
|
||||
|
||||
public void Delete(int id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue