forked from External/greenlight
Merge pull request #128 from zach-chai/update_recording_notify
update recording notify to work with new workflow
This commit is contained in:
commit
16a1626130
|
@ -202,6 +202,7 @@ class BbbController < ApplicationController
|
|||
if eventName == "publish_ended"
|
||||
if event['payload'] && event['payload']['metadata'] && event['payload']['meeting_id']
|
||||
token = event['payload']['metadata'][META_TOKEN]
|
||||
room_id = event['payload']['metadata']['room-id']
|
||||
record_id = event['payload']['meeting_id']
|
||||
|
||||
# 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
|
||||
rec_info = bbb_get_recordings({recordID: record_id})
|
||||
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
|
||||
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?
|
||||
end
|
||||
|
||||
|
|
|
@ -19,8 +19,10 @@ class RecordingCreatedJob < ApplicationJob
|
|||
|
||||
queue_as :default
|
||||
|
||||
def perform(room, recording)
|
||||
def perform(token, room, recording)
|
||||
ActionCable.server.broadcast "#{room}_recording_updates_channel",
|
||||
{ action: 'create' }.merge(recording)
|
||||
ActionCable.server.broadcast "#{token}_recording_updates_channel",
|
||||
{ action: 'create' }.merge(recording)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ class NotificationMailer < ActionMailer::Base
|
|||
|
||||
def recording_ready_email(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'))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -43,11 +43,11 @@ Rails.application.routes.draw do
|
|||
get '/:id/wait', to: 'landing#wait_for_moderator'
|
||||
get '/:id/session_status_refresh', to: 'landing#session_status_refresh'
|
||||
end
|
||||
post '/:room_id/:id/callback', to: 'bbb#callback' #, defaults: {format: 'json'}
|
||||
|
||||
# routes shared between meetings and rooms
|
||||
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}
|
||||
post '/:id/callback', to: 'bbb#callback' #, defaults: {format: 'json'}
|
||||
end
|
||||
|
||||
root to: 'landing#index', :resource => 'meetings'
|
||||
|
|
Loading…
Reference in New Issue