From b448137392eb1cf03fdda258f879274badd9b8e5 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Fri, 6 Sep 2024 10:19:57 +0200 Subject: [PATCH 1/3] (bug) unable to reset OpenApi token --- CHANGELOG.md | 2 ++ app/models/open_api/client.rb | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0eadd3e7..b064d1c9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next release +- Fix a bug: unable to reset OpenApi token + ## v6.3.32 2024 July 22 - Fix a bug: manager cannot pay a subscription(payment schedule) with a wallet diff --git a/app/models/open_api/client.rb b/app/models/open_api/client.rb index 9d537d379..80e1eabf0 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 From 77496af54ad6db310d42a9b785a25c57ecfeb552 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Wed, 2 Oct 2024 18:35:37 +0200 Subject: [PATCH 2/3] (bug) unable to sync projects with openprojects --- CHANGELOG.md | 3 +++ app/models/concerns/openlab_sync.rb | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b064d1c9a..6622496a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ## Next release - 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 diff --git a/app/models/concerns/openlab_sync.rb b/app/models/concerns/openlab_sync.rb index 38e0315c0..49daddf42 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) From 1e74afd7551fc03f572e291e4e5888abf5091478 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Wed, 2 Oct 2024 18:38:56 +0200 Subject: [PATCH 3/3] Version 6.3.33 --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6622496a3..be0141b59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 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` diff --git a/package.json b/package.json index cb9f52d8a..2f843f2f6 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",