Reorder methods in instructeur.rb
Move token stuff together, out of notification-related stuff.
This commit is contained in:
parent
71db4ea32f
commit
8a06c01f13
1 changed files with 10 additions and 10 deletions
|
@ -137,11 +137,6 @@ class Instructeur < ApplicationRecord
|
||||||
Dossier.joins(:groupe_instructeur).where(id: dossiers_id_with_notifications(dossiers)).group('groupe_instructeurs.procedure_id').count
|
Dossier.joins(:groupe_instructeur).where(id: dossiers_id_with_notifications(dossiers)).group('groupe_instructeurs.procedure_id').count
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_trusted_device_token
|
|
||||||
trusted_device_token = trusted_device_tokens.create
|
|
||||||
trusted_device_token.token
|
|
||||||
end
|
|
||||||
|
|
||||||
def dossiers_id_with_notifications(dossiers)
|
def dossiers_id_with_notifications(dossiers)
|
||||||
dossiers = dossiers.followed_by(self)
|
dossiers = dossiers.followed_by(self)
|
||||||
|
|
||||||
|
@ -173,11 +168,6 @@ class Instructeur < ApplicationRecord
|
||||||
Follow.where(instructeur: self, dossier: dossier).update_all(attributes)
|
Follow.where(instructeur: self, dossier: dossier).update_all(attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
def young_login_token?
|
|
||||||
trusted_device_token = trusted_device_tokens.order(created_at: :desc).first
|
|
||||||
trusted_device_token&.token_young?
|
|
||||||
end
|
|
||||||
|
|
||||||
def email_notification_data
|
def email_notification_data
|
||||||
groupe_instructeur_with_email_notifications
|
groupe_instructeur_with_email_notifications
|
||||||
.reduce([]) do |acc, groupe|
|
.reduce([]) do |acc, groupe|
|
||||||
|
@ -199,6 +189,16 @@ class Instructeur < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create_trusted_device_token
|
||||||
|
trusted_device_token = trusted_device_tokens.create
|
||||||
|
trusted_device_token.token
|
||||||
|
end
|
||||||
|
|
||||||
|
def young_login_token?
|
||||||
|
trusted_device_token = trusted_device_tokens.order(created_at: :desc).first
|
||||||
|
trusted_device_token&.token_young?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def annotations_hash(demande, annotations_privees, avis, messagerie)
|
def annotations_hash(demande, annotations_privees, avis, messagerie)
|
||||||
|
|
Loading…
Add table
Reference in a new issue