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>

View File

@ -107,10 +107,24 @@ en-US:
no: No
notification_mailer:
recording_ready_email:
closing: "Regards,... BigBlueButton"
footer:
phrase1: This e-mail is auto-generated by your friendly neighbourhood BigBlueButton server. Do no reply to this e-mail.
phrase2_html: BigBlueButton is an open source web conferencing system. For more information on BigBlueButton and it's amazing capabilities, see %{url}.
hi: "Hi, %{name}"
phrase1: "One of your recordings has just been made available."
phrase2: "Access the following website to view it and publish to other users: %{url}"
phrase1: "This is an e-mail notification that your recording for the session is ready."
phrase2: "Here's the direct link to the recording"
phrase3_html: "This recording is currently <b>unlisted</b>, which means only users with the above direct link can view the recording."
phrase4: "To make this recording public for everyone, visit"
phrase5: "and change its visibility from unlisted to public. After the recording is public, anyone with the above URL can view it."
subject: "Your recording is ready!"
table:
ended: Ended
name: Name
length: Length
length_value: "%{value} minutes"
started: Started
users: Users
participants: Users
past_recordings: Past Recordings
presentation: Presentation