Merge pull request #10883 from colinux/helpscout-instructeur-notif
ETQ support je vois dans HS lorsqu'un instructeur a désactivé ses notifications
This commit is contained in:
commit
3923e316e1
2 changed files with 26 additions and 0 deletions
|
@ -41,6 +41,18 @@ class WebhookController < ActionController::Base
|
|||
if instructeur
|
||||
url = manager_instructeur_url(instructeur)
|
||||
html << link_to_manager(instructeur, url)
|
||||
|
||||
disabled_notifications = instructeur.assign_to.filter do |assign_to|
|
||||
!assign_to.instant_email_dossier_notifications_enabled ||
|
||||
!assign_to.instant_email_message_notifications_enabled ||
|
||||
!assign_to.instant_expert_avis_email_notifications_enabled
|
||||
end
|
||||
|
||||
html << "Notifications activées" if disabled_notifications.empty?
|
||||
disabled_notifications.each do |assign_to|
|
||||
html << "Notifs désactivées Procedure##{assign_to.groupe_instructeur.procedure_id}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if administrateur
|
||||
|
|
|
@ -63,6 +63,20 @@ describe WebhookController, type: :controller do
|
|||
it 'returns a link to the Administrateur profile in the Manager' do
|
||||
expect(payload).to have_key('html')
|
||||
expect(payload['html']).to have_selector("a[href='#{manager_administrateur_url(admin)}']")
|
||||
expect(payload['html']).to have_text("Notifications activées")
|
||||
end
|
||||
end
|
||||
|
||||
context "when notifications are disabled" do
|
||||
let(:instructeur) { create(:instructeur, user:) }
|
||||
let(:procedure) { create(:procedure) }
|
||||
before do
|
||||
create(:assign_to, instructeur:, procedure:,
|
||||
instant_email_dossier_notifications_enabled: false)
|
||||
end
|
||||
|
||||
it 'returns a summary of disabled notifications' do
|
||||
expect(payload['html']).to have_text("Notifs désactivées Procedure##{procedure.id}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue