app/controllers/maestrano/synchronizations_controller.rb in maestrano-connector-rails-2.1.3 vs app/controllers/maestrano/synchronizations_controller.rb in maestrano-connector-rails-2.2.0

- old
+ new

@@ -15,9 +15,12 @@ uid = params[:group_id] opts = params[:opts] || {} organization = Maestrano::Connector::Rails::Organization.find_by(uid: uid, tenant: tenant) return render json: {errors: [{message: 'Organization not found', code: 404}]}, status: :not_found unless organization + organization.sync_enabled = organization.synchronized_entities.values.any? { |settings| settings.values.any? { |v| v } } + organization.save if organization.sync_enabled_changed? + status = organization_status(organization) unless %w[RUNNING ENQUEUED].include?(status) Maestrano::Connector::Rails::SynchronizationJob.perform_later(organization.id, opts.with_indifferent_access) status = 'ENQUEUED'