From e3d2b5376789a453b7a6caa16cd3bfcfde2e62f5 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Fri, 13 May 2022 12:24:52 +0200 Subject: [PATCH 01/18] Fix a bug: when machines module disabled, Associated machines is still shown in trainings list --- CHANGELOG.md | 2 ++ app/frontend/src/javascript/controllers/admin/trainings.js | 2 ++ app/frontend/src/javascript/router.js | 2 +- app/frontend/templates/admin/trainings/index.html | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98193f5d6..f7d065a24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## next deploy +- Fix a bug: when machines module disabled, Associated machines is still shown in trainings list + ## v5.4.0 2022 May 12 - Option to disable the 'machines' module diff --git a/app/frontend/src/javascript/controllers/admin/trainings.js b/app/frontend/src/javascript/controllers/admin/trainings.js index 9e95fd31b..6342f26fd 100644 --- a/app/frontend/src/javascript/controllers/admin/trainings.js +++ b/app/frontend/src/javascript/controllers/admin/trainings.js @@ -187,6 +187,8 @@ Application.Controllers.controller('TrainingsAdminController', ['$scope', '$stat // default tab: trainings list $scope.tabs = { active: 0 }; + $scope.enableMachinesModule = settingsPromise.machines_module === 'true'; + /** * In the trainings listing tab, return the stringified list of machines associated with the provided training * @param training {Object} Training object, inherited from $resource diff --git a/app/frontend/src/javascript/router.js b/app/frontend/src/javascript/router.js index b52874d70..89f1a9176 100644 --- a/app/frontend/src/javascript/router.js +++ b/app/frontend/src/javascript/router.js @@ -670,7 +670,7 @@ angular.module('application.router', ['ui.router']) resolve: { trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }], machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }], - settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['feature_tour_display']" }).$promise; }] + settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['feature_tour_display', 'machines_module']" }).$promise; }] } }) .state('app.admin.trainings_new', { diff --git a/app/frontend/templates/admin/trainings/index.html b/app/frontend/templates/admin/trainings/index.html index 786dd1d80..48cae7e1e 100644 --- a/app/frontend/templates/admin/trainings/index.html +++ b/app/frontend/templates/admin/trainings/index.html @@ -53,7 +53,7 @@ {{ 'app.admin.trainings.name' }} - {{ 'app.admin.trainings.associated_machines' }} + {{ 'app.admin.trainings.associated_machines' }} {{ 'app.admin.trainings.number_of_tickets' }} @@ -61,7 +61,7 @@ {{ training.name }} - {{ showMachines(training) }} + {{ showMachines(training) }} {{ training.nb_total_places }}
From b57fd291d80fc9c414566315dabadbff1d606c06 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Fri, 13 May 2022 12:59:50 +0200 Subject: [PATCH 02/18] New translations app.admin.en.yml (French) (#353) --- config/locales/app.admin.fr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index 62ff65cbc..001eb070b 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -1433,7 +1433,7 @@ fr: change_group: "Changement de groupe" change_group_info: "Une fois qu'un utilisateur a créé son compte, vous pouvez l'empêcher de changer de groupe. Dans ce cas, seuls les gestionnaires et les administrateurs pourront changer le groupe de l'utilisateur." allow_group_change: "Autoriser le changement de groupe" - user_change_group: "les utilisateurs peuvent changer de groupe" + user_change_group: "changement de groupe" wallet_module: "module porte-monnaie" public_agenda_module: "module d'agenda public" statistics_module: "module de statistiques" From 59ca11b3e7d1eb32e39683304e2705df285b9e70 Mon Sep 17 00:00:00 2001 From: Tomoyuki Sakurai Date: Tue, 10 May 2022 10:10:19 +0700 Subject: [PATCH 03/18] (feature) allow users to disable colorize_logging in active record fixes #345 --- config/application.rb | 3 +++ doc/environment.md | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/config/application.rb b/config/application.rb index 0c294ac06..2188891f5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -69,6 +69,9 @@ module Fablab Rails.application.config.paths['app/views'] << path end + # disable ANSI color escape codes in active_record if NO_COLOR is defined. + config.colorize_logging = ENV['NO_COLOR'] ? false : true + FabManager.activate_plugins! config.after_initialize do diff --git a/doc/environment.md b/doc/environment.md index 831453685..63f1a21e0 100644 --- a/doc/environment.md +++ b/doc/environment.md @@ -269,6 +269,11 @@ See [Microsoft support](https://support.microsoft.com/en-us/kb/264372) for a lis If set to `true`, and the application in started into a staging environment, this will enable the Crowdin In-context translation layer for the front-end application. See [Crowdin documentation](https://support.crowdin.com/in-context-localization/) for more details about this. Accordingly, `RAILS_LOCALE` and `APP_LOCALE` must be configured to `zu`. + + + NO_COLOR + +If set to any value, this will set `config.colorize_logging` to `false`, disabling ANSI color codes when logging information. ## OpenLab settings From eb6f04d2ad10be88b51048b2afcc654a0ecff4e8 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Mon, 16 May 2022 18:08:20 +0200 Subject: [PATCH 04/18] fix bug: script mount-proof-of-identity-files unable to modify docker-compose.yml --- CHANGELOG.md | 1 + scripts/mount-payment-schedules.sh | 3 +++ scripts/mount-proof-of-identity-files.sh | 3 +++ 3 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7d065a24..e96bcf2cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## next deploy - Fix a bug: when machines module disabled, Associated machines is still shown in trainings list +- Fix a bug: script mount-proof-of-identity-files unable to modify docker-compose.yml ## v5.4.0 2022 May 12 diff --git a/scripts/mount-payment-schedules.sh b/scripts/mount-payment-schedules.sh index a8be656bd..a785e32b8 100644 --- a/scripts/mount-payment-schedules.sh +++ b/scripts/mount-payment-schedules.sh @@ -22,7 +22,10 @@ add_mount() if [[ ! $(yq eval ".services.$SERVICE.volumes.[] | select (. == \"*payment_schedules\")" docker-compose.yml) ]]; then # shellcheck disable=SC2016 # we don't want to expand ${PWD} + # change docker-compose.yml permissions for fix yq can't modify file issue + chmod 666 docker-compose.yml yq -i eval ".services.$SERVICE.volumes += [\"\${PWD}/payment_schedules:/usr/src/app/payment_schedules\"]" docker-compose.yml + chmod 644 docker-compose.yml fi } diff --git a/scripts/mount-proof-of-identity-files.sh b/scripts/mount-proof-of-identity-files.sh index c885371e5..02d4ff297 100644 --- a/scripts/mount-proof-of-identity-files.sh +++ b/scripts/mount-proof-of-identity-files.sh @@ -22,7 +22,10 @@ add_mount() if [[ ! $(yq eval ".services.$SERVICE.volumes.[] | select (. == \"*proof_of_identity_files\")" docker-compose.yml) ]]; then # shellcheck disable=SC2016 # we don't want to expand ${PWD} + # change docker-compose.yml permissions for fix yq can't modify file issue + chmod 666 docker-compose.yml yq -i eval ".services.$SERVICE.volumes += [\"\${PWD}/proof_of_identity_files:/usr/src/app/proof_of_identity_files\"]" docker-compose.yml + chmod 644 docker-compose.yml fi } From 3703900cebd689d0be33a4465a6898f8e940753b Mon Sep 17 00:00:00 2001 From: Du Peng Date: Tue, 17 May 2022 13:14:39 +0200 Subject: [PATCH 05/18] Event reservation calendar encoding in mail --- CHANGELOG.md | 1 + app/mailers/notifications_mailer.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e96bcf2cd..992c36ba7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fix a bug: when machines module disabled, Associated machines is still shown in trainings list - Fix a bug: script mount-proof-of-identity-files unable to modify docker-compose.yml +- Fix a bug: Event reservation calendar encoding in mail ## v5.4.0 2022 May 12 diff --git a/app/mailers/notifications_mailer.rb b/app/mailers/notifications_mailer.rb index 638b125d2..e2de80d1e 100644 --- a/app/mailers/notifications_mailer.rb +++ b/app/mailers/notifications_mailer.rb @@ -54,7 +54,7 @@ class NotificationsMailer < NotifyWith::NotificationsMailer end def notify_member_create_reservation - attachments[@attached_object.ics_filename] = @attached_object.to_ics + attachments[@attached_object.ics_filename] = @attached_object.to_ics.encode(Encoding::ISO_8859_15) mail(to: @recipient.email, subject: t('notifications_mailer.notify_member_create_reservation.subject'), template_name: 'notify_member_create_reservation') From 41d931aba0c56d3ec82a8affa6d80b3f502dd544 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Tue, 17 May 2022 16:45:17 +0200 Subject: [PATCH 06/18] Fix a bug: Missing of description of PlanCategory migration --- CHANGELOG.md | 1 + app/models/plan_category.rb | 2 +- .../20220517140916_add_description_to_plan_category.rb | 5 +++++ db/schema.rb | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20220517140916_add_description_to_plan_category.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 992c36ba7..00100da05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Fix a bug: when machines module disabled, Associated machines is still shown in trainings list - Fix a bug: script mount-proof-of-identity-files unable to modify docker-compose.yml - Fix a bug: Event reservation calendar encoding in mail +- Fix a bug: Missing of description of PlanCategory migration ## v5.4.0 2022 May 12 diff --git a/app/models/plan_category.rb b/app/models/plan_category.rb index cf4d11e0d..6c8633883 100644 --- a/app/models/plan_category.rb +++ b/app/models/plan_category.rb @@ -6,5 +6,5 @@ # - plan_category # - plan class PlanCategory < ApplicationRecord - has_many :plan, dependent: :nullify + has_many :plans, dependent: :nullify end diff --git a/db/migrate/20220517140916_add_description_to_plan_category.rb b/db/migrate/20220517140916_add_description_to_plan_category.rb new file mode 100644 index 000000000..223c34b07 --- /dev/null +++ b/db/migrate/20220517140916_add_description_to_plan_category.rb @@ -0,0 +1,5 @@ +class AddDescriptionToPlanCategory < ActiveRecord::Migration[5.2] + def change + add_column :plan_categories, :description, :text + end +end diff --git a/db/schema.rb b/db/schema.rb index dfff7c3fd..b49a86421 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_05_09_105714) do +ActiveRecord::Schema.define(version: 2022_05_17_140916) do # These are extensions that must be enabled in order to support this database enable_extension "fuzzystrmatch" @@ -1021,8 +1021,8 @@ ActiveRecord::Schema.define(version: 2022_05_09_105714) do t.boolean "is_allow_newsletter" t.inet "current_sign_in_ip" t.inet "last_sign_in_ip" - t.string "mapped_from_sso" t.datetime "validated_at" + t.string "mapped_from_sso" t.index ["auth_token"], name: "index_users_on_auth_token" t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["email"], name: "index_users_on_email", unique: true From cecf8126e0e6e9405c73ec25bcdaeb68d9dddd62 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Tue, 17 May 2022 17:38:00 +0200 Subject: [PATCH 07/18] Fix bug: Unable to create plans for all group --- CHANGELOG.md | 1 + app/controllers/api/plans_controller.rb | 2 +- app/frontend/src/javascript/controllers/admin/plans.js | 8 +++----- app/services/plans_service.rb | 4 +++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00100da05..e7c547755 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Fix a bug: script mount-proof-of-identity-files unable to modify docker-compose.yml - Fix a bug: Event reservation calendar encoding in mail - Fix a bug: Missing of description of PlanCategory migration +- Fix a bug: Unable to create plans for all group ## v5.4.0 2022 May 12 diff --git a/app/controllers/api/plans_controller.rb b/app/controllers/api/plans_controller.rb index 8f3ebde7e..c43f2549c 100644 --- a/app/controllers/api/plans_controller.rb +++ b/app/controllers/api/plans_controller.rb @@ -27,7 +27,7 @@ class API::PlansController < API::ApiController partner = params[:plan][:partner_id].empty? ? nil : User.find(params[:plan][:partner_id]) plan = PlansService.create(type, partner, plan_params) - if plan.errors.keys.count.positive? + if plan.key?(:errors) render json: plan.errors, status: :unprocessable_entity else render json: plan, status: :created diff --git a/app/frontend/src/javascript/controllers/admin/plans.js b/app/frontend/src/javascript/controllers/admin/plans.js index 81d6965f8..5ac4f62aa 100644 --- a/app/frontend/src/javascript/controllers/admin/plans.js +++ b/app/frontend/src/javascript/controllers/admin/plans.js @@ -181,16 +181,14 @@ Application.Controllers.controller('NewPlanController', ['$scope', '$uibModal', * @param content {Object} */ $scope.afterSubmit = function (content) { - if ((content.id == null) && (content.plan_ids == null)) { + if (content.plan_ids === null || content.plan_ids === undefined) { return growl.error(_t('app.admin.plans.new.unable_to_create_the_subscription_please_try_again')); } else { growl.success(_t('app.admin.plans.new.successfully_created_subscriptions_dont_forget_to_redefine_prices')); - if (content.plan_ids != null) { + if (content.plan_ids.length > 1) { return $state.go('app.admin.pricing'); } else { - if (content.id != null) { - return $state.go('app.admin.plans.edit', { id: content.id }); - } + return $state.go('app.admin.plans.edit', { id: content.plan_ids[0] }); } } }; diff --git a/app/services/plans_service.rb b/app/services/plans_service.rb index df1a90335..e393e4619 100644 --- a/app/services/plans_service.rb +++ b/app/services/plans_service.rb @@ -14,8 +14,10 @@ class PlansService plan = type.constantize.new(params) if plan.save partner&.add_role :partner, plan + else + return { errors: plan.errors.full_messages } end - plan + { plan_ids: [plan.id] } end rescue PaymentGatewayError => e { errors: e.message } From c404424fb467cc865c28f2e4b259c8ddce54b81f Mon Sep 17 00:00:00 2001 From: Du Peng Date: Tue, 17 May 2022 19:31:58 +0200 Subject: [PATCH 08/18] fix bug: new category button transalte --- .../components/plan-categories/manage-plan-category.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/frontend/src/javascript/components/plan-categories/manage-plan-category.tsx b/app/frontend/src/javascript/components/plan-categories/manage-plan-category.tsx index 97cd54c3f..927213ae8 100644 --- a/app/frontend/src/javascript/components/plan-categories/manage-plan-category.tsx +++ b/app/frontend/src/javascript/components/plan-categories/manage-plan-category.tsx @@ -63,7 +63,7 @@ const ManagePlanCategoryComponent: React.FC = ({ catego icon={} className="btn-warning" onClick={toggleModal}> - {t('app.admin.create_plan_category.new_category')} + {t('app.admin.manage_plan_category.create_category.title')} ); case 'update': From 341f45bbadba9b0a6c709a164d4dab8fe5df0476 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 03:43:55 +0000 Subject: [PATCH 09/18] Bump nokogiri from 1.13.4 to 1.13.6 Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.4 to 1.13.6. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.13.4...v1.13.6) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 45a8fb4e2..aef86fe98 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -233,7 +233,7 @@ GEM multi_xml (0.6.0) multipart-post (2.1.1) nio4r (2.5.8) - nokogiri (1.13.4) + nokogiri (1.13.6) mini_portile2 (~> 2.8.0) racc (~> 1.4) notify_with (0.0.2) From 7067757f389343296c55a3a21df5209d544f1377 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Fri, 20 May 2022 15:58:49 +0200 Subject: [PATCH 10/18] Disable to clicking outside or pressing escape to close sign up modal --- CHANGELOG.md | 1 + app/frontend/src/javascript/controllers/application.js | 6 ++++++ app/frontend/templates/shared/signupModal.html | 1 + 3 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7c547755..5967b8ddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Fix a bug: Event reservation calendar encoding in mail - Fix a bug: Missing of description of PlanCategory migration - Fix a bug: Unable to create plans for all group +- Disable to clicking outside or pressing escape to close sign up modal ## v5.4.0 2022 May 12 diff --git a/app/frontend/src/javascript/controllers/application.js b/app/frontend/src/javascript/controllers/application.js index 218e10f08..6ae830863 100644 --- a/app/frontend/src/javascript/controllers/application.js +++ b/app/frontend/src/javascript/controllers/application.js @@ -75,6 +75,8 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco } else { return $uibModal.open({ templateUrl: '/shared/signupModal.html', + backdrop: 'static', + keyboard: false, size: 'md', resolve: { settingsPromise: ['Setting', function (Setting) { @@ -189,6 +191,10 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco }); }); }; + + $scope.dismiss = function () { + $uibModalInstance.dismiss('cancel'); + }; }] }).result.finally(null).then(function (res) { // when the account was created successfully, set the session to the newly created account diff --git a/app/frontend/templates/shared/signupModal.html b/app/frontend/templates/shared/signupModal.html index 11a8a4ff1..ada6cd95e 100644 --- a/app/frontend/templates/shared/signupModal.html +++ b/app/frontend/templates/shared/signupModal.html @@ -1,5 +1,6 @@
From d7fbb97bafd1246cbf304bbdc1030cf16ff849e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 May 2022 11:19:34 +0000 Subject: [PATCH 11/18] Bump moment from 2.29.1 to 2.29.2 Bumps [moment](https://github.com/moment/moment) from 2.29.1 to 2.29.2. - [Release notes](https://github.com/moment/moment/releases) - [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md) - [Commits](https://github.com/moment/moment/compare/2.29.1...2.29.2) --- updated-dependencies: - dependency-name: moment dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 61dff2d7f..80b5da2da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5517,9 +5517,9 @@ moment-timezone@0.5: moment ">= 2.9.0" moment@2.29, "moment@>= 2.9.0", "moment@>=2.8.0 <3.0.0": - version "2.29.1" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" - integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== + version "2.29.2" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.2.tgz#00910c60b20843bcba52d37d58c628b47b1f20e4" + integrity sha512-UgzG4rvxYpN15jgCmVJwac49h9ly9NurikMWGPdVxm8GZD6XjkKPxDTjQQ43gtGgnV3X0cAyWDdP2Wexoquifg== ms@2.0.0: version "2.0.0" From cfd6e449f872f3fd73f29b966b2816888ce1c535 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 May 2022 11:35:07 +0000 Subject: [PATCH 12/18] Bump async from 2.6.3 to 2.6.4 Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4. - [Release notes](https://github.com/caolan/async/releases) - [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md) - [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4) --- updated-dependencies: - dependency-name: async dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 61dff2d7f..e3d2ae16e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2930,9 +2930,9 @@ assert@^2.0.0: util "^0.12.0" async@^2.6.2: - version "2.6.3" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" - integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== + version "2.6.4" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" + integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== dependencies: lodash "^4.17.14" From 532a896cad84cd6175f0a44183011d7868758660 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 23 May 2022 14:20:08 +0200 Subject: [PATCH 13/18] (bug) fix #348: open reset password modal when back from notification center --- CHANGELOG.md | 1 + app/frontend/src/javascript/app.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97b99f73b..d1418a46c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Fix a bug: Event reservation calendar encoding in mail - Fix a bug: Missing of description of PlanCategory migration - Fix a bug: Unable to create plans for all group +- Fix a bug: backPrevLocation button on Notification Center opens reset password page (#348) - Fix a security issue: updated moment.js to 2.29.2. to fix [CVE-2022-24785](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24785) - Fix a security issue: updated nokogiri to 1.13.6 to fix [CVE-2022-298240](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-298240) - Fix a security issue: updated async to 2.6.4 to fix [CVE-2021-43138](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-43138) diff --git a/app/frontend/src/javascript/app.js b/app/frontend/src/javascript/app.js index dcd13a2b4..edd0e72a1 100644 --- a/app/frontend/src/javascript/app.js +++ b/app/frontend/src/javascript/app.js @@ -75,7 +75,11 @@ angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.rout // This is used to allow the user to navigate to the previous state $transitions.onSuccess({ }, function (trans) { $state.prevState = trans.$from().name; - $state.prevParams = trans.$from().params; + $state.prevParams = Object.fromEntries( + Object.keys(trans.$from().params).map(k => { + return [k, trans.$from().params[k].value()]; + }) + ); const path = trans.router.stateService.href(trans.$to(), {}, { absolute: true }); GTM.trackPage(path, trans.$to().name); From dce183502837a4b199021686e297d01e8e5924b7 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Mon, 23 May 2022 16:15:49 +0200 Subject: [PATCH 14/18] fix create plan test --- test/integration/plans/create_plan_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/plans/create_plan_test.rb b/test/integration/plans/create_plan_test.rb index 19bacff99..2f538f827 100644 --- a/test/integration/plans/create_plan_test.rb +++ b/test/integration/plans/create_plan_test.rb @@ -41,7 +41,7 @@ class CreatePlanTest < ActionDispatch::IntegrationTest # Check the created plan plan = json_response(response.body) - assert_equal Plan.last.id, plan[:id] + assert_equal Plan.last.id, plan[:plan_ids][0] assert_equal plans_count + 1, Plan.count end end From f2cef4387e01f6f50d4b553cc14406531b78d824 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 23 May 2022 16:29:10 +0200 Subject: [PATCH 15/18] (bug) fix #355 compatibility with the new docker-compose CLI --- CHANGELOG.md | 1 + scripts/pg-analyzers.sh | 17 ++++++++++++++++- scripts/run.sh | 15 +++++++++++++++ setup/setup.sh | 19 ++++++++++++++++++- setup/upgrade.sh | 15 +++++++++++++++ 5 files changed, 65 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1418a46c..0ed0b81e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Fix a bug: Missing of description of PlanCategory migration - Fix a bug: Unable to create plans for all group - Fix a bug: backPrevLocation button on Notification Center opens reset password page (#348) +- Fix a bug: compatibility with the new docker-compose CLI (#355) - Fix a security issue: updated moment.js to 2.29.2. to fix [CVE-2022-24785](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24785) - Fix a security issue: updated nokogiri to 1.13.6 to fix [CVE-2022-298240](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-298240) - Fix a security issue: updated async to 2.6.4 to fix [CVE-2021-43138](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-43138) diff --git a/scripts/pg-analyzers.sh b/scripts/pg-analyzers.sh index 7fac40058..3d2861859 100755 --- a/scripts/pg-analyzers.sh +++ b/scripts/pg-analyzers.sh @@ -1,3 +1,18 @@ #!/usr/bin/env bash -docker-compose exec -T postgres psql -Upostgres -c \\dFd | head -n -2 | tail -n +3 | awk '{ print gensub(/([a-z]+)_stem/,"\\1","g",$3); }' \ No newline at end of file +docker-compose() +{ + if ! docker compose version 1>/dev/null 2>/dev/null + then + if ! \docker-compose version 1>/dev/null 2>/dev/null + then + echo -e "\e[91m[ ❌ ] docker-compose was not found, exiting...\e[39m" && exit 1 + else + \docker-compose "$@" + fi + else + docker compose "$@" + fi +} + +docker-compose exec -T postgres psql -Upostgres -c \\dFd | head -n -2 | tail -n +3 | awk '{ print gensub(/([a-z]+)_stem/,"\\1","g",$3); }' diff --git a/scripts/run.sh b/scripts/run.sh index 2ebb674e3..09e49c9ce 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -8,6 +8,21 @@ config() { SERVICE="$(yq eval '.services.*.image | select(. == "sleede/fab-manager*") | path | .[-2]' docker-compose.yml)" } +docker-compose() +{ + if ! docker compose version 1>/dev/null 2>/dev/null + then + if ! \docker-compose version 1>/dev/null 2>/dev/null + then + echo -e "\e[91m[ ❌ ] docker-compose was not found, exiting...\e[39m" && exit 1 + else + \docker-compose "$@" + fi + else + docker compose "$@" + fi +} + run() { config diff --git a/setup/setup.sh b/setup/setup.sh index 2a15f77b3..e37db3066 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -45,7 +45,7 @@ system_requirements() fi done fi - local _commands=("sudo" "curl" "sed" "openssl" "docker" "docker-compose" "systemctl") + local _commands=("sudo" "curl" "sed" "openssl" "docker" "systemctl") for _command in "${_commands[@]}"; do echo "detecting $_command..." if ! command -v "$_command" @@ -54,9 +54,26 @@ system_requirements() echo -e "\e[91m[ ❌ ] $_command was not found, exiting...\e[39m" && exit 1 fi done + echo "detecting docker-compose..." + docker-compose version printf "\e[92m[ ✔ ] All requirements successfully checked.\e[39m \n\n" } +docker-compose() +{ + if ! docker compose version 1>/dev/null 2>/dev/null + then + if ! \docker-compose version 1>/dev/null 2>/dev/null + then + echo -e "\e[91m[ ❌ ] docker-compose was not found, exiting...\e[39m" && exit 1 + else + \docker-compose "$@" + fi + else + docker compose "$@" + fi +} + is_root() { return $(id -u) diff --git a/setup/upgrade.sh b/setup/upgrade.sh index ba4e6cf67..f3e48e451 100644 --- a/setup/upgrade.sh +++ b/setup/upgrade.sh @@ -43,6 +43,21 @@ jq() { docker run --rm -i -v "${PWD}:/data" imega/jq "$@" } +docker-compose() +{ + if ! docker compose version 1>/dev/null 2>/dev/null + then + if ! \docker-compose version 1>/dev/null 2>/dev/null + then + echo -e "\e[91m[ ❌ ] docker-compose was not found, exiting...\e[39m" && exit 1 + else + \docker-compose "$@" + fi + else + docker compose "$@" + fi +} + # set $SERVICE and $YES_ALL config() { From 442f7e0453fa380e4e3c7148e7d302c9c350d513 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 23 May 2022 16:29:10 +0200 Subject: [PATCH 16/18] (bug) fix #355 compatibility with the new docker-compose CLI --- CHANGELOG.md | 1 + doc/production_readme.md | 26 +++++++++++++------------- scripts/pg-analyzers.sh | 17 ++++++++++++++++- scripts/run.sh | 15 +++++++++++++++ setup/setup.sh | 19 ++++++++++++++++++- setup/upgrade.sh | 15 +++++++++++++++ 6 files changed, 78 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1418a46c..0ed0b81e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Fix a bug: Missing of description of PlanCategory migration - Fix a bug: Unable to create plans for all group - Fix a bug: backPrevLocation button on Notification Center opens reset password page (#348) +- Fix a bug: compatibility with the new docker-compose CLI (#355) - Fix a security issue: updated moment.js to 2.29.2. to fix [CVE-2022-24785](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-24785) - Fix a security issue: updated nokogiri to 1.13.6 to fix [CVE-2022-298240](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-298240) - Fix a security issue: updated async to 2.6.4 to fix [CVE-2021-43138](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-43138) diff --git a/doc/production_readme.md b/doc/production_readme.md index 856d37e50..f19640193 100644 --- a/doc/production_readme.md +++ b/doc/production_readme.md @@ -106,7 +106,7 @@ In order to remove ElasticSearch, you must **first** disable the statistics modu Then, you can remove the `elasticsearch` service from the [docker-compose.yml](../setup/docker-compose.yml) file and restart the whole application: ```bash -docker-compose down && docker-compose up -d +docker compose down && docker compose up -d ``` Disabling ElasticSearch will save up to 800 Mb of memory. @@ -118,11 +118,11 @@ Before using any of these commands, you must first `cd` into the app directory. - Read again the environment variables and restart ```bash -docker-compose down && docker-compose up -d +docker compose down && docker compose up -d ``` - Open a bash prompt inside the app container ```bash -docker-compose exec fabmanager bash +docker compose exec fabmanager bash ``` - Open the ruby console in the application ```bash @@ -130,11 +130,11 @@ docker-compose exec fabmanager bash ``` - Show services status ```bash -docker-compose ps +docker compose ps ``` - Run a command and provide it environment variables ```bash -docker-compose run --rm -e VAR1=xxx -e VAR2=xxx fabmanager bundle exec rails my:command +docker compose run --rm -e VAR1=xxx -e VAR2=xxx fabmanager bundle exec rails my:command ``` ## Update Fab-manager @@ -192,11 +192,11 @@ Then, you'll need to perform the upgrade with the following command: 2. Pull last docker images - `docker-compose pull` + `docker compose pull` 3. Stop the app - `docker-compose stop fabmanager` + `docker compose stop fabmanager` 4. Remove old assets @@ -204,7 +204,7 @@ Then, you'll need to perform the upgrade with the following command: 5. Compile new assets - `docker-compose run --rm fabmanager bundle exec rails assets:precompile` + `docker compose run --rm fabmanager bundle exec rails assets:precompile` 6. Run specific commands @@ -212,23 +212,23 @@ Then, you'll need to perform the upgrade with the following command: are always specified in the [CHANGELOG](https://github.com/sleede/fab-manager/blob/master/CHANGELOG.md) and prefixed by **[TODO DEPLOY]**. Those commands execute specific tasks and have to be run manually. - You must prefix the commands starting by `rails...` or `rake...` with: `docker-compose run --rm fabmanager bundle exec`. + You must prefix the commands starting by `rails...` or `rake...` with: `docker compose run --rm fabmanager bundle exec`. In any other cases, the other commands (like those invoking curl `\curl -sSL... | bash`) must not be prefixed. You can also ignore commands only applicable to development environnement, which are prefixed by `(dev)` in the CHANGELOG. 7. Restart all containers ```bash - docker-compose down - docker-compose up -d + docker compose down + docker compose up -d ``` -You can check that all containers are running with `docker-compose ps`. +You can check that all containers are running with `docker compose ps`. ### Upgrade to the last version -It's the default behaviour as `docker-compose pull` command will fetch the latest versions of the docker images. +It's the default behaviour as `docker compose pull` command will fetch the latest versions of the docker images. Be sure to run all the specific commands listed in the [CHANGELOG](https://github.com/sleede/fab-manager/blob/master/CHANGELOG.md) between your actual, and the new version in sequential order. __Example:__ to update from v2.4.0 to v2.4.3, you will run the specific commands for the v2.4.1, v2.4.2 and v2.4.3. diff --git a/scripts/pg-analyzers.sh b/scripts/pg-analyzers.sh index 7fac40058..3d2861859 100755 --- a/scripts/pg-analyzers.sh +++ b/scripts/pg-analyzers.sh @@ -1,3 +1,18 @@ #!/usr/bin/env bash -docker-compose exec -T postgres psql -Upostgres -c \\dFd | head -n -2 | tail -n +3 | awk '{ print gensub(/([a-z]+)_stem/,"\\1","g",$3); }' \ No newline at end of file +docker-compose() +{ + if ! docker compose version 1>/dev/null 2>/dev/null + then + if ! \docker-compose version 1>/dev/null 2>/dev/null + then + echo -e "\e[91m[ ❌ ] docker-compose was not found, exiting...\e[39m" && exit 1 + else + \docker-compose "$@" + fi + else + docker compose "$@" + fi +} + +docker-compose exec -T postgres psql -Upostgres -c \\dFd | head -n -2 | tail -n +3 | awk '{ print gensub(/([a-z]+)_stem/,"\\1","g",$3); }' diff --git a/scripts/run.sh b/scripts/run.sh index 2ebb674e3..09e49c9ce 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -8,6 +8,21 @@ config() { SERVICE="$(yq eval '.services.*.image | select(. == "sleede/fab-manager*") | path | .[-2]' docker-compose.yml)" } +docker-compose() +{ + if ! docker compose version 1>/dev/null 2>/dev/null + then + if ! \docker-compose version 1>/dev/null 2>/dev/null + then + echo -e "\e[91m[ ❌ ] docker-compose was not found, exiting...\e[39m" && exit 1 + else + \docker-compose "$@" + fi + else + docker compose "$@" + fi +} + run() { config diff --git a/setup/setup.sh b/setup/setup.sh index 2a15f77b3..e37db3066 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -45,7 +45,7 @@ system_requirements() fi done fi - local _commands=("sudo" "curl" "sed" "openssl" "docker" "docker-compose" "systemctl") + local _commands=("sudo" "curl" "sed" "openssl" "docker" "systemctl") for _command in "${_commands[@]}"; do echo "detecting $_command..." if ! command -v "$_command" @@ -54,9 +54,26 @@ system_requirements() echo -e "\e[91m[ ❌ ] $_command was not found, exiting...\e[39m" && exit 1 fi done + echo "detecting docker-compose..." + docker-compose version printf "\e[92m[ ✔ ] All requirements successfully checked.\e[39m \n\n" } +docker-compose() +{ + if ! docker compose version 1>/dev/null 2>/dev/null + then + if ! \docker-compose version 1>/dev/null 2>/dev/null + then + echo -e "\e[91m[ ❌ ] docker-compose was not found, exiting...\e[39m" && exit 1 + else + \docker-compose "$@" + fi + else + docker compose "$@" + fi +} + is_root() { return $(id -u) diff --git a/setup/upgrade.sh b/setup/upgrade.sh index ba4e6cf67..f3e48e451 100644 --- a/setup/upgrade.sh +++ b/setup/upgrade.sh @@ -43,6 +43,21 @@ jq() { docker run --rm -i -v "${PWD}:/data" imega/jq "$@" } +docker-compose() +{ + if ! docker compose version 1>/dev/null 2>/dev/null + then + if ! \docker-compose version 1>/dev/null 2>/dev/null + then + echo -e "\e[91m[ ❌ ] docker-compose was not found, exiting...\e[39m" && exit 1 + else + \docker-compose "$@" + fi + else + docker compose "$@" + fi +} + # set $SERVICE and $YES_ALL config() { From d106a12749f54df7528f45ac05ae709559b096a4 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 23 May 2022 16:59:52 +0200 Subject: [PATCH 17/18] (setup) Detect assets compilation issues and interrupt the script --- CHANGELOG.md | 1 + setup/setup.sh | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ed0b81e1..ef5f13425 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Disable to clicking outside or pressing escape to close sign up modal - Ability to disable colorize logging (#345) +- Detect assets compilation issue during the initial setup - Fix a bug: when machines module disabled, Associated machines is still shown in trainings list - Fix a bug: script mount-proof-of-identity-files unable to modify docker-compose.yml - Fix a bug: Event reservation calendar encoding in mail diff --git a/setup/setup.sh b/setup/setup.sh index e37db3066..226ed8536 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -380,7 +380,9 @@ setup_assets_and_databases() cd "$FABMANAGER_PATH" && docker-compose run --rm -e ADMIN_EMAIL="$EMAIL" -e ADMIN_PASSWORD="$PASSWORD" "$SERVICE" bundle exec rake db:seed # seed the database # now build the assets - cd "$FABMANAGER_PATH" && docker-compose run --rm "$SERVICE" bundle exec rake assets:precompile + if ! docker-compose -f "$FABMANAGER_PATH/docker-compose.yml" run --rm "$SERVICE" bundle exec rake assets:precompile; then + echo -e "\e[91m[ ❌ ] someting went wrong while compiling the assets, exiting...\e[39m" && exit 1 + fi # and prepare elasticsearch cd "$FABMANAGER_PATH" && docker-compose run --rm "$SERVICE" bundle exec rake fablab:es:build_stats From 04df9c1273fae9de5745a0e3ae4b9d3653baf783 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Mon, 23 May 2022 17:03:34 +0200 Subject: [PATCH 18/18] Version 5.4.1 --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef5f13425..7f49c963e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## next deploy +## v5.4.1 2022 May 23 + - Disable to clicking outside or pressing escape to close sign up modal - Ability to disable colorize logging (#345) - Detect assets compilation issue during the initial setup diff --git a/package.json b/package.json index dcce15730..4ed7b041d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fab-manager", - "version": "5.4.0", + "version": "5.4.1", "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",