forked from External/greenlight
update recording notify to work with new workflow
This commit is contained in:
parent
dbfed8eba4
commit
63fbc27bca
|
@ -202,6 +202,7 @@ class BbbController < ApplicationController
|
||||||
if eventName == "publish_ended"
|
if eventName == "publish_ended"
|
||||||
if event['payload'] && event['payload']['metadata'] && event['payload']['meeting_id']
|
if event['payload'] && event['payload']['metadata'] && event['payload']['meeting_id']
|
||||||
token = event['payload']['metadata'][META_TOKEN]
|
token = event['payload']['metadata'][META_TOKEN]
|
||||||
|
room_id = event['payload']['metadata']['room-id']
|
||||||
record_id = event['payload']['meeting_id']
|
record_id = event['payload']['meeting_id']
|
||||||
|
|
||||||
# the webhook event doesn't have all the data we need, so we need
|
# the webhook event doesn't have all the data we need, so we need
|
||||||
|
@ -209,11 +210,11 @@ class BbbController < ApplicationController
|
||||||
# TODO: if the webhooks included all data in the event we wouldn't need this
|
# TODO: if the webhooks included all data in the event we wouldn't need this
|
||||||
rec_info = bbb_get_recordings({recordID: record_id})
|
rec_info = bbb_get_recordings({recordID: record_id})
|
||||||
rec_info = rec_info[:recordings].first
|
rec_info = rec_info[:recordings].first
|
||||||
RecordingCreatedJob.perform_later(token, parse_recording_for_view(rec_info))
|
RecordingCreatedJob.perform_later(token, room_id, parse_recording_for_view(rec_info))
|
||||||
|
|
||||||
# send an email to the owner of this recording, if defined
|
# send an email to the owner of this recording, if defined
|
||||||
if Rails.configuration.mail_notifications
|
if Rails.configuration.mail_notifications
|
||||||
owner = User.find_by(encrypted_id: token)
|
owner = User.find_by(encrypted_id: room_id)
|
||||||
RecordingReadyEmailJob.perform_later(owner) if owner.present?
|
RecordingReadyEmailJob.perform_later(owner) if owner.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,10 @@ class RecordingCreatedJob < ApplicationJob
|
||||||
|
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
def perform(room, recording)
|
def perform(token, room, recording)
|
||||||
ActionCable.server.broadcast "#{room}_recording_updates_channel",
|
ActionCable.server.broadcast "#{room}_recording_updates_channel",
|
||||||
{ action: 'create' }.merge(recording)
|
{ action: 'create' }.merge(recording)
|
||||||
|
ActionCable.server.broadcast "#{token}_recording_updates_channel",
|
||||||
|
{ action: 'create' }.merge(recording)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ class NotificationMailer < ActionMailer::Base
|
||||||
|
|
||||||
def recording_ready_email(user)
|
def recording_ready_email(user)
|
||||||
@user = user
|
@user = user
|
||||||
@room_url = resource_url(resource: "rooms", id: user.encrypted_id)
|
@room_url = meeting_room_url(resource: 'rooms', id: user.encrypted_id)
|
||||||
mail(to: user.email, subject: t('.subject'))
|
mail(to: user.email, subject: t('.subject'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,11 +43,11 @@ Rails.application.routes.draw do
|
||||||
get '/:id/wait', to: 'landing#wait_for_moderator'
|
get '/:id/wait', to: 'landing#wait_for_moderator'
|
||||||
get '/:id/session_status_refresh', to: 'landing#session_status_refresh'
|
get '/:id/session_status_refresh', to: 'landing#session_status_refresh'
|
||||||
end
|
end
|
||||||
|
post '/:room_id/:id/callback', to: 'bbb#callback' #, defaults: {format: 'json'}
|
||||||
|
|
||||||
# routes shared between meetings and rooms
|
# routes shared between meetings and rooms
|
||||||
get '/(:room_id)/:id/join', to: 'bbb#join', defaults: {room_id: nil, format: 'json'}
|
get '/(:room_id)/:id/join', to: 'bbb#join', defaults: {room_id: nil, format: 'json'}
|
||||||
get '/(:room_id)/:id', to: 'landing#resource', as: :meeting_room, defaults: {room_id: nil}
|
get '/(:room_id)/:id', to: 'landing#resource', as: :meeting_room, defaults: {room_id: nil}
|
||||||
post '/:id/callback', to: 'bbb#callback' #, defaults: {format: 'json'}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
root to: 'landing#index', :resource => 'meetings'
|
root to: 'landing#index', :resource => 'meetings'
|
||||||
|
|
Loading…
Reference in New Issue