From 4499919a800dcdde8151585da1046816f6fea317 Mon Sep 17 00:00:00 2001 From: Jakub Motycka Date: Mon, 26 Sep 2022 10:40:15 +0200 Subject: [PATCH] chore: disable staffomatic --- app/models/contact.rb | 2 ++ app/policies/group_offer_policy.rb | 2 +- app/views/volunteers/_buttons.html.slim | 2 +- config/schedule.rb | 9 +++++---- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index e1e1f6f97..f8f234aef 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -86,6 +86,8 @@ class Contact < ApplicationRecord end def update_staffomatic + return true unless StaffomaticService.configured? + contactable.update_staffomatic! if contactable.is_a?(Volunteer) end end diff --git a/app/policies/group_offer_policy.rb b/app/policies/group_offer_policy.rb index d94645070..78b7076d4 100644 --- a/app/policies/group_offer_policy.rb +++ b/app/policies/group_offer_policy.rb @@ -17,7 +17,7 @@ class GroupOfferPolicy < ApplicationPolicy group_assignments_attributes ] attributes << :department_id if edit? - attributes << :staffomatic_department_ids if superadmin? + attributes << :staffomatic_department_ids if superadmin? && StaffomaticService.configured? attributes end diff --git a/app/views/volunteers/_buttons.html.slim b/app/views/volunteers/_buttons.html.slim index 1ecd15e50..de15d166b 100644 --- a/app/views/volunteers/_buttons.html.slim +++ b/app/views/volunteers/_buttons.html.slim @@ -28,6 +28,6 @@ ul.list-inline li= button_link icon_span(:email_subject), '#', title: 'Email subject', data: { subject: "[fw #{@volunteer.id}]" } - if policy(Event).index? li= button_link 'Veranstaltungen', events_path(q: { event_volunteers_volunteer_id_eq: @volunteer.id }) - - if policy(@volunteer).superadmin? && @volunteer.staffomatic_user_id.blank? + - if policy(@volunteer).superadmin? && @volunteer.staffomatic_user_id.blank? && StaffomaticService.configured? li= button_link 'Invite to Staffomatic', staffomatic_invite_volunteer_path(@volunteer), { class: 'btn btn-default', title: 'Invite to Staffomatic' } diff --git a/config/schedule.rb b/config/schedule.rb index d0e555a7e..4a61b889d 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -15,7 +15,8 @@ every 5.minutes do rake 'email_journal:create_journals' end -every 5.minutes do - rake 'staffomatic:synchronize' - rake 'staffomatic:clean_volunteers' -end +# disabled +# every 5.minutes do +# rake 'staffomatic:synchronize' +# rake 'staffomatic:clean_volunteers' +# end -- GitLab