Aggiunge modulo Replay, Garage dev e YouTube a livello società.
Pipeline registrazione/upload con storage S3, archivio web e app, proxy replay per il browser, OAuth YouTube sulla pagina club (Premium Full) e footer legale. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
33
backend/app/services/recordings/notify_expiring.rb
Normal file
33
backend/app/services/recordings/notify_expiring.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
module Recordings
|
||||
class NotifyExpiring
|
||||
WINDOW_DAYS = 7
|
||||
|
||||
def initialize(recording)
|
||||
@recording = recording
|
||||
end
|
||||
|
||||
def call
|
||||
return @recording if @recording.expiry_warning_sent_at.present?
|
||||
return @recording unless @recording.ready?
|
||||
return @recording if @recording.expires_at.blank?
|
||||
return @recording unless @recording.expires_at <= WINDOW_DAYS.days.from_now
|
||||
|
||||
recipients.each do |user|
|
||||
Recordings::ReplayMailer.replay_expiring_soon(recording: @recording, recipient: user).deliver_now
|
||||
end
|
||||
|
||||
@recording.update!(expiry_warning_sent_at: Time.current)
|
||||
@recording
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def recipients
|
||||
club = @recording.team.club
|
||||
owner = club.owner
|
||||
users = club.users.distinct.to_a
|
||||
users << owner if owner && users.none? { |u| u.id == owner.id }
|
||||
users.uniq.select { |u| u.email.present? }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user