fix: Install plugin to existing organizations after approval (#9840)
This commit is contained in:
parent
c58e60ee2c
commit
ab4add4b83
|
|
@ -200,8 +200,13 @@ public class PluginServiceCEImpl extends BaseService<PluginRepository, Plugin, S
|
|||
.collect(Collectors.toList());
|
||||
return organizationService.getAll()
|
||||
.flatMap(organization -> {
|
||||
organization.getPlugins().addAll(newOrganizationPlugins);
|
||||
return organizationService.save(organization);
|
||||
// Only perform a DB op if plugins associated to this org have changed
|
||||
if (organization.getPlugins().containsAll(newOrganizationPlugins)) {
|
||||
return Mono.just(organization);
|
||||
} else {
|
||||
organization.getPlugins().addAll(newOrganizationPlugins);
|
||||
return organizationService.save(organization);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,8 +69,17 @@ public class PluginScheduledTaskCEImpl implements PluginScheduledTaskCE {
|
|||
}
|
||||
});
|
||||
|
||||
final Mono<List<Plugin>> updatedPluginsFlux = pluginService.saveAll(updatablePlugins)
|
||||
// Save new data for this plugin,
|
||||
// then make sure to install to organizations in case the default installation flag changed
|
||||
final Mono<List<Organization>> updatedPluginsOrganizationFlux = pluginService
|
||||
.saveAll(updatablePlugins)
|
||||
.filter(Plugin::getDefaultInstall)
|
||||
.collectList()
|
||||
.flatMapMany(pluginService::installDefaultPlugins)
|
||||
.collectList();
|
||||
|
||||
// Create plugin,
|
||||
// then install to all organizations if default installation is turned on
|
||||
final Mono<List<Organization>> organizationFlux =
|
||||
Flux.fromIterable(insertablePlugins)
|
||||
.flatMap(pluginService::create)
|
||||
|
|
@ -79,7 +88,7 @@ public class PluginScheduledTaskCEImpl implements PluginScheduledTaskCE {
|
|||
.flatMapMany(pluginService::installDefaultPlugins)
|
||||
.collectList();
|
||||
|
||||
return updatedPluginsFlux
|
||||
return updatedPluginsOrganizationFlux
|
||||
.zipWith(organizationFlux)
|
||||
.then();
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user