Compare commits
25 Commits
prevent-su
...
match-impo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa4660d819 | ||
|
|
2238338710 | ||
|
|
3650d6022c | ||
|
|
16d4d7511c | ||
|
|
c83e6cae0e | ||
|
|
fbd07a6ea6 | ||
|
|
badc3786dd | ||
|
|
47b68e86e6 | ||
|
|
f6e6d5d049 | ||
|
|
eeec214cc8 | ||
|
|
dc7f50b932 | ||
|
|
1d1df4a1da | ||
|
|
dbda554cd7 | ||
|
|
62019bcc37 | ||
|
|
3307f0ebe8 | ||
|
|
29d3fa258a | ||
|
|
9a96bf708d | ||
|
|
ffc93b470b | ||
|
|
2a6305b417 | ||
|
|
ed312c186f | ||
|
|
c903a2dcde | ||
|
|
f2283782e8 | ||
|
|
21e8933471 | ||
|
|
94c0dc3732 | ||
|
|
dafef462b2 |
@@ -8,16 +8,11 @@ $(document).on "turbolinks:load", ->
|
|||||||
# Called when the subscription has been terminated by the server
|
# Called when the subscription has been terminated by the server
|
||||||
|
|
||||||
received: (data) ->
|
received: (data) ->
|
||||||
|
return unless document.querySelector("meta[name=broadcast-token][content='#{broadcastToken}']")
|
||||||
switch data.event
|
switch data.event
|
||||||
when "broadcast_stream_update"
|
when "broadcast_stream_update" then @refreshBroadcastVideo(data)
|
||||||
return unless document.querySelector("meta[name=broadcast-token][current=true][content='#{broadcastToken}']")
|
when "stream_recording_ready" then @showBroadcastRecordings(data)
|
||||||
@refreshBroadcastVideo(data)
|
when "file_upload_update" then @refreshBroadcastFilesTab(data)
|
||||||
when "stream_recording_ready"
|
|
||||||
return unless document.querySelector("meta[name=broadcast-token][current=true][content='#{broadcastToken}']")
|
|
||||||
@showBroadcastRecordings(data)
|
|
||||||
when "file_upload_update"
|
|
||||||
return unless document.querySelector("meta[name=broadcast-token][content='#{broadcastToken}']")
|
|
||||||
@refreshBroadcastFilesTab(data)
|
|
||||||
|
|
||||||
refreshBroadcastVideo: (data) ->
|
refreshBroadcastVideo: (data) ->
|
||||||
$("#broadcast_updates").html data.status_content
|
$("#broadcast_updates").html data.status_content
|
||||||
|
|||||||
@@ -3,25 +3,15 @@
|
|||||||
class Api::DirectUploadsController < Api::ApiController
|
class Api::DirectUploadsController < Api::ApiController
|
||||||
include ActiveStorage::SetCurrent
|
include ActiveStorage::SetCurrent
|
||||||
|
|
||||||
deserializable_resource :direct_upload, only: [:create]
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
blob = ActiveStorage::Blob.create_before_direct_upload!(blob_params)
|
blob = ActiveStorage::Blob.create_before_direct_upload!(blob_args)
|
||||||
render jsonapi: DirectUpload.new(blob)
|
render jsonapi: DirectUpload.new(blob)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def blob_params
|
def blob_args
|
||||||
params.
|
params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, :metadata).to_h.symbolize_keys
|
||||||
require(:direct_upload).
|
|
||||||
permit(:type, :filename, :byte_size, :checksum, :content_type, :metadata).
|
|
||||||
except(:type).
|
|
||||||
to_h.symbolize_keys
|
|
||||||
end
|
|
||||||
|
|
||||||
class DeserializableDirectUpload < JSONAPI::Deserializable::Resource
|
|
||||||
attributes :filename, :byte_size, :checksum, :content_type, :metadata
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class SerializableDirectUpload < JSONAPI::Serializable::Resource
|
class SerializableDirectUpload < JSONAPI::Serializable::Resource
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class HeadshotCollection
|
|||||||
collection_uid: collection_uid.to_s,
|
collection_uid: collection_uid.to_s,
|
||||||
bucket_name: aws_bucket_name,
|
bucket_name: aws_bucket_name,
|
||||||
ids_to_images: map_ids_to_images,
|
ids_to_images: map_ids_to_images,
|
||||||
}.reject { |k, v| v.blank? && k != :ids_to_images }
|
}.reject { |_, v| v.blank? }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<%= bootstrap_form_for model, layout: :inline, remote: true do |form| %>
|
<%= bootstrap_form_for model, layout: :inline, remote: true do |form| %>
|
||||||
<%= form.file_field :files, direct_upload: true, multiple: true, accept: "*", hide_label: true, required: true, wrapper_class: "w-65 mr-2", id: "broadcast_files_#{token}" %>
|
<%= form.file_field :files, direct_upload: true, multiple: true, accept: "*", hide_label: true, wrapper_class: "w-65 mr-2", id: "broadcast_files_#{token}" %>
|
||||||
<%= form.button fa_icon("upload", text: "Add File"), class: "btn btn-primary", type: :submit, data: { disable_with: fa_icon("spinner", text: "Adding File") } %>
|
<%= form.button fa_icon("upload", text: "Add File"), class: "btn btn-primary", type: :submit, data: { disable_with: fa_icon("spinner", text: "Adding File") } %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
<meta name="project-id" content="<%= @project.id %>">
|
<meta name="project-id" content="<%= @project.id %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @broadcast %>
|
<% if @broadcast %>
|
||||||
<meta name="broadcast-token" current="true" content="<%= @broadcast.token %>">
|
<meta name="broadcast-token" content="<%= @broadcast.token %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
<% # Subscribe to Action Cable for every broadcast including those in multi-view %>
|
<% # Subscribe to Action Cable for every broadcast including those in multi-view %>
|
||||||
<% @multi_view_broadcasts.each do |multi_view_broadcast| %>
|
<% @multi_view_broadcasts.each do |multi_view_broadcast| %>
|
||||||
<% if multi_view_broadcast.token != @broadcast.token %>
|
<% if multi_view_broadcast.token != @broadcast.token %>
|
||||||
<meta name="broadcast-token" current="false" content="<%= multi_view_broadcast.token %>">
|
<meta name="broadcast-token" content="<%= multi_view_broadcast.token %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<%= bootstrap_form_for model, url: broadcast_url(token: token), layout: :inline, remote: true do |form| %>
|
<%= bootstrap_form_for model, url: broadcast_url(token: token), layout: :inline, remote: true do |form| %>
|
||||||
<%= form.file_field :files, direct_upload: true, multiple: true, accept: "*", hide_label: true, required: true, wrapper_class: "w-65 mr-2", id: "broadcast_files_#{token}" %>
|
<%= form.file_field :files, direct_upload: true, multiple: true, accept: "*", hide_label: true, wrapper_class: "w-65 mr-2", id: "broadcast_files_#{token}" %>
|
||||||
<%= form.button fa_icon("upload", text: "Add File"), class: "btn btn-primary", type: :submit, data: { disable_with: fa_icon("spinner", text: "Adding File") } %>
|
<%= form.button fa_icon("upload", text: "Add File"), class: "btn btn-primary", type: :submit, data: { disable_with: fa_icon("spinner", text: "Adding File") } %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -10,7 +10,7 @@ RSpec.describe Api::DirectUploadsController, type: :controller do
|
|||||||
|
|
||||||
describe '#create' do
|
describe '#create' do
|
||||||
it 'returns data for a direct upload' do
|
it 'returns data for a direct upload' do
|
||||||
post :create, params: { direct_upload: direct_upload_params }
|
post :create, params: { blob: blob_params }
|
||||||
|
|
||||||
expect(response).to be_successful
|
expect(response).to be_successful
|
||||||
expect(response_body_data_attributes).to include('id', 'key', 'signed_id', 'url', 'headers')
|
expect(response_body_data_attributes).to include('id', 'key', 'signed_id', 'url', 'headers')
|
||||||
@@ -19,7 +19,7 @@ RSpec.describe Api::DirectUploadsController, type: :controller do
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def direct_upload_params
|
def blob_params
|
||||||
file = file_fixture("video_file.mp4")
|
file = file_fixture("video_file.mp4")
|
||||||
checksum = Digest::MD5.base64digest(StringIO.new(file.read).to_s)
|
checksum = Digest::MD5.base64digest(StringIO.new(file.read).to_s)
|
||||||
|
|
||||||
|
|||||||
@@ -40,12 +40,12 @@ feature "User managing broadcasts" do
|
|||||||
scenario "visit show page of broadcast", js: true do
|
scenario "visit show page of broadcast", js: true do
|
||||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||||
recording = create(:broadcast_recording, broadcast: broadcast)
|
recording = create(:broadcast_recording, broadcast: broadcast)
|
||||||
|
|
||||||
visit project_broadcast_path(project, broadcast)
|
visit project_broadcast_path(project, broadcast)
|
||||||
|
|
||||||
expect(page).to have_content("Live stream is waiting to begin.")
|
expect(page).to have_content("Live stream is waiting to begin.")
|
||||||
expect(page).to have_content("Copy URL")
|
expect(page).to have_content("Copy URL")
|
||||||
|
|
||||||
within "#files" do
|
within "#files" do
|
||||||
expect(page).to have_content("contract.pdf")
|
expect(page).to have_content("contract.pdf")
|
||||||
end
|
end
|
||||||
@@ -54,17 +54,6 @@ feature "User managing broadcasts" do
|
|||||||
expect(page).to have_content(recording.download_file_name)
|
expect(page).to have_content(recording.download_file_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "form will not submit if user clicks Add files without selected files", js: true do
|
|
||||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
|
||||||
|
|
||||||
visit project_broadcast_path(project, broadcast)
|
|
||||||
|
|
||||||
expect(page).to have_content("Live stream is waiting to begin.")
|
|
||||||
expect(page).to have_content add_file_button
|
|
||||||
|
|
||||||
click_on add_file_button
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "visit multi-view broadcast page", js: true do
|
scenario "visit multi-view broadcast page", js: true do
|
||||||
broadcast_one = create(:broadcast, :with_stream, :with_files, name: "Broadcast 1", project: project)
|
broadcast_one = create(:broadcast, :with_stream, :with_files, name: "Broadcast 1", project: project)
|
||||||
broadcast_two = create(:broadcast, :with_stream, :with_files, name: "Broadcast 2", project: project)
|
broadcast_two = create(:broadcast, :with_stream, :with_files, name: "Broadcast 2", project: project)
|
||||||
@@ -91,13 +80,8 @@ feature "User managing broadcasts" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def add_file_button
|
|
||||||
'Add File'
|
|
||||||
end
|
|
||||||
|
|
||||||
def broadcast_name_field
|
def broadcast_name_field
|
||||||
"broadcast[name]"
|
"broadcast[name]"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -97,18 +97,6 @@ describe HeadshotCollection do
|
|||||||
expect(hash.keys).not_to include(:collection_uid)
|
expect(hash.keys).not_to include(:collection_uid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when there are no releasables" do
|
|
||||||
it "includes a blank hash value for the ids_to_images key" do
|
|
||||||
releases = []
|
|
||||||
collection = HeadshotCollection.new(nil, releases)
|
|
||||||
|
|
||||||
hash = collection.to_hash
|
|
||||||
|
|
||||||
expect(hash.keys).to include(:ids_to_images)
|
|
||||||
expect(hash[:ids_to_images]).to eq(Hash.new)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
Reference in New Issue
Block a user