add more information to recording ready email

This commit is contained in:
Josh
2017-06-22 15:15:03 -04:00
parent 78a2f33f2d
commit 7e16f042a5
6 changed files with 65 additions and 2 deletions

View File

@ -263,6 +263,7 @@ class BbbController < ApplicationController
token = event['payload']['metadata'][META_TOKEN]
room_id = event['payload']['metadata']['room-id']
record_id = event['payload']['meeting_id']
duration_data = event['payload']['duration']
# the webhook event doesn't have all the data we need, so we need
# to send a getRecordings anyway
@ -271,6 +272,8 @@ class BbbController < ApplicationController
rec_info = rec_info[:recordings].first
RecordingCreatedJob.perform_later(token, room_id, parse_recording_for_view(rec_info))
rec_info[:duration] = duration_data.to_json
# send an email to the owner of this recording, if defined
if Rails.configuration.mail_notifications
owner = User.find_by(encrypted_id: room_id)

View File

@ -263,7 +263,8 @@ module BbbApi
listed: recording[:listed],
playbacks: playbacks,
previews: previews,
participants: recording[:participants]
participants: recording[:participants],
duration: recording[:duration]
}
end

View File

@ -20,6 +20,7 @@ class NotificationMailer < ActionMailer::Base
def recording_ready_email(user, rec)
@user = user
@recording = rec
@duration = JSON.parse(rec[:duration])
@room_url = meeting_room_url(resource: 'rooms', id: user.encrypted_id)
# Need this because URL doesn't respect the relative_url_root by default

View File

@ -43,6 +43,30 @@
<td><b><%= @recording[:participants] %></b></td>
</tr>
</table>
<br>
<table style = "padding:0 15px 0 15px;">
<tr>
<th style = "padding:0 15px 0 15px;"><b><%= t('.user_table.user') %></b></th>
<th style = "padding:0 15px 0 15px;"><b><%= t('.user_table.role') %></b></th>
<th style = "padding:0 15px 0 15px;"><b><%= t('.user_table.join') %></b></th>
<th style = "padding:0 15px 0 15px;"><b><%= t('.user_table.left') %></b></th>
<th style = "padding:0 15px 0 15px;"><b><%= t('.user_table.duration') %></b></th>
</tr>
<% @duration.each do |user| %>
<tr>
<td style = "padding:0 15px 0 15px;"><%= user[1]['name'] %></td>
<td style = "padding:0 15px 0 15px;"><%= user[1]['role'].downcase.capitalize %></td>
<td style = "padding:0 15px 0 15px;"><%= Time.at(user[1]['join'] / 1000).strftime("%H:%M:%S") %></td>
<td style = "padding:0 15px 0 15px;"><%= Time.at(user[1]['left'] / 1000).strftime("%H:%M:%S") %></td>
<td style = "padding:0 15px 0 15px;"><%= Time.at(user[1]['duration'] / 1000).utc.strftime("%H:%M:%S") %></td>
</tr>
<% end %>
</table>
<br>
<p><%= t('thumbnails') %>:</p>
<% @recording[:previews].each do |preview| %>
<img style = "display:inline;" src = "<%= preview[:url] %>" alt = "<%= preview[:alt] %>">
<% end %>
<p><%= t('.phrase2') %></p>
<p style="text-align:center;"><%= link_to(@recording[:playbacks][0][:url], @recording[:playbacks][0][:url]) %></p>
<p><%= t('.phrase3_html') %></p>