diff --git a/CHANGELOG.md b/CHANGELOG.md index db3451ee4..1717fe17c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog Fab-manager +## v5.3.4 2022 March 01 + +- Fix line break on home events' cards +- Fix typo "projets" => "projects" +- Removes dead code about OpenAPI (open_api_calls_count_tracings) +- Fix a bug: unable to modify OpenLab url for production + ## v5.3.3 2022 February 08 - Updated german translations @@ -7,7 +14,7 @@ - Fix a bug/regresion: $sce.getTrustedHtml removes all dangerous html like iframe (youtube players, ect), replaced by $sce.trustAsHtml which trusts the content, it creates a security breach but all contents are created by users to we trust them - Fix a bug: in SubscriptionPolicy#show?, was causing an error notice, making user think that the payment was not done, but it was - Fix a bug: destroying a project was impossible -- Fix a bug: fix non-blocking js error when there was not payment gateway set +- Fix a bug: fix non-blocking js error when there was not payment gateway set - [TODO DEPLOY] `rails fablab:maintenance:regenerate_statistics[2020,04]` ## v5.3.2 2022 January 19 @@ -58,7 +65,7 @@ - Ability to configure multiple VAT rates, per kind of invoiced item - Ability to export the collected VAT, by rates, to a CSV file - Refactored the extended prices' frontend code to allow future customization -- Fix a bug: the amount label in not correctly shown in the extended prices modal +- Fix a bug: the amount label in not correctly shown in the extended prices modal - Fix a bug: `extended_prices_in_same_day` apply the extended prices to each day ## v5.2.0 2021 December 23 diff --git a/app/controllers/api/openlab_projects_controller.rb b/app/controllers/api/openlab_projects_controller.rb index d117725c6..1a19508e4 100644 --- a/app/controllers/api/openlab_projects_controller.rb +++ b/app/controllers/api/openlab_projects_controller.rb @@ -6,7 +6,7 @@ class API::OpenlabProjectsController < API::ApiController before_action :init_openlab def index - render json: @projets.search(params[:q], page: params[:page], per_page: params[:per_page]).response.body + render json: @projects.search(params[:q], page: params[:page], per_page: params[:per_page]).response.body rescue StandardError render json: { errors: ['service unavailable'] } end @@ -15,6 +15,6 @@ class API::OpenlabProjectsController < API::ApiController def init_openlab client = Openlab::Client.new(app_secret: Setting.get('openlab_app_secret')) - @projets = Openlab::Projects.new(client) + @projects = Openlab::Projects.new(client) end end diff --git a/app/frontend/src/javascript/filters/filters.js b/app/frontend/src/javascript/filters/filters.js index e6cb02e7c..827799875 100644 --- a/app/frontend/src/javascript/filters/filters.js +++ b/app/frontend/src/javascript/filters/filters.js @@ -157,6 +157,8 @@ Application.Filters.filter('breakFilter', [function () { Application.Filters.filter('simpleText', [function () { return function (text) { if (text != null) { + // add a line break after specific closing tags + text = text.replace(/(<\/p>|<\/h4>|<\/h5>|<\/h6>|<\/pre>|<\/blockquote>)/g, '\n'); text = text.replace(//g, '\n'); return text.replace(/<\/?\w+[^>]*>/g, ''); } else { diff --git a/app/models/open_api/calls_count_tracing.rb b/app/models/open_api/calls_count_tracing.rb deleted file mode 100644 index c54338a12..000000000 --- a/app/models/open_api/calls_count_tracing.rb +++ /dev/null @@ -1,4 +0,0 @@ -class OpenAPI::CallsCountTracing < ApplicationRecord - belongs_to :projets, foreign_key: :open_api_client_id - validates :projets, :at, presence: true -end diff --git a/app/models/open_api/client.rb b/app/models/open_api/client.rb index a9815eaf7..9d537d379 100644 --- a/app/models/open_api/client.rb +++ b/app/models/open_api/client.rb @@ -2,8 +2,6 @@ # OpenAPI::Client keeps track of the authorized accesses to the 3-rd party API (aka. OpenAPI) class OpenAPI::Client < ApplicationRecord - has_many :calls_count_tracings, foreign_key: :open_api_client_id, dependent: :destroy - validates :name, presence: true validates_uniqueness_of :token diff --git a/app/workers/open_api_trace_calls_count_worker.rb b/app/workers/open_api_trace_calls_count_worker.rb deleted file mode 100644 index d54569567..000000000 --- a/app/workers/open_api_trace_calls_count_worker.rb +++ /dev/null @@ -1,10 +0,0 @@ -class OpenAPITraceCallsCountWorker < Sidekiq::Workers - include Sidekiq::Worker - sidekiq_options queue: 'default', retry: true - - def perform - OpenAPI::Client.find_each do |client| - OpenAPI::CallsCountTracing.create!(projets: client, calls_count: client.calls_count, at: DateTime.current) - end - end -end diff --git a/app/workers/openlab_worker.rb b/app/workers/openlab_worker.rb index c14200236..2a3ad9f79 100644 --- a/app/workers/openlab_worker.rb +++ b/app/workers/openlab_worker.rb @@ -7,7 +7,7 @@ class OpenlabWorker def initialize client = Openlab::Client.new(app_secret: Setting.get('openlab_app_secret')) - @projets = Openlab::Projects.new(client) + @projects = Openlab::Projects.new(client) super end @@ -17,12 +17,12 @@ class OpenlabWorker case action.to_s when /create/ project = Project.find(project_id) - response = @projets.create(project.openlab_attributes) + response = @projects.create(project.openlab_attributes) when /update/ project = Project.find(project_id) - response = @projets.update(project_id, project.openlab_attributes) + response = @projects.update(project_id, project.openlab_attributes) when /destroy/ - response = @projets.destroy(project_id) + response = @projects.destroy(project_id) else raise NotImplementedError end diff --git a/config/initializers/openlab_ruby.rb b/config/initializers/openlab_ruby.rb index e0c1ffd9e..3499e7da5 100644 --- a/config/initializers/openlab_ruby.rb +++ b/config/initializers/openlab_ruby.rb @@ -1,3 +1,3 @@ Openlab.configure do |config| - config.base_uri = Rails.application.secrets.openlab_base_uri unless Rails.env.production? + config.base_uri = Rails.application.secrets.openlab_base_uri if Rails.application.secrets.openlab_base_uri end diff --git a/config/schedule.yml b/config/schedule.yml index af0ecf6b4..d1bb8b1c6 100644 --- a/config/schedule.yml +++ b/config/schedule.yml @@ -20,10 +20,6 @@ i_calendar_import: class: "ICalendarImportWorker" queue: default -open_api_trace_calls_count: - cron: "0 4 * * 0" # every sunday at 4am - class: "OpenAPITraceCallsCountWorker" - reservation_reminder: cron: "1 * * * *" class: "ReservationReminderWorker" diff --git a/db/migrate/20220225143203_drop_table_open_api_calls_count_tracings.rb b/db/migrate/20220225143203_drop_table_open_api_calls_count_tracings.rb new file mode 100644 index 000000000..444074bce --- /dev/null +++ b/db/migrate/20220225143203_drop_table_open_api_calls_count_tracings.rb @@ -0,0 +1,14 @@ +class DropTableOpenAPICallsCountTracings < ActiveRecord::Migration[5.2] + def up + drop_table :open_api_calls_count_tracings + end + + def down + create_table :open_api_calls_count_tracings do |t| + t.belongs_to :open_api_client, foreign_key: true, index: true + t.integer :calls_count, null: false + t.datetime :at, null: false + t.timestamps null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb index eaef1c8e7..af2f63d2f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_01_18_123741) do +ActiveRecord::Schema.define(version: 2022_02_25_143203) do # These are extensions that must be enabled in order to support this database enable_extension "fuzzystrmatch" @@ -19,8 +19,8 @@ ActiveRecord::Schema.define(version: 2022_01_18_123741) do enable_extension "unaccent" create_table "abuses", id: :serial, force: :cascade do |t| - t.integer "signaled_id" t.string "signaled_type" + t.integer "signaled_id" t.string "first_name" t.string "last_name" t.string "email" @@ -49,8 +49,8 @@ ActiveRecord::Schema.define(version: 2022_01_18_123741) do t.string "locality" t.string "country" t.string "postal_code" - t.integer "placeable_id" t.string "placeable_type" + t.integer "placeable_id" t.datetime "created_at" t.datetime "updated_at" end @@ -64,8 +64,8 @@ ActiveRecord::Schema.define(version: 2022_01_18_123741) do end create_table "assets", id: :serial, force: :cascade do |t| - t.integer "viewable_id" t.string "viewable_type" + t.integer "viewable_id" t.string "attachment" t.string "type" t.datetime "created_at" @@ -133,8 +133,8 @@ ActiveRecord::Schema.define(version: 2022_01_18_123741) do end create_table "credits", id: :serial, force: :cascade do |t| - t.integer "creditable_id" t.string "creditable_type" + t.integer "creditable_id" t.integer "plan_id" t.integer "hours" t.datetime "created_at" @@ -356,15 +356,15 @@ ActiveRecord::Schema.define(version: 2022_01_18_123741) do create_table "notifications", id: :serial, force: :cascade do |t| t.integer "receiver_id" - t.integer "attached_object_id" t.string "attached_object_type" + t.integer "attached_object_id" t.integer "notification_type_id" t.boolean "is_read", default: false t.datetime "created_at" t.datetime "updated_at" t.string "receiver_type" t.boolean "is_send", default: false - t.jsonb "meta_data", default: {} + t.jsonb "meta_data", default: "{}" t.index ["notification_type_id"], name: "index_notifications_on_notification_type_id" t.index ["receiver_id"], name: "index_notifications_on_receiver_id" end @@ -402,15 +402,6 @@ ActiveRecord::Schema.define(version: 2022_01_18_123741) do t.index ["subscription_id"], name: "index_offer_days_on_subscription_id" end - create_table "open_api_calls_count_tracings", id: :serial, force: :cascade do |t| - t.integer "open_api_client_id" - t.integer "calls_count", null: false - t.datetime "at", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["open_api_client_id"], name: "index_open_api_calls_count_tracings_on_open_api_client_id" - end - create_table "open_api_clients", id: :serial, force: :cascade do |t| t.string "name" t.integer "calls_count", default: 0 @@ -492,7 +483,6 @@ ActiveRecord::Schema.define(version: 2022_01_18_123741) do t.integer "weight" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.text "description" end create_table "plans", id: :serial, force: :cascade do |t| @@ -550,8 +540,8 @@ ActiveRecord::Schema.define(version: 2022_01_18_123741) do create_table "prices", id: :serial, force: :cascade do |t| t.integer "group_id" t.integer "plan_id" - t.integer "priceable_id" t.string "priceable_type" + t.integer "priceable_id" t.integer "amount" t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -661,8 +651,8 @@ ActiveRecord::Schema.define(version: 2022_01_18_123741) do t.text "message" t.datetime "created_at" t.datetime "updated_at" - t.integer "reservable_id" t.string "reservable_type" + t.integer "reservable_id" t.integer "nb_reserve_places" t.integer "statistic_profile_id" t.index ["reservable_type", "reservable_id"], name: "index_reservations_on_reservable_type_and_reservable_id" @@ -671,8 +661,8 @@ ActiveRecord::Schema.define(version: 2022_01_18_123741) do create_table "roles", id: :serial, force: :cascade do |t| t.string "name" - t.integer "resource_id" t.string "resource_type" + t.integer "resource_id" t.datetime "created_at" t.datetime "updated_at" t.index ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id" @@ -1009,7 +999,6 @@ ActiveRecord::Schema.define(version: 2022_01_18_123741) do add_foreign_key "invoices", "wallet_transactions" add_foreign_key "invoicing_profiles", "users" add_foreign_key "o_auth2_mappings", "o_auth2_providers" - add_foreign_key "open_api_calls_count_tracings", "open_api_clients" add_foreign_key "organizations", "invoicing_profiles" add_foreign_key "payment_gateway_objects", "payment_gateway_objects" add_foreign_key "payment_schedule_items", "invoices" diff --git a/package.json b/package.json index 414945d44..e25ca94ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fab-manager", - "version": "5.3.3", + "version": "5.3.4", "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",