1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

Merge branch 'dev' for release 4.5.2

This commit is contained in:
Sylvain 2020-07-01 18:13:12 +02:00
commit bbca57c888
11 changed files with 43 additions and 27 deletions

View File

@ -1,5 +1,14 @@
# Changelog Fab-manager
## v4.5.2 2020 July 1st
- Fix a bug: unable to set stripe public key in production
- Fix a bug: health API is broken if ElasticSearch is not present
- Fix a bug: unable to sync members with stripe
- Fix a bug: version check is not working
- Fix a bug: enabling auth_provider from the tests happens twice in coverall context
- [TODO DEPLOY] `rails fablab:maintenance:clean_workers`
## v4.5.1 2020 July 1st
- Ability to run the upgrade without interactions

View File

@ -1320,13 +1320,13 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
/* PUBLIC SCOPE */
// public key
$scope.publicKey = stripeKeys.stripe_public_key;
$scope.publicKey = stripeKeys.stripe_public_key || '';
// test status of the public key
$scope.publicKeyStatus = undefined;
// secret key
$scope.secretKey = stripeKeys.stripe_secret_key;
$scope.secretKey = stripeKeys.stripe_secret_key || '';
// test status of the secret key
$scope.secretKeyStatus = undefined;
@ -1370,10 +1370,7 @@ Application.Controllers.controller('StripeKeysModalController', ['$scope', '$uib
'Content-Type': 'application/x-www-form-urlencoded'
},
data: $httpParamSerializerJQLike({
'card[number]': 4242424242424242,
'card[cvc]': 123,
'card[exp_month]': 12,
'card[exp_year]': today.getFullYear().toString().substring(2),
'pii[id_number]': 'test',
})
}).then(function () {
$scope.publicKeyStatus = true;

View File

@ -25,6 +25,8 @@ class HealthService
!!response.body # rubocop:disable Style/DoubleNegation
rescue Elasticsearch::Transport::Transport::Error
false
rescue Faraday::ConnectionFailed
false
end
def self.migrations?

View File

@ -74,7 +74,7 @@ module Fablab
plugins&.each(&:notify_after_initialize)
require 'version'
Version.check_and_schedule
Version.check
end
end
end

View File

@ -37,6 +37,14 @@ close_period_reminder_worker:
free_disk_space:
cron: "0 5 * * 0" # every sunday at 5am
class: "FreeDiskSpaceWorker"
queue: default
queue: system
# schedule a version check, every week at the current day+time
# this will prevent that all the instances query the hub simultaneously
<% m = DateTime.current.minute - 1; h = DateTime.current.hour; d = DateTime.current.cwday %>
version_check:
cron: <%="#{m} #{h} * * #{d}" %>
class: 'VersionCheckWorker'
queue: system
<%= PluginRegistry.insert_code('yml.schedule') %>

View File

@ -7,4 +7,5 @@
- [default, 5]
- [devise_mailer, 3]
- [mailers, 3]
- [elasticsearch, 2]
- [elasticsearch, 2]
- [system, 1]

View File

@ -82,5 +82,14 @@ namespace :fablab do
require 'version'
puts Version.current
end
desc 'clean the cron workers'
task clean_workers: :environment do
Sidekiq::Cron::Job.destroy_all!
Sidekiq::Queue.new('system').clear
Sidekiq::Queue.new('default').clear
Sidekiq::DeadSet.new.clear
end
end
end

View File

@ -49,7 +49,7 @@ namespace :fablab do
desc 'sync users to the stripe database'
task sync_members: :environment do
puts 'We create all non-existing customers on stripe. This may take a while, please wait...'
SyncMembersOnStripeWorker.perform
SyncMembersOnStripeWorker.new.perform
puts 'Done'
end

View File

@ -17,21 +17,11 @@ class Version
json['up_to_date']
end
# periodically retrieve the last published version from the hub and save it into the database
def self.check_and_schedule
job_name = 'Automatic version check'
# retrieve the last published version from the hub and save it into the database
def self.check
return if (Rails.env.development? || Rails.env.test?) && ENV['FORCE_VERSION_CHECK'] != 'true'
job = Sidekiq::Cron::Job.find name: job_name
unless job
# schedule a version check, every week at the current day+time
# this will prevent that all the instances query the hub simultaneously
m = DateTime.current.minute
h = DateTime.current.hour
d = DateTime.current.cwday
job = Sidekiq::Cron::Job.new(name: job_name, cron: "#{m} #{h} * * #{d}", class: 'VersionCheckWorker')
job.save
end
job.enque!
# check the version
VersionCheckWorker.perform_async
end
end

View File

@ -1,6 +1,6 @@
{
"name": "fab-manager",
"version": "4.5.1",
"version": "4.5.2",
"description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.",
"keywords": [
"fablab",

View File

@ -59,7 +59,7 @@ class AuthProvidersTest < ActionDispatch::IntegrationTest
assert_equal 2, provider[:providable_attributes][:o_auth2_mappings_attributes].length
# now let's activate this new provider
Fablab::Application.load_tasks
Fablab::Application.load_tasks if Rake::Task.tasks.empty?
Rake::Task['fablab:auth:switch_provider'].invoke(name)
db_provider.reload
@ -69,4 +69,4 @@ class AuthProvidersTest < ActionDispatch::IntegrationTest
assert_not_nil u.auth_token
end
end
end
end