Compare commits
16 Commits
API-can-fe
...
show-owner
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d83cff8d2 | ||
|
|
a8944c6c4a | ||
|
|
7e571845d8 | ||
|
|
d1aa103d9c | ||
|
|
3242bebd6a | ||
|
|
6267f12cc4 | ||
|
|
78d182624d | ||
|
|
088994b90c | ||
|
|
fd7357045c | ||
|
|
6378d45274 | ||
|
|
708cc5e0a8 | ||
|
|
56d73d9844 | ||
|
|
580312bc52 | ||
|
|
0294a480ee | ||
|
|
a7b7e1ecf9 | ||
|
|
8214ba9e67 |
@@ -16,9 +16,10 @@ REDIS_URL=
|
||||
# Required for Zoom.us integration
|
||||
ZOOM_API_KEY=
|
||||
ZOOM_API_SECRET=
|
||||
ZOOM_ACCOUNT_NUMBER=
|
||||
ZOOM_PRO_USERS_LIMIT= # defaults to 3
|
||||
ZOOM_USER_TYPE= # 'pro' / 'basic'
|
||||
ZOOM_ENABLE_RECORDINGS=0 # 0 / 1
|
||||
ZOOM_ENABLE_RECORDINGS= # true / false (default: false)
|
||||
# Token for webhooks authorization
|
||||
ZOOM_VERIFICATION_TOKEN=
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ class Admin::AccountsController < Admin::ApplicationController
|
||||
|
||||
def show
|
||||
@videos = filtered_account_videos.order(created_at: :desc, project_id: :desc).paginate(page: params[:page])
|
||||
@broadcasts = account_broadcasts.order(created_at: :desc, project_id: :desc).paginate(page: params[:page])
|
||||
end
|
||||
|
||||
def edit
|
||||
@@ -70,4 +71,8 @@ class Admin::AccountsController < Admin::ApplicationController
|
||||
@account.videos
|
||||
end
|
||||
end
|
||||
|
||||
def account_broadcasts
|
||||
@account.broadcasts
|
||||
end
|
||||
end
|
||||
|
||||
24
app/controllers/admin/broadcasts_controller.rb
Normal file
24
app/controllers/admin/broadcasts_controller.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
class Admin::BroadcastsController < Admin::ApplicationController
|
||||
before_action :set_broadcast, only: [:edit, :update]
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @broadcast.update(broadcast_update_params)
|
||||
redirect_to [:admin, @broadcast.project.account], notice: t(".notice")
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_broadcast
|
||||
@broadcast = authorize policy_scope(Broadcast).find(params[:id])
|
||||
end
|
||||
|
||||
def broadcast_update_params
|
||||
params.require(:broadcast).permit(:stream_url_override, :stream_key_override, :director_mode_video_embed)
|
||||
end
|
||||
end
|
||||
26
app/controllers/broadcast_recordings_controller.rb
Normal file
26
app/controllers/broadcast_recordings_controller.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
class BroadcastRecordingsController < ApplicationController
|
||||
layout "project"
|
||||
|
||||
before_action :set_project
|
||||
before_action :set_broadcast
|
||||
before_action :set_recording
|
||||
|
||||
def destroy
|
||||
@recording.update(hidden: true)
|
||||
@recordings = @broadcast.broadcast_recordings.visible.order_by_recent.paginate(page: params[:page])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_project
|
||||
@project = policy_scope(Project).find(params[:project_id])
|
||||
end
|
||||
|
||||
def set_broadcast
|
||||
@broadcast = authorize policy_scope(@project.broadcasts).find(params[:broadcast_id])
|
||||
end
|
||||
|
||||
def set_recording
|
||||
@recording = authorize policy_scope(@broadcast.broadcast_recordings).find(params[:id])
|
||||
end
|
||||
end
|
||||
@@ -27,7 +27,7 @@ class BroadcastsController < ApplicationController
|
||||
|
||||
def show
|
||||
@conference_url = url_for [@broadcast.project, @broadcast, :zoom_meeting]
|
||||
@recordings = @broadcast.broadcast_recordings.order_by_recent.paginate(page: params[:page])
|
||||
@recordings = @broadcast.broadcast_recordings.visible.order_by_recent.paginate(page: params[:page])
|
||||
@files = @broadcast.files.order("created_at DESC").paginate(page: params[:files_page])
|
||||
render layout: 'application'
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class Public::BroadcastsController < Public::BaseController
|
||||
def show
|
||||
@conference_url = broadcast_zoom_meeting_url(@broadcast.token)
|
||||
@multi_view_broadcasts = multi_view_broadcasts
|
||||
@recordings = @broadcast.broadcast_recordings.order_by_recent.paginate(page: params[:page])
|
||||
@recordings = @broadcast.broadcast_recordings.visible.order_by_recent.paginate(page: params[:page])
|
||||
@files = @broadcast.files.order("created_at DESC").paginate(page: params[:files_page])
|
||||
|
||||
render 'broadcasts/show'
|
||||
|
||||
@@ -35,7 +35,7 @@ class StreamNotificationsController < ApplicationController
|
||||
duration = notification.dig(:data, :duration)
|
||||
|
||||
recording = @broadcast.broadcast_recordings.create!(asset_uid: asset_uid, asset_playback_uid: playback_uid, file_name: file_name, duration: duration)
|
||||
recordings = @broadcast.broadcast_recordings.order_by_recent.paginate(page: params[:page])
|
||||
recordings = @broadcast.broadcast_recordings.visible.order_by_recent.paginate(page: params[:page])
|
||||
|
||||
link = helpers.link_to(recording.broadcast_name.titleize, recording.download_url, target: "_blank")
|
||||
message = "Your recent live stream has been recorded and is available for download here: #{link}"
|
||||
|
||||
@@ -5,6 +5,7 @@ class Account < ApplicationRecord
|
||||
has_many :users, through: :account_auths
|
||||
has_many :projects, dependent: :destroy
|
||||
has_many :videos, through: :projects
|
||||
has_many :broadcasts, through: :projects
|
||||
has_many :contract_templates, through: :projects
|
||||
|
||||
validates :name, presence: true
|
||||
|
||||
@@ -18,7 +18,7 @@ class AcquiredMediaRelease < ApplicationRecord
|
||||
|
||||
class << self
|
||||
def custom_csv_exportable_headers
|
||||
%i[name file_infos_count]
|
||||
%i[name file_infos_count owner_info]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -35,7 +35,11 @@ class Broadcast < ApplicationRecord
|
||||
end
|
||||
|
||||
def stream_server_url
|
||||
ENV['MUX_BROADCAST_SERVER_URL']
|
||||
stream_url_override.presence || ENV["MUX_BROADCAST_SERVER_URL"]
|
||||
end
|
||||
|
||||
def stream_server_key
|
||||
stream_key_override.presence || stream_key
|
||||
end
|
||||
|
||||
def zoom_meeting_url
|
||||
|
||||
@@ -5,6 +5,8 @@ class BroadcastRecording < ApplicationRecord
|
||||
|
||||
validates :asset_uid, uniqueness: true
|
||||
|
||||
scope :visible, -> { where(hidden: false) }
|
||||
|
||||
def download_url
|
||||
"https://stream.mux.com/#{asset_playback_uid}/#{file_name}?download=#{download_file_name}"
|
||||
end
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
module CsvExportable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
COMMON_HEADERS = %i[approved? notes tags signed_at].freeze
|
||||
COMMON_VALUES = %w[clean_notes clean_tags signed_on].freeze
|
||||
COMMON_HEADERS = %i[approved notes tags signed_at].freeze
|
||||
COMMON_VALUES = %w[approved? clean_notes clean_tags signed_on].freeze
|
||||
|
||||
included do
|
||||
class << self
|
||||
@@ -29,11 +29,20 @@ module CsvExportable
|
||||
|
||||
private
|
||||
|
||||
def owner_info
|
||||
compact_contact_info(name: person_name, address: person_address, phone: person_phone, email: person_email)
|
||||
end
|
||||
|
||||
def contact_info
|
||||
owner_info
|
||||
end
|
||||
|
||||
def compact_contact_info(name: nil, address: nil, phone: nil, email: nil)
|
||||
contact_info = ''
|
||||
contact_info += "#{person_address}; " if person_address.present?
|
||||
contact_info += "P: #{person_phone}; " if person_phone.present?
|
||||
contact_info += "E: #{person_email}" if person_email.present?
|
||||
contact_info += "#{name}; " if name.present?
|
||||
contact_info += "#{address}; " if address.present?
|
||||
contact_info += "P: #{phone}; " if phone.present?
|
||||
contact_info += "E: #{email}" if email.present?
|
||||
contact_info.delete_suffix '; '
|
||||
end
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class LocationRelease < ApplicationRecord
|
||||
|
||||
class << self
|
||||
def custom_csv_exportable_headers
|
||||
%i[name address]
|
||||
%i[location_info owner_info amendment_signed_column]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -67,6 +67,18 @@ class LocationRelease < ApplicationRecord
|
||||
true
|
||||
end
|
||||
|
||||
def location_info
|
||||
compact_contact_info(name: name, address: address)
|
||||
end
|
||||
|
||||
def amendment_signed_column
|
||||
if amendment_signable?
|
||||
amendment_signed?
|
||||
else
|
||||
I18n.t('location_releases.csv.no_amendment_clause')
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def end_date_after_start_date
|
||||
|
||||
@@ -20,7 +20,7 @@ class MaterialRelease < ApplicationRecord
|
||||
|
||||
class << self
|
||||
def custom_csv_exportable_headers
|
||||
%i[name]
|
||||
%i[name owner_info]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
9
app/policies/broadcast_recording_policy.rb
Normal file
9
app/policies/broadcast_recording_policy.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class BroadcastRecordingPolicy < ApplicationPolicy
|
||||
def destroy?
|
||||
if user.nil? || user.user.nil?
|
||||
return false
|
||||
end
|
||||
|
||||
user.manager? || user.account_manager?
|
||||
end
|
||||
end
|
||||
@@ -18,6 +18,9 @@
|
||||
<%= fa_icon("warning", text: t(".no_media"), class: "text-danger") %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= contact_info_for(acquired_media_release.contact_person) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= notes_preview acquired_media_release.notes.order_by_recent %>
|
||||
</td>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<th><%= t '.table_headers.approved'%></th>
|
||||
<th><%= AcquiredMediaRelease.human_attribute_name(:name) %></th>
|
||||
<th><%= t(".table_headers.file_infos_count") %></th>
|
||||
<th><%= t(".table_headers.owner_info") %></th>
|
||||
<th><%= t(".table_headers.notes") %></th>
|
||||
<th><%= t(".table_headers.tags") %></th>
|
||||
<th><%= t(".table_headers.signed_at") %></th>
|
||||
|
||||
13
app/views/admin/accounts/_broadcast.html.erb
Normal file
13
app/views/admin/accounts/_broadcast.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<tr>
|
||||
<td><%= broadcast.project.name %></td>
|
||||
<td><%= broadcast.name %></td>
|
||||
<td class="text-right">
|
||||
<div class="btn-group">
|
||||
<%= button_tag "Manage", class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<%= link_to "View on Mux", "#{ENV['MUX_LIVE_STREAM_DASHBOARD_URL']}/#{broadcast.stream_uid}", class: "dropdown-item", target: "_blank" %>
|
||||
<%= link_to "Edit", [:edit, :admin, broadcast, locale: I18n.locale], class: "dropdown-item" %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -34,5 +34,25 @@
|
||||
<%= will_paginate @videos %>
|
||||
</div>
|
||||
<% end %>
|
||||
<hr>
|
||||
<%= card_field_set_tag "Broadcasts" do %>
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped tr-px-4 align-all-middle">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Project</th>
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="broadcasts">
|
||||
<%= render partial: "admin/accounts/broadcast", collection: @broadcasts %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="broadcasts_pagination">
|
||||
<%= will_paginate @broadcasts %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
14
app/views/admin/broadcasts/_form.html.erb
Normal file
14
app/views/admin/broadcasts/_form.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<%= errors_summary_for broadcast %>
|
||||
|
||||
<%= bootstrap_form_with model: model, local: true do |form| %>
|
||||
<%= form.text_field :stream_url_override %>
|
||||
<%= form.text_field :stream_key_override %>
|
||||
<%= form.text_area :director_mode_video_embed %>
|
||||
|
||||
<div class="row align-items-center text-center mt-4">
|
||||
<%= link_to t("shared.cancel"), [:admin, broadcast.project.account], class: "col-3 text-reset" %>
|
||||
<div class="col-9">
|
||||
<%= form.submit class: class_string("btn btn-block", ["btn-success", "btn-primary"] => broadcast.new_record?), data: { disable_with: t("shared.disable_with") } %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
6
app/views/admin/broadcasts/edit.html.erb
Normal file
6
app/views/admin/broadcasts/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<div class="card shadow-sm">
|
||||
<%= card_header text: t(".heading"), close_action_path: [:admin, @broadcast.project.account] %>
|
||||
<div class="card-body">
|
||||
<%= render "form", model: [:admin, @broadcast], broadcast: @broadcast %>
|
||||
</div>
|
||||
</div>
|
||||
6
app/views/broadcast_recordings/destroy.js.erb
Normal file
6
app/views/broadcast_recordings/destroy.js.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
var dom_id = "<%= dom_id(@recording) %>"
|
||||
$('[data-id="' + dom_id + '"]').remove();
|
||||
<% if @recordings.empty? %>
|
||||
$("#broadcast_recordings_nav").append('<p class="dropdown-item text-muted">Recordings will appear here</p>')
|
||||
<% end %>
|
||||
$("#broadcast_recordings").html("<%= j render(partial: 'broadcasts/broadcast_recordings', locals: { recordings: @recordings, broadcast: @broadcast }) %>");
|
||||
@@ -16,8 +16,8 @@
|
||||
<div class="btn-group">
|
||||
<%= button_tag t(".actions.manage"), class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<%= link_to fa_icon("link fw", text: "Copy Stream URL"), ENV['MUX_BROADCAST_SERVER_URL'], class: "dropdown-item", data: { behavior: "clipboard" } %>
|
||||
<%= link_to fa_icon("key fw", text: "Copy Stream Key"), broadcast.stream_key, class: "dropdown-item", data: { behavior: "clipboard" } %>
|
||||
<%= link_to fa_icon("link fw", text: "Copy Stream URL"), broadcast.stream_server_url, class: "dropdown-item", data: { behavior: "clipboard" } %>
|
||||
<%= link_to fa_icon("key fw", text: "Copy Stream Key"), broadcast.stream_server_key, class: "dropdown-item", data: { behavior: "clipboard" } %>
|
||||
<% if policy(broadcast).show? %>
|
||||
<%= link_to fa_icon("file-video-o fw", text: "View"), [broadcast.project, broadcast], class: "dropdown-item", target: '_blank' %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
<%= link_to broadcast_recording.download_file_name, "javascript:void(0);", class: "dropdown-item", data: { behavior: "play_recording", playback_url: broadcast_recording.playback_url } %>
|
||||
<%= link_to broadcast_recording.download_file_name, "javascript:void(0);", class: "dropdown-item", data: { behavior: "play_recording", playback_url: broadcast_recording.playback_url, id: dom_id(broadcast_recording) } %>
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
<p>Click below to download the recordings of the live stream.</p>
|
||||
<ul class="mt-2">
|
||||
<% recordings.each do |recording| %>
|
||||
<li><%= link_to(recording.download_file_name, recording.download_url, target: "_blank") %></li>
|
||||
<li>
|
||||
<%= link_to(recording.download_file_name, recording.download_url, target: "_blank") %>
|
||||
<% if (controller.class.module_parent.to_s != "Public" && policy(BroadcastRecording).destroy?) %>
|
||||
<%= link_to "Hide", [broadcast.project, broadcast, recording], class: "btn-sm btn-primary ml-1 text-decoration-none", remote: true, method: :delete, data: { confirm: t('.confirm_hide') } %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div id="recordings_pagination" class="row mt-5 justify-content-center">
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<% if broadcast.streamer_recording? && broadcast.active? %>
|
||||
<div id="broadcast_video" class="embed-responsive-item" data-video-type="stream"></div>
|
||||
<% elsif broadcast.director_mode_video_embed.present? && params[:director_mode] == "true" %>
|
||||
<div class="embed-responsive-item" data-video-type="stream">
|
||||
<%= raw broadcast.director_mode_video_embed %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div id="broadcast_video" class="embed-responsive-item" data-video-type="stream">
|
||||
<table class="w-100 h-100 bg-secondary">
|
||||
@@ -12,4 +16,4 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -39,6 +39,15 @@
|
||||
<%= link_to broadcast.name.titleize, broadcast.url, data: { behavior: "play_stream"}, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @broadcast.director_mode_video_embed.present? %>
|
||||
<h5 class="dropdown-header">Director Mode</h5>
|
||||
<% unless params[:director_mode] %>
|
||||
<%= link_to "Enable Director Mode", url_for(params.permit!.merge(director_mode: true)), class: "dropdown-item" %>
|
||||
<% else %>
|
||||
<%= link_to "Disable Director Mode", url_for(params.permit!.except(:director_mode)), class: "dropdown-item" %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
<h5 class="dropdown-header">Previous Sessions</h5>
|
||||
<div id="broadcast_recordings_nav">
|
||||
<% if @recordings.any? %>
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= location_release.name %>
|
||||
<%= contact_info(name: location_release.name, address: location_release.address) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= contact_info address: location_release.address %>
|
||||
<%= contact_info_for(location_release.contact_person) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= notes_preview location_release.notes.order_by_recent %>
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
<th data-behavior="all-selectable"><%= check_box_tag "location_release_ids[]", false, false %></th>
|
||||
<th><%= t '.table_headers.approved'%></th>
|
||||
<th></th>
|
||||
<th><%= t(".table_headers.name") %></th>
|
||||
<th><%= t(".table_headers.address") %>
|
||||
<th><%= t(".table_headers.location_info") %></th>
|
||||
<th><%= t(".table_headers.owner_info") %>
|
||||
<th><%= t(".table_headers.notes") %></th>
|
||||
<th><%= t(".table_headers.tags") %></th>
|
||||
<th><%= t(".table_headers.signed_at") %></th>
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
<td>
|
||||
<%= material_release.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= contact_info_for(material_release.contact_person) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= notes_preview material_release.notes.order_by_recent %>
|
||||
</td>
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
<th><%= t '.table_headers.approved'%></th>
|
||||
<th></th>
|
||||
<th><%= MaterialRelease.human_attribute_name(:name) %></th>
|
||||
<th><%= t(".table_headers.owner_info") %>
|
||||
<th><%= t(".table_headers.notes") %></th>
|
||||
<th><%= t(".table_headers.tags") %></th>
|
||||
<th><%= t(".table_headers.signed_at") %></th>
|
||||
|
||||
<th><%= t(".table_headers.signed_at") %></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
<div class="card-body">
|
||||
<%= errors_summary_for @release %>
|
||||
<%= bootstrap_form_with model: @release, method: :post, url: public_send("account_project_contract_template_#{@contract_template.release_type}_release_amendments_path"), local: true do |form| %>
|
||||
<%= card_field_set_tag t('.signed_contract_preview') do %>
|
||||
<embed class="embeded-contract-preview" type="application/pdf" src="<%= url_for([@release, :contracts, format: "pdf"]) %>" width="80%" height="1200" />
|
||||
<% end %>
|
||||
|
||||
<%= card_field_set_tag t(".amendment.heading") do %>
|
||||
<p><%= @contract_template.amendment_clause %></p>
|
||||
<% end %>
|
||||
|
||||
@@ -65,6 +65,7 @@ en:
|
||||
file_infos_count: No. Files
|
||||
name: Name
|
||||
notes: Notes
|
||||
owner_info: Owner Info
|
||||
signed_at: Date Signed
|
||||
tags: Tags
|
||||
new:
|
||||
@@ -111,6 +112,11 @@ en:
|
||||
application:
|
||||
header:
|
||||
sign_out: Sign Out
|
||||
broadcasts:
|
||||
edit:
|
||||
heading: Edit Broadcast
|
||||
update:
|
||||
notice: The broadcast has been updated
|
||||
task_requests:
|
||||
index:
|
||||
empty: Task requests will appear here
|
||||
@@ -218,6 +224,8 @@ en:
|
||||
broadcast:
|
||||
actions:
|
||||
manage: Manage
|
||||
broadcast_recordings:
|
||||
confirm_hide: Are you sure you want to hide this recording from everyone?
|
||||
create:
|
||||
notice: A live stream has been created
|
||||
destroy:
|
||||
@@ -819,6 +827,8 @@ en:
|
||||
location_releases:
|
||||
create:
|
||||
notice: The location release has been created
|
||||
csv:
|
||||
no_amendment_clause: No amendment clause
|
||||
destroy:
|
||||
alert: The location release has been deleted
|
||||
edit:
|
||||
@@ -841,11 +851,12 @@ en:
|
||||
search: Search
|
||||
empty: Location Releases will appear here
|
||||
table_headers:
|
||||
address: Address
|
||||
amendment_signed: Amendment
|
||||
amendment_signed_column: Amendment
|
||||
approved: Approved
|
||||
name: Location Name
|
||||
location_info: Location Info
|
||||
notes: Notes
|
||||
owner_info: Owner Info
|
||||
signed_at: Date Signed
|
||||
tags: Tags
|
||||
location_release:
|
||||
@@ -896,6 +907,7 @@ en:
|
||||
approved: Approved
|
||||
name: Name
|
||||
notes: Notes
|
||||
owner_info: Owner Info
|
||||
signed_at: Date Signed
|
||||
tags: Tags
|
||||
material_release:
|
||||
@@ -920,7 +932,6 @@ en:
|
||||
empty: Medical releases will appear here
|
||||
table_headers:
|
||||
approved: Approved
|
||||
approved?: Approved
|
||||
contact_info: Contact info
|
||||
name: Person name
|
||||
notes: Notes
|
||||
@@ -1138,6 +1149,7 @@ en:
|
||||
copy_url: Copy sign amendment URL
|
||||
signature:
|
||||
heading: Signature
|
||||
signed_contract_preview: Signed Contract Preview
|
||||
appearance_releases:
|
||||
create:
|
||||
notice: Your release has been signed. Thank you!
|
||||
|
||||
@@ -16,9 +16,11 @@ es:
|
||||
heading: Guardian Photo
|
||||
index:
|
||||
table_headers:
|
||||
approved: Appproved (ES)
|
||||
file_infos_count: No. Files (ES)
|
||||
name: Name (ES)
|
||||
notes: Notes (ES)
|
||||
owner_info: Owner Info (ES)
|
||||
signed_at: Date Signed (ES)
|
||||
tags: Tags (ES)
|
||||
activerecord:
|
||||
@@ -64,6 +66,7 @@ es:
|
||||
index:
|
||||
imported_appearance_release_missing_attachment: Person photo or contract missing for imported appearance release (ES)
|
||||
table_headers:
|
||||
approved: Approved (ES)
|
||||
contact_info: ""
|
||||
name: ""
|
||||
notes: ""
|
||||
@@ -402,6 +405,8 @@ es:
|
||||
update: Approve (ES)
|
||||
update: 'Actualizar %{model}'
|
||||
location_releases:
|
||||
csv:
|
||||
no_amendment_clause: No amendment clause (ES)
|
||||
form:
|
||||
photos:
|
||||
dropzone_label: Tap to take a photo of the Property (optional) (ES)
|
||||
@@ -409,6 +414,8 @@ es:
|
||||
table_headers:
|
||||
address: Address (ES)
|
||||
amendment_signed: Amendment (ES)
|
||||
amendment_signed_column: Amendment signed (ES)
|
||||
approved: Approved (ES)
|
||||
notes: Notes (ES)
|
||||
signed_at: Date Signed (ES)
|
||||
tags: Tags (ES)
|
||||
@@ -434,8 +441,10 @@ es:
|
||||
heading: Guardian Photo
|
||||
index:
|
||||
table_headers:
|
||||
approved: Approved (ES)
|
||||
name: Name (ES)
|
||||
notes: Notes (ES)
|
||||
owner_info: Owner Info
|
||||
signed_at: Date Signed (ES)
|
||||
tags: Tags (ES)
|
||||
medical_releases:
|
||||
@@ -444,7 +453,6 @@ es:
|
||||
index:
|
||||
table_headers:
|
||||
approved: Approved (ES)
|
||||
approved?: Approved (ES)
|
||||
contact_info: Contact info (ES)
|
||||
name: Person name (ES)
|
||||
notes: Notes (ES)
|
||||
@@ -458,6 +466,7 @@ es:
|
||||
misc_releases:
|
||||
index:
|
||||
table_headers:
|
||||
approved: Approved (ES)
|
||||
contact_info: Contact info (ES)
|
||||
name: Person name (ES)
|
||||
notes: Notes (ES)
|
||||
@@ -466,6 +475,7 @@ es:
|
||||
music_releases:
|
||||
index:
|
||||
table_headers:
|
||||
approved: Approved (ES)
|
||||
composers_count: No. Composers (ES)
|
||||
file_infos_count: No. Files (ES)
|
||||
name: Name (ES)
|
||||
@@ -504,6 +514,7 @@ es:
|
||||
copy_url: Copy sign amendment URL (ES)
|
||||
signature:
|
||||
heading: Signature (ES)
|
||||
signed_contract_preview: Signed Contract Preview (ES)
|
||||
appearance_releases:
|
||||
create:
|
||||
notice: La autorización está firmada. ¡Gracias!
|
||||
@@ -626,6 +637,7 @@ es:
|
||||
heading: Guardian Photo (ES)
|
||||
index:
|
||||
table_headers:
|
||||
approved: Approved (ES)
|
||||
email: Email (ES)
|
||||
name: Name (ES)
|
||||
notes: Notes (ES)
|
||||
|
||||
@@ -35,6 +35,7 @@ Rails.application.routes.draw do
|
||||
resource :masquerade, only: :create
|
||||
end
|
||||
resources :task_requests, only: [:index, :edit, :update, :show]
|
||||
resources :broadcasts, only: [:edit, :update]
|
||||
|
||||
root to: "accounts#index", as: :signed_in_root
|
||||
end
|
||||
@@ -100,6 +101,7 @@ Rails.application.routes.draw do
|
||||
delete :destroy_file
|
||||
end
|
||||
resource :zoom_meeting, only: [:show]
|
||||
resources :broadcast_recordings, only: :destroy
|
||||
end
|
||||
resources :directories, except: [:index] do
|
||||
member do
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddHiddenFieldToBroadcastRecordings < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :broadcast_recordings, :hidden, :boolean, default: false
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
class AddStreamAndKeyOverrideToBroadcasts < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :broadcasts, :stream_url_override, :string
|
||||
add_column :broadcasts, :stream_key_override, :string
|
||||
add_column :broadcasts, :youtube_uid, :string
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class RemoveYoutubeUidFromBroadcasts < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
remove_column :broadcasts, :youtube_uid, :string
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddDirectorModeVideoEmbedToBroadcasts < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :broadcasts, :director_mode_video_embed, :text
|
||||
end
|
||||
end
|
||||
@@ -9,20 +9,6 @@ SET xmloption = content;
|
||||
SET client_min_messages = warning;
|
||||
SET row_security = off;
|
||||
|
||||
--
|
||||
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||
|
||||
|
||||
--
|
||||
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
||||
|
||||
|
||||
--
|
||||
-- Name: fuzzystrmatch; Type: EXTENSION; Schema: -; Owner: -
|
||||
--
|
||||
@@ -536,7 +522,8 @@ CREATE TABLE public.broadcast_recordings (
|
||||
file_name character varying NOT NULL,
|
||||
created_at timestamp(6) without time zone NOT NULL,
|
||||
updated_at timestamp(6) without time zone NOT NULL,
|
||||
duration double precision
|
||||
duration double precision,
|
||||
hidden boolean DEFAULT false
|
||||
);
|
||||
|
||||
|
||||
@@ -576,7 +563,10 @@ CREATE TABLE public.broadcasts (
|
||||
token character varying,
|
||||
streamer_status integer DEFAULT 0,
|
||||
shoot_location_time_zone character varying DEFAULT 'UTC'::character varying,
|
||||
full_live_stream_playback_uid character varying
|
||||
full_live_stream_playback_uid character varying,
|
||||
stream_url_override character varying,
|
||||
stream_key_override character varying,
|
||||
director_mode_video_embed text
|
||||
);
|
||||
|
||||
|
||||
@@ -1475,6 +1465,7 @@ CREATE TABLE public.settings (
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.settings_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
@@ -1510,6 +1501,7 @@ CREATE TABLE public.taggings (
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.taggings_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
@@ -1540,6 +1532,7 @@ CREATE TABLE public.tags (
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.tags_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
@@ -3998,7 +3991,11 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20200720051634'),
|
||||
('20200720131309'),
|
||||
('20200721140821'),
|
||||
('20200724084722'),
|
||||
('20200725231419'),
|
||||
('20200727143209');
|
||||
('20200727143209'),
|
||||
('20200730050903'),
|
||||
('20200803145912'),
|
||||
('20200803150138');
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ RSpec.describe BroadcastsChannel, type: :channel do
|
||||
describe '#stream_recording_ready' do
|
||||
it 'broadcasts to the channel with the right data' do
|
||||
create_list(:broadcast_recording, 1, broadcast: broadcast)
|
||||
recordings = broadcast.broadcast_recordings.paginate(page: 1)
|
||||
recordings = broadcast.broadcast_recordings.visible.paginate(page: 1)
|
||||
flash_message = OpenStruct.new(notice: 'Hello world', alert: nil)
|
||||
flash_content = ApplicationController.render partial: 'application/flash', locals: { flash: flash_message }
|
||||
recordings_content = ApplicationController.render partial: 'broadcasts/broadcast_recordings', locals: { recordings: recordings, broadcast: broadcast }
|
||||
|
||||
@@ -116,6 +116,16 @@ RSpec.describe Admin::AccountsController, type: :controller do
|
||||
expect(response.body).to have_link("2", href: admin_account_path(current_user.primary_account, page: 2))
|
||||
end
|
||||
|
||||
it "paginates the broadcast list" do
|
||||
allow(MuxLiveStream).to receive(:new).and_return(double(id: "id", key: "key", playback_id: "playback_id"))
|
||||
project = create(:project, account: current_user.primary_account)
|
||||
create_list(:broadcast, 20, project: project )
|
||||
|
||||
get :show, params: { id: current_user.primary_account }
|
||||
|
||||
expect(response.body).to have_link("2", href: admin_account_path(current_user.primary_account, page: 2))
|
||||
end
|
||||
|
||||
it "filters the videos by a query param" do
|
||||
project = create(:project, account: current_user.primary_account)
|
||||
create(:video, project: project, name: "First video")
|
||||
|
||||
77
spec/controllers/admin/broadcasts_controller_spec.rb
Normal file
77
spec/controllers/admin/broadcasts_controller_spec.rb
Normal file
@@ -0,0 +1,77 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Admin::BroadcastsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let!(:current_user) { create(:user, :admin) }
|
||||
|
||||
before do
|
||||
sign_in(current_user)
|
||||
allow(MuxLiveStream).to receive(:new).and_return(double(id: "id", key: "key", playback_id: "playback_id"))
|
||||
end
|
||||
|
||||
describe "#edit" do
|
||||
let(:broadcast) { create(:broadcast) }
|
||||
|
||||
it "returns a successful response" do
|
||||
get :edit, params: { id: broadcast }
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
it "assigns broadcast" do
|
||||
get :edit, params: { id: broadcast }
|
||||
|
||||
expect(assigns(:broadcast)).to eq broadcast
|
||||
end
|
||||
end
|
||||
|
||||
describe "#update" do
|
||||
let(:broadcast) { create(:broadcast) }
|
||||
|
||||
it "redirects to broadcasts page" do
|
||||
patch :update, params: { id: broadcast, broadcast: broadcast_update_params }
|
||||
|
||||
expect(response).to be_redirect
|
||||
expect(response).to redirect_to [:admin, broadcast.project.account]
|
||||
end
|
||||
|
||||
it "sets a flash notice" do
|
||||
patch :update, params: { id: broadcast, broadcast: broadcast_update_params }
|
||||
|
||||
expect(flash.notice).to eq "The broadcast has been updated"
|
||||
end
|
||||
|
||||
it "updates the broadcast record" do
|
||||
patch :update, params: { id: broadcast, broadcast: broadcast_update_params }
|
||||
|
||||
expect(assigns(:broadcast)).to have_attributes(
|
||||
stream_url_override: "https://example.com/streams/abcd",
|
||||
stream_key_override: "abcdef",
|
||||
)
|
||||
end
|
||||
|
||||
context "when record cannot be saved" do
|
||||
before do
|
||||
allow_any_instance_of(Broadcast).to receive(:update).and_return(false)
|
||||
end
|
||||
|
||||
it "re-displays the form" do
|
||||
patch :update, params: { id: broadcast, broadcast: broadcast_update_params }
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(flash.notice).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def broadcast_update_params
|
||||
{
|
||||
stream_url_override: "https://example.com/streams/abcd",
|
||||
stream_key_override: "abcdef",
|
||||
director_mode_video_embed: "<iframe>Video player</iframe>",
|
||||
}
|
||||
end
|
||||
end
|
||||
30
spec/controllers/broadcast_recordings_controller_spec.rb
Normal file
30
spec/controllers/broadcast_recordings_controller_spec.rb
Normal file
@@ -0,0 +1,30 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe BroadcastRecordingsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { create(:user) }
|
||||
let(:account) { user.primary_account }
|
||||
let(:project) { create(:project, account: user.primary_account) }
|
||||
|
||||
before do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
describe "#destroy" do
|
||||
let(:broadcast) { create(:broadcast, project: project, name: "New Broadcast") }
|
||||
let(:recording) { create(:broadcast_recording, broadcast: broadcast) }
|
||||
|
||||
before do
|
||||
allow(MuxLiveStream).to receive(:new).and_return(double(id: "id", key: "key", playback_id: "playback_id"))
|
||||
end
|
||||
|
||||
it "hides the broadcast recording" do
|
||||
expect(recording.hidden).to be false
|
||||
|
||||
post :destroy, params: { project_id: project, broadcast_id: broadcast, id: recording }, xhr: true
|
||||
|
||||
expect(recording.reload.hidden).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -184,6 +184,35 @@ RSpec.describe BroadcastsController, type: :controller do
|
||||
expect(response.body).to have_selector(".dropdown-menu a.dropdown-item", text: recording.download_file_name)
|
||||
end
|
||||
end
|
||||
|
||||
context "when virtual director video embed is available" do
|
||||
let(:broadcast) { create(:broadcast, project: project, name: "Another Broadcast",
|
||||
director_mode_video_embed: "<iframe>video player</iframe>") }
|
||||
|
||||
it "renders the view dropdown with a director mode enable option" do
|
||||
get :show, params: { project_id: project, id: broadcast }
|
||||
|
||||
expect(response.body).to have_content "Switch View"
|
||||
expect(response.body).to have_selector(".dropdown-menu h5.dropdown-header", text: "Director Mode")
|
||||
expect(response.body).to have_selector(".dropdown-menu a.dropdown-item", text: "Enable Director Mode")
|
||||
end
|
||||
|
||||
context "when director mode is enabled" do
|
||||
it "shows the video embed" do
|
||||
get :show, params: { project_id: project, id: broadcast, director_mode: true }
|
||||
|
||||
expect(response.body).to have_selector("iframe", text: "video player")
|
||||
end
|
||||
|
||||
it "renders the view dropdown with a director mode disable option" do
|
||||
get :show, params: { project_id: project, id: broadcast, director_mode: true }
|
||||
|
||||
expect(response.body).to have_content "Switch View"
|
||||
expect(response.body).to have_selector(".dropdown-menu h5.dropdown-header", text: "Director Mode")
|
||||
expect(response.body).to have_selector(".dropdown-menu a.dropdown-item", text: "Disable Director Mode")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#update" do
|
||||
|
||||
@@ -4,6 +4,22 @@ FactoryBot.define do
|
||||
|
||||
name "Test Acquired Media Release"
|
||||
|
||||
trait :with_address do
|
||||
person_address_street1 "St1"
|
||||
person_address_street2 "St2"
|
||||
person_address_city "City"
|
||||
person_address_state "State"
|
||||
person_address_zip "123"
|
||||
person_address_country "US"
|
||||
end
|
||||
|
||||
trait :with_owner_info do
|
||||
person_first_name "Jane"
|
||||
person_last_name "Doe"
|
||||
person_phone "100-555-1001"
|
||||
person_email "owner@email.com"
|
||||
end
|
||||
|
||||
trait :native do
|
||||
signature do
|
||||
path = Rails.root.join("spec", "fixtures", "files", "signature.png")
|
||||
|
||||
@@ -3,6 +3,7 @@ FactoryBot.define do
|
||||
association :broadcast
|
||||
file_name "high.mp4"
|
||||
asset_uid "asset_uid"
|
||||
asset_playback_uid "asset_playback_uid"
|
||||
asset_playback_uid "asset_playback_uid"
|
||||
hidden { false }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,6 +16,17 @@ FactoryBot.define do
|
||||
streamer_status "idle"
|
||||
end
|
||||
|
||||
trait :with_overriden_stream do
|
||||
stream_uid "mux_stream"
|
||||
stream_key "mux_key"
|
||||
stream_playback_uid "mux_playback_id"
|
||||
full_live_stream_playback_uid "full_live_stream_playback_uid"
|
||||
status "created"
|
||||
streamer_status "idle"
|
||||
stream_url_override "overriden_stream_url"
|
||||
stream_key_override "overriden_stream_key"
|
||||
end
|
||||
|
||||
trait :with_files do
|
||||
files do
|
||||
[
|
||||
|
||||
@@ -4,10 +4,20 @@ FactoryBot.define do
|
||||
|
||||
name "Test Materials"
|
||||
|
||||
trait :with_address do
|
||||
person_address_street1 "St1"
|
||||
person_address_street2 "St2"
|
||||
person_address_city "City"
|
||||
person_address_state "State"
|
||||
person_address_zip "123"
|
||||
person_address_country "US"
|
||||
end
|
||||
|
||||
trait :native do
|
||||
person_first_name "Jane"
|
||||
person_last_name "Doe"
|
||||
person_phone "100-555-1001"
|
||||
person_email "owner@email.com"
|
||||
|
||||
signature do
|
||||
path = Rails.root.join("spec", "fixtures", "files", "signature.png")
|
||||
|
||||
@@ -165,6 +165,24 @@ feature "User managing acquired_media releases" do
|
||||
sign_in current_user
|
||||
end
|
||||
|
||||
scenario "index table shows owner info" do
|
||||
release = create(:acquired_media_release, :with_owner_info, :with_address, project: project)
|
||||
|
||||
visit project_acquired_media_releases_path(project)
|
||||
|
||||
expect(page).to have_content owner_info_table_header
|
||||
|
||||
expect(page).to have_content release.person_first_name
|
||||
expect(page).to have_content release.person_last_name
|
||||
expect(page).to have_content release.person_phone
|
||||
expect(page).to have_content release.person_email
|
||||
expect(page).to have_content release.person_address_street1
|
||||
expect(page).to have_content release.person_address_city
|
||||
expect(page).to have_content release.person_address_state
|
||||
expect(page).to have_content release.person_address_zip
|
||||
expect(page).to have_content release.person_address_country
|
||||
end
|
||||
|
||||
scenario "creating a release for an adult", js: true do
|
||||
visit new_project_acquired_media_release_path(project)
|
||||
|
||||
@@ -262,62 +280,63 @@ feature "User managing acquired_media releases" do
|
||||
end
|
||||
|
||||
scenario "creating, updating, destroying a release", js: true do
|
||||
release_data = {
|
||||
name: "Test Acquired Media Release",
|
||||
applicable_media: ApplicableMedium.last.label,
|
||||
territory: Territory.last.label,
|
||||
term: Term.last.label,
|
||||
restriction: Restriction.first.label,
|
||||
restriction_text: "Not available in China",
|
||||
}
|
||||
resize_window_to(1_000, 1_000) do
|
||||
release_data = {
|
||||
name: "Test Acquired Media Release",
|
||||
applicable_media: ApplicableMedium.last.label,
|
||||
territory: Territory.last.label,
|
||||
term: Term.last.label,
|
||||
restriction: Restriction.first.label,
|
||||
restriction_text: "Not available in China",
|
||||
}
|
||||
|
||||
sign_in current_user
|
||||
visit new_project_acquired_media_release_path(project)
|
||||
sign_in current_user
|
||||
visit new_project_acquired_media_release_path(project)
|
||||
|
||||
by "attaching only a contract" do
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
click_button create_release_button
|
||||
by "attaching only a contract" do
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
click_button create_release_button
|
||||
|
||||
expect(page).to have_invalid_field(acquired_media_name_field)
|
||||
end
|
||||
|
||||
by "attaching files" do
|
||||
drop_file Rails.root.join(file_fixture("video_file.mp4")), type: "file-info-dropzone"
|
||||
click_button create_release_button
|
||||
|
||||
expect(page).to have_invalid_field(acquired_media_name_field)
|
||||
end
|
||||
|
||||
by "filling out the remaining information" do
|
||||
fill_in_release_fields release_data
|
||||
click_button create_release_button
|
||||
|
||||
expect(page).to have_content(create_release_notice)
|
||||
expect(page).to have_content("1")
|
||||
|
||||
click_on "Manage"
|
||||
expect(page).to have_link("Download")
|
||||
end
|
||||
|
||||
it_also "updates an existing release" do
|
||||
click_link "Edit"
|
||||
|
||||
within ".dropzone" do
|
||||
expect(page).to have_filename("video_file.mp4")
|
||||
expect(page).to have_invalid_field(acquired_media_name_field)
|
||||
end
|
||||
|
||||
expect(page).to have_filled_in_data(release_data)
|
||||
by "attaching files" do
|
||||
drop_file Rails.root.join(file_fixture("video_file.mp4")), type: "file-info-dropzone"
|
||||
click_button create_release_button
|
||||
|
||||
fill_in_release_fields name: "New name"
|
||||
drop_file Rails.root.join(file_fixture("person_photo.png")), type: "file-info-dropzone"
|
||||
click_button update_release_button
|
||||
expect(page).to have_invalid_field(acquired_media_name_field)
|
||||
end
|
||||
|
||||
expect(page).to have_content(update_release_notice)
|
||||
expect(page).to have_content("New name")
|
||||
expect(page).to have_content("2")
|
||||
end
|
||||
by "filling out the remaining information" do
|
||||
fill_in_release_fields release_data
|
||||
click_button create_release_button
|
||||
|
||||
it_also "deletes an existing release" do
|
||||
expect(page).to have_content(create_release_notice)
|
||||
expect(page).to have_content("1")
|
||||
|
||||
click_on "Manage"
|
||||
expect(page).to have_link("Download")
|
||||
end
|
||||
|
||||
it_also "updates an existing release" do
|
||||
click_link "Edit"
|
||||
|
||||
within ".dropzone" do
|
||||
expect(page).to have_filename("video_file.mp4")
|
||||
end
|
||||
|
||||
expect(page).to have_filled_in_data(release_data)
|
||||
|
||||
fill_in_release_fields name: "New name"
|
||||
drop_file Rails.root.join(file_fixture("person_photo.png")), type: "file-info-dropzone"
|
||||
click_button update_release_button
|
||||
|
||||
expect(page).to have_content(update_release_notice)
|
||||
expect(page).to have_content("New name")
|
||||
expect(page).to have_content("2")
|
||||
end
|
||||
|
||||
it_also "deletes an existing release" do
|
||||
click_button "Manage"
|
||||
accept_alert do
|
||||
click_link "Delete"
|
||||
@@ -325,6 +344,7 @@ feature "User managing acquired_media releases" do
|
||||
|
||||
expect(page).not_to have_content("New name")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF for an adult" do
|
||||
@@ -836,4 +856,8 @@ feature "User managing acquired_media releases" do
|
||||
def successful_import_message
|
||||
t 'acquired_media_releases.create.notice'
|
||||
end
|
||||
|
||||
def owner_info_table_header
|
||||
t 'acquired_media_releases.index.table_headers.owner_info'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'User managing broadcasts' do
|
||||
|
||||
let(:current_user) { create(:user, :manager) }
|
||||
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
|
||||
|
||||
@@ -50,7 +51,7 @@ feature 'User managing broadcasts' do
|
||||
|
||||
scenario 'visit show page of broadcast', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "asset_uid_1")
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
@@ -204,6 +205,24 @@ feature 'User managing broadcasts' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'project manager can hide broadcast recordings', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "another_asset_uid")
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
click_on 'Previous Sessions'
|
||||
expect(page).to have_content(recording.download_file_name)
|
||||
expect(page).to have_content('Hide')
|
||||
|
||||
accept_alert do
|
||||
click_link "Hide"
|
||||
end
|
||||
|
||||
expect(page).not_to have_content(recording.download_file_name)
|
||||
expect(page).to have_content("Recording of the live stream will appear here")
|
||||
end
|
||||
|
||||
context 'When the user is associate' do
|
||||
let(:current_user) { create(:user, :associate) }
|
||||
|
||||
@@ -221,6 +240,17 @@ feature 'User managing broadcasts' do
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 0
|
||||
end
|
||||
|
||||
scenario 'associate does not see hide button in front of recording' do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "another_asset_uid")
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
click_on 'Previous Sessions'
|
||||
expect(page).to have_content(recording.download_file_name)
|
||||
expect(page).not_to have_content('Hide')
|
||||
end
|
||||
end
|
||||
|
||||
context 'When the user is account manager' do
|
||||
@@ -247,6 +277,24 @@ feature 'User managing broadcasts' do
|
||||
expect(page).to have_content delete_file_button, count: 2
|
||||
expect(Broadcast.find(broadcast.id).files.count).to eq 2
|
||||
end
|
||||
|
||||
scenario 'account manager can hide broadcast recordings', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "another_asset_uid")
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
click_on 'Previous Sessions'
|
||||
expect(page).to have_content(recording.download_file_name)
|
||||
expect(page).to have_content('Hide')
|
||||
|
||||
accept_alert do
|
||||
click_link "Hide"
|
||||
end
|
||||
|
||||
expect(page).not_to have_content(recording.download_file_name)
|
||||
expect(page).to have_content("Recording of the live stream will appear here")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -251,6 +251,9 @@ feature "User managing location releases" do
|
||||
new_window = window_opened_by { click_link sign_amendment_link }
|
||||
within_window new_window do
|
||||
expect(page).to have_content amendments_heading
|
||||
expect(page).to have_content signed_contract_preview.upcase
|
||||
|
||||
expect(page).to have_selector 'embed'
|
||||
|
||||
fill_in amendment_signer_name_field, with: 'Big Signer'
|
||||
draw_signature file_fixture("signature.png"), amendment_signature_field
|
||||
@@ -690,6 +693,10 @@ feature "User managing location releases" do
|
||||
t 'public.amendments.new.amendment.heading'
|
||||
end
|
||||
|
||||
def signed_contract_preview
|
||||
t 'public.amendments.new.signed_contract_preview'
|
||||
end
|
||||
|
||||
def amendment_signer_name_field
|
||||
'location_release[amendment_signer_name]'
|
||||
end
|
||||
@@ -741,8 +748,8 @@ feature "User managing location releases" do
|
||||
def table_headers
|
||||
[
|
||||
t('location_releases.index.table_headers.approved'),
|
||||
t('location_releases.index.table_headers.name'),
|
||||
t('location_releases.index.table_headers.address'),
|
||||
t('location_releases.index.table_headers.location_info'),
|
||||
t('location_releases.index.table_headers.owner_info'),
|
||||
t('location_releases.index.table_headers.notes'),
|
||||
t('location_releases.index.table_headers.tags'),
|
||||
t('location_releases.index.table_headers.signed_at'),
|
||||
|
||||
@@ -185,6 +185,24 @@ feature "User managing material releases" do
|
||||
sign_in current_user
|
||||
end
|
||||
|
||||
scenario "index table shows owner info" do
|
||||
release = create(:material_release, :native, :with_address, project: project)
|
||||
|
||||
visit project_material_releases_path(project)
|
||||
|
||||
expect(page).to have_content owner_info_table_header
|
||||
|
||||
expect(page).to have_content release.person_first_name
|
||||
expect(page).to have_content release.person_last_name
|
||||
expect(page).to have_content release.person_phone
|
||||
expect(page).to have_content release.person_email
|
||||
expect(page).to have_content release.person_address_street1
|
||||
expect(page).to have_content release.person_address_city
|
||||
expect(page).to have_content release.person_address_state
|
||||
expect(page).to have_content release.person_address_zip
|
||||
expect(page).to have_content release.person_address_country
|
||||
end
|
||||
|
||||
scenario "creating a release for and adult", js: true do
|
||||
visit new_project_material_release_path(project)
|
||||
|
||||
@@ -813,4 +831,8 @@ feature "User managing material releases" do
|
||||
def signature_field
|
||||
'material_release_signature_base64'
|
||||
end
|
||||
|
||||
def owner_info_table_header
|
||||
t 'material_releases.index.table_headers.owner_info'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,6 +25,31 @@ describe GenerateContractsZipJob do
|
||||
end
|
||||
|
||||
describe ".perform_now" do
|
||||
shared_examples "generates ZIP containig CSV file with all releases data" do
|
||||
it "generates ZIP containing CSV file with all releases data for all release types" do
|
||||
lowercase_plural = subject.constantize.model_name.plural
|
||||
GenerateContractsZipJob.perform_now(project, download, subject, project.public_send(lowercase_plural).ids)
|
||||
|
||||
generated_zip = download.file.blob.download
|
||||
csv_file_name = "#{project.name.parameterize}_#{lowercase_plural.gsub('_', '-')}.csv"
|
||||
Zip::InputStream.open(StringIO.new(generated_zip)) do |io|
|
||||
while entry = io.get_next_entry
|
||||
next unless entry.name == csv_file_name
|
||||
|
||||
csv_file = entry.get_input_stream.read
|
||||
|
||||
release_class = Object.const_get subject
|
||||
release_headers = release_class.csv_headers
|
||||
|
||||
release_headers.each do |header|
|
||||
expect(csv_file).to match header
|
||||
expect(csv_file).not_to match translation_missing
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "updates a download record and creates attachment for it" do
|
||||
GenerateContractsZipJob.perform_now(project, download, "AppearanceRelease", project.appearance_releases.ids)
|
||||
|
||||
@@ -35,36 +60,60 @@ describe GenerateContractsZipJob do
|
||||
expect(download.file).to be_attached
|
||||
end
|
||||
|
||||
it "generates ZIP containing CSV file with all releases data for all release types" do
|
||||
release_types = %w[AcquiredMediaRelease AppearanceRelease LocationRelease MaterialRelease MedicalRelease MiscRelease MusicRelease TalentRelease]
|
||||
create_releases_for_all_types
|
||||
context "generates ZIP for acquired media releases" do
|
||||
let(:release) { create(:acquired_media_release_with_contract_template, :native, project: project) }
|
||||
subject { 'AcquiredMediaRelease' }
|
||||
|
||||
release_types.each do |type|
|
||||
lowercase_plural = type.constantize.model_name.plural
|
||||
GenerateContractsZipJob.perform_now(project, download, type, project.public_send(lowercase_plural).ids)
|
||||
it_behaves_like "generates ZIP containig CSV file with all releases data"
|
||||
end
|
||||
|
||||
generated_zip = download.file.blob.download
|
||||
csv_file_name = "#{project.name.parameterize}_#{lowercase_plural.gsub('_', '-')}.csv"
|
||||
Zip::InputStream.open(StringIO.new(generated_zip)) do |io|
|
||||
while entry = io.get_next_entry
|
||||
next unless entry.name == csv_file_name
|
||||
context "generates ZIP for appearance releases" do
|
||||
let(:release) { create(:appearance_release_with_contract_template, :native, project: project, person_name: "John Doe") }
|
||||
subject { 'AppearanceRelease' }
|
||||
|
||||
csv_file = entry.get_input_stream.read
|
||||
it_behaves_like "generates ZIP containig CSV file with all releases data"
|
||||
end
|
||||
|
||||
release_class = Object.const_get type
|
||||
release_headers = release_class.csv_headers
|
||||
context "generates ZIP for location releases" do
|
||||
let(:release) { create(:location_release_with_contract_template, :native, project: project) }
|
||||
subject { 'LocationRelease' }
|
||||
|
||||
release_headers.each do |header|
|
||||
expect(csv_file).to match header
|
||||
end
|
||||
end
|
||||
it_behaves_like "generates ZIP containig CSV file with all releases data"
|
||||
end
|
||||
|
||||
dummy_zip_file_name = "#{project.name.parameterize}_#{lowercase_plural.gsub('_', '-')}.zip"
|
||||
if File.exist?(file_fixture(dummy_zip_file_name))
|
||||
File.delete(file_fixture(dummy_zip_file_name))
|
||||
end
|
||||
end
|
||||
end
|
||||
context "generates ZIP for material releases" do
|
||||
let(:release) { create(:material_release_with_contract_template, :native, project: project) }
|
||||
subject { 'MaterialRelease' }
|
||||
|
||||
it_behaves_like "generates ZIP containig CSV file with all releases data"
|
||||
end
|
||||
|
||||
context "generates ZIP for medical releases" do
|
||||
let(:release) { create(:medical_release_with_contract_template, :native, project: project) }
|
||||
subject { 'MedicalRelease' }
|
||||
|
||||
it_behaves_like "generates ZIP containig CSV file with all releases data"
|
||||
end
|
||||
|
||||
context "generates ZIP for misc releases" do
|
||||
let(:release) { create(:misc_release_with_contract_template, :native, project: project) }
|
||||
subject { 'MiscRelease' }
|
||||
|
||||
it_behaves_like "generates ZIP containig CSV file with all releases data"
|
||||
end
|
||||
|
||||
context "generates ZIP for music releases" do
|
||||
let(:release) { create(:music_release_with_contract_template, project: project) }
|
||||
subject { 'MusicRelease' }
|
||||
|
||||
it_behaves_like "generates ZIP containig CSV file with all releases data"
|
||||
end
|
||||
|
||||
context "generates ZIP for talent releases" do
|
||||
let(:release) { create(:talent_release_with_contract_template, :native, project: project) }
|
||||
subject { 'TalentRelease' }
|
||||
|
||||
it_behaves_like "generates ZIP containig CSV file with all releases data"
|
||||
end
|
||||
|
||||
context "When there are errors" do
|
||||
@@ -88,21 +137,16 @@ describe GenerateContractsZipJob do
|
||||
# Delete the file created in fixture.
|
||||
# Or the tests will fail on next run due to already existing files in existing zip.
|
||||
path = Rails.root.join("spec", "fixtures", "files")
|
||||
if File.exists? "#{path}/my-video-project_appearance-releases.zip"
|
||||
File.delete("#{path}/my-video-project_appearance-releases.zip")
|
||||
releases = %w[acquired-media appearance location material medical misc music talent]
|
||||
releases.each do |release|
|
||||
if File.exists? "#{path}/my-video-project_#{release}-releases.zip"
|
||||
File.delete("#{path}/my-video-project_#{release}-releases.zip")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_releases_for_all_types
|
||||
create(:acquired_media_release_with_contract_template, :native, project: project)
|
||||
create(:appearance_release_with_contract_template, :native, project: project, person_name: "John Doe")
|
||||
create(:location_release_with_contract_template, :native, project: project)
|
||||
create(:material_release_with_contract_template, :native, project: project)
|
||||
create(:medical_release_with_contract_template, :native, project: project)
|
||||
create(:misc_release_with_contract_template, :native, project: project)
|
||||
create(:music_release_with_contract_template, project: project)
|
||||
create(:talent_release_with_contract_template, :native, project: project)
|
||||
def translation_missing
|
||||
/translation missing/
|
||||
end
|
||||
end
|
||||
|
||||
@@ -49,6 +49,36 @@ RSpec.describe Broadcast, type: :model do
|
||||
expect(broadcast).to have_received(:destroy_mux_live_stream)
|
||||
end
|
||||
end
|
||||
|
||||
context "#stream_server_url" do
|
||||
it "returns mux stream url when overriden stream url is absent" do
|
||||
ENV["MUX_BROADCAST_SERVER_URL"] = "mux_stream"
|
||||
broadcast = create(:broadcast, :with_stream, skip_create_callback: true, name: "My Broadcast")
|
||||
|
||||
expect(broadcast.stream_server_url).to eq("mux_stream")
|
||||
end
|
||||
|
||||
it "returns overriden stream url when it is present" do
|
||||
ENV["MUX_BROADCAST_SERVER_URL"] = "mux_stream"
|
||||
broadcast = create(:broadcast, :with_overriden_stream, skip_create_callback: true, name: "My Broadcast")
|
||||
|
||||
expect(broadcast.stream_server_url).to eq("overriden_stream_url")
|
||||
end
|
||||
end
|
||||
|
||||
context "#stream_server_key" do
|
||||
it "returns mux stream key when overriden stream key is absent" do
|
||||
broadcast = create(:broadcast, :with_stream, skip_create_callback: true, name: "My Broadcast")
|
||||
|
||||
expect(broadcast.stream_server_key).to eq("mux_key")
|
||||
end
|
||||
|
||||
it "returns overriden stream key when it is present" do
|
||||
broadcast = create(:broadcast, :with_overriden_stream, skip_create_callback: true, name: "My Broadcast")
|
||||
|
||||
expect(broadcast.stream_server_key).to eq("overriden_stream_key")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#zoom_meeting_url" do
|
||||
|
||||
Reference in New Issue
Block a user