forked from External/greenlight
		
	Merge pull request #131 from zach-chai/update_email
update recording notification email
This commit is contained in:
		@@ -215,7 +215,7 @@ class BbbController < ApplicationController
 | 
				
			|||||||
        # 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: room_id)
 | 
					          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
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # TODO: remove the webhook now that the meeting and recording are done
 | 
					        # TODO: remove the webhook now that the meeting and recording are done
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,9 +17,9 @@
 | 
				
			|||||||
class RecordingReadyEmailJob < ApplicationJob
 | 
					class RecordingReadyEmailJob < ApplicationJob
 | 
				
			||||||
  queue_as :default
 | 
					  queue_as :default
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def perform(user)
 | 
					  def perform(user, rec)
 | 
				
			||||||
    if user.email.present?
 | 
					    if user.email.present?
 | 
				
			||||||
      NotificationMailer.recording_ready_email(user).deliver
 | 
					      NotificationMailer.recording_ready_email(user, rec).deliver
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -257,7 +257,8 @@ module BbbApi
 | 
				
			|||||||
      length: recording[:length],
 | 
					      length: recording[:length],
 | 
				
			||||||
      listed: recording[:listed],
 | 
					      listed: recording[:listed],
 | 
				
			||||||
      playbacks: playbacks,
 | 
					      playbacks: playbacks,
 | 
				
			||||||
      previews: previews
 | 
					      previews: previews,
 | 
				
			||||||
 | 
					      participants: recording[:participants]
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,8 +17,9 @@
 | 
				
			|||||||
class NotificationMailer < ActionMailer::Base
 | 
					class NotificationMailer < ActionMailer::Base
 | 
				
			||||||
  default from: Rails.configuration.smtp_from
 | 
					  default from: Rails.configuration.smtp_from
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def recording_ready_email(user)
 | 
					  def recording_ready_email(user, rec)
 | 
				
			||||||
    @user = user
 | 
					    @user = user
 | 
				
			||||||
 | 
					    @recording = rec
 | 
				
			||||||
    @room_url = meeting_room_url(resource: 'rooms', id: user.encrypted_id)
 | 
					    @room_url = meeting_room_url(resource: 'rooms', id: user.encrypted_id)
 | 
				
			||||||
    unless @room_url.include? "#{Rails.configuration.relative_url_root}/"
 | 
					    unless @room_url.include? "#{Rails.configuration.relative_url_root}/"
 | 
				
			||||||
      @room_url = @room_url.split('/rooms/').join("#{Rails.configuration.relative_url_root}/rooms/")
 | 
					      @room_url = @room_url.split('/rooms/').join("#{Rails.configuration.relative_url_root}/rooms/")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,6 +21,37 @@
 | 
				
			|||||||
  <body>
 | 
					  <body>
 | 
				
			||||||
    <p><%= t('.hi', name: @user.name) %></p>
 | 
					    <p><%= t('.hi', name: @user.name) %></p>
 | 
				
			||||||
    <p><%= t('.phrase1') %></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>
 | 
					  </body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -107,10 +107,24 @@ en-US:
 | 
				
			|||||||
  no: No
 | 
					  no: No
 | 
				
			||||||
  notification_mailer:
 | 
					  notification_mailer:
 | 
				
			||||||
    recording_ready_email:
 | 
					    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}"
 | 
					      hi: "Hi, %{name}"
 | 
				
			||||||
      phrase1: "One of your recordings has just been made available."
 | 
					      phrase1: "This is an e-mail notification that your recording for the session is ready."
 | 
				
			||||||
      phrase2: "Access the following website to view it and publish to other users: %{url}"
 | 
					      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!"
 | 
					      subject: "Your recording is ready!"
 | 
				
			||||||
 | 
					      table:
 | 
				
			||||||
 | 
					        ended: Ended
 | 
				
			||||||
 | 
					        name: Name
 | 
				
			||||||
 | 
					        length: Length
 | 
				
			||||||
 | 
					        length_value: "%{value} minutes"
 | 
				
			||||||
 | 
					        started: Started
 | 
				
			||||||
 | 
					        users: Users
 | 
				
			||||||
  participants: Users
 | 
					  participants: Users
 | 
				
			||||||
  past_recordings: Past Recordings
 | 
					  past_recordings: Past Recordings
 | 
				
			||||||
  presentation: Presentation
 | 
					  presentation: Presentation
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user