diff --git a/CHANGELOG.md b/CHANGELOG.md index 11da68a94..a65de6096 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Improved contextual help with a modal dialog - Updated translations - Refactored translations to help merging Crowdin PR +- Fix a bug: unable to create new availabilities if SLOT_DURATION is not defined ## v4.3.1 2020 March 04 diff --git a/app/assets/javascripts/controllers/home.js b/app/assets/javascripts/controllers/home.js index 7bbfecab7..1d961ae00 100644 --- a/app/assets/javascripts/controllers/home.js +++ b/app/assets/javascripts/controllers/home.js @@ -41,7 +41,6 @@ Application.Controllers.controller('HomeController', ['$scope', '$stateParams', // We set the home page content, with the directives replacing the placeholders $scope.homeContent = insertDirectives(settingsPromise.home_content); - // for admins, setup the tour on login $scope.$watch('currentUser', function (newValue, oldValue) { if (!oldValue && newValue && newValue.role === 'admin') { diff --git a/app/models/availability.rb b/app/models/availability.rb index 0a01d0da7..eefba45c2 100644 --- a/app/models/availability.rb +++ b/app/models/availability.rb @@ -159,9 +159,9 @@ class Availability < ActiveRecord::Base private def length_must_be_slot_multiple - if end_at < (start_at + Rails.application.secrets.slot_duration.minutes) - errors.add(:end_at, I18n.t('availabilities.length_must_be_slot_multiple', MIN: Rails.application.secrets.slot_duration)) - end + return unless end_at < (start_at + ApplicationHelper::SLOT_DURATION.minutes) + + errors.add(:end_at, I18n.t('availabilities.length_must_be_slot_multiple', MIN: ApplicationHelper::SLOT_DURATION)) end def should_be_associated