fix(instructeur): copy notifications settings from previous groupe instructeur
fix #6763
This commit is contained in:
parent
2f6cd317bf
commit
4e779f445d
6 changed files with 111 additions and 49 deletions
|
@ -81,14 +81,13 @@ class Instructeur < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def remove_from_groupe_instructeur(groupe_instructeur)
|
||||
if groupe_instructeur.in?(groupe_instructeurs)
|
||||
groupe_instructeurs.destroy(groupe_instructeur)
|
||||
follows
|
||||
.joins(:dossier)
|
||||
.where(dossiers: { groupe_instructeur: groupe_instructeur })
|
||||
.update_all(unfollowed_at: Time.zone.now)
|
||||
end
|
||||
NOTIFICATION_SETTINGS = [:daily_email_notifications_enabled, :instant_email_dossier_notifications_enabled, :instant_email_message_notifications_enabled, :weekly_email_notifications_enabled]
|
||||
|
||||
def notification_settings(procedure_id)
|
||||
assign_to
|
||||
.joins(:groupe_instructeur)
|
||||
.find_by(groupe_instructeurs: { procedure_id: procedure_id })
|
||||
&.slice(*NOTIFICATION_SETTINGS) || {}
|
||||
end
|
||||
|
||||
def last_week_overview
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue