update recording notification email

This commit is contained in:
Zachary Chai
2017-02-22 12:13:33 -05:00
parent 80374e02a5
commit ebc52d2271
6 changed files with 55 additions and 8 deletions

View File

@ -215,7 +215,7 @@ class BbbController < ApplicationController
# send an email to the owner of this recording, if defined
if Rails.configuration.mail_notifications
owner = User.find_by(encrypted_id: room_id)
RecordingReadyEmailJob.perform_later(owner) if owner.present?
RecordingReadyEmailJob.perform_later(owner, parse_recording_for_view(rec_info)) if owner.present?
end
# TODO: remove the webhook now that the meeting and recording are done

View File

@ -17,9 +17,9 @@
class RecordingReadyEmailJob < ApplicationJob
queue_as :default
def perform(user)
def perform(user, rec)
if user.email.present?
NotificationMailer.recording_ready_email(user).deliver
NotificationMailer.recording_ready_email(user, rec).deliver
end
end
end

View File

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

View File

@ -17,8 +17,9 @@
class NotificationMailer < ActionMailer::Base
default from: Rails.configuration.smtp_from
def recording_ready_email(user)
def recording_ready_email(user, rec)
@user = user
@recording = rec
@room_url = meeting_room_url(resource: 'rooms', id: user.encrypted_id)
unless @room_url.include? "#{Rails.configuration.relative_url_root}/"
@room_url = @room_url.split('/rooms/').join("#{Rails.configuration.relative_url_root}/rooms/")

View File

@ -21,6 +21,37 @@
<body>
<p><%= t('.hi', name: @user.name) %></p>
<p><%= t('.phrase1') %></p>
<p><%= t('.phrase2', url: @room_url) %></p>
<table border="1" cellspacing="0" cellpadding="4">
<tr>
<td><%= t('.table.name') %></td>
<td><%= @recording[:name] %></td>
</tr>
<tr>
<td><%= t('.table.length') %></td>
<td><%= t('.table.length_value', value: @recording[:length]) %></td>
</tr>
<tr>
<td><%= t('.table.started') %></td>
<td><%= Time.parse(@recording[:start_time]).utc %></td>
</tr>
<tr>
<td><%= t('.table.ended') %></td>
<td><%= Time.parse(@recording[:end_time]).utc %></td>
</tr>
<tr>
<td><%= t('.table.users') %></td>
<td><%= @recording[:participants] %></td>
</tr>
</table>
<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>
<p><%= t('.phrase4') %></p>
<p style="text-align:center;"><%= link_to(@room_url, @room_url) %></p>
<p><%= t('.phrase5') %></p>
<p><%= t('.closing') %></p>
--
<p><%= t('.footer.phrase1') %></p>
<p><%= t('.footer.phrase2_html', url: link_to("http://bigbluebutton.org/", "http://bigbluebutton.org/")) %></p>
</body>
</html>