diff --git a/CHANGELOG.md b/CHANGELOG.md index d0eadd3e75..be0141b590 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## Next release +## v6.3.33 2024 October 2 + +- Fix a bug: unable to reset OpenApi token +- Fix a bug: unable to sync projects with openprojects +- [TODO DEPLOY] `rails fablab:openlab:bulk_export` +- [TODO DEPLOY] `rails fablab:openlab:bulk_update` + ## v6.3.32 2024 July 22 - Fix a bug: manager cannot pay a subscription(payment schedule) with a wallet diff --git a/app/models/concerns/openlab_sync.rb b/app/models/concerns/openlab_sync.rb index 38e0315c04..49daddf42d 100644 --- a/app/models/concerns/openlab_sync.rb +++ b/app/models/concerns/openlab_sync.rb @@ -5,18 +5,17 @@ module OpenlabSync extend ActiveSupport::Concern included do - after_create :openlab_create, if: :openlab_sync_active? - after_update :openlab_update, if: :openlab_sync_active? + after_save :openlab_create_or_update, if: :openlab_sync_active? after_destroy :openlab_destroy, if: :openlab_sync_active? def openlab_create OpenlabWorker.perform_in(2.seconds, :create, id) if published? end - def openlab_update + def openlab_create_or_update return unless published? - if state_was == 'draft' + if state_was == 'draft' || state_was.nil? OpenlabWorker.perform_async(:create, id) else OpenlabWorker.perform_async(:update, id) diff --git a/app/models/open_api/client.rb b/app/models/open_api/client.rb index 9d537d379c..80e1eabf0d 100644 --- a/app/models/open_api/client.rb +++ b/app/models/open_api/client.rb @@ -3,16 +3,16 @@ # OpenAPI::Client keeps track of the authorized accesses to the 3-rd party API (aka. OpenAPI) class OpenAPI::Client < ApplicationRecord validates :name, presence: true - validates_uniqueness_of :token + validates :token, uniqueness: true before_create :set_initial_token def increment_calls_count - update_column(:calls_count, calls_count+1) + update_column(:calls_count, calls_count + 1) end def regenerate_token - update_attributes(token: generate_unique_secure_token) + update(token: generate_unique_secure_token) end private diff --git a/package.json b/package.json index cb9f52d8ab..2f843f2f6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fab-manager", - "version": "6.3.32", + "version": "6.3.33", "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",