Compare commits

..

25 Commits

Author SHA1 Message Date
bilal
fa4660d819 rebase master 2020-06-16 17:24:40 +02:00
bilal
2238338710 fix MR comments 2020-06-16 17:23:28 +02:00
bilal
3650d6022c set AWS_BUCKET just in one spec file 2020-06-16 17:23:28 +02:00
Senad Uka
16d4d7511c Rebased match 2020-06-16 17:23:28 +02:00
bilal
c83e6cae0e delete unused files 2020-06-16 17:22:53 +02:00
bilal
fbd07a6ea6 remove old specs 2020-06-16 17:22:53 +02:00
bilal
badc3786dd update matching features specs 2020-06-16 17:22:53 +02:00
bilal
47b68e86e6 skipp failing test 2020-06-16 17:22:53 +02:00
bilal
f6e6d5d049 add job spec 2020-06-16 17:22:53 +02:00
bilal
eeec214cc8 add AWS_BUCKET env variable for tests 2020-06-16 17:22:53 +02:00
bilal
dc7f50b932 refactor matching job 2020-06-16 17:22:53 +02:00
bilal
1d1df4a1da add appearance_release_imports factory 2020-06-16 17:22:53 +02:00
bilal
dbda554cd7 add job specs 2020-06-16 17:22:53 +02:00
bilal
62019bcc37 update features specs 2020-06-16 17:22:53 +02:00
bilal
3307f0ebe8 update specs 2020-06-16 17:22:53 +02:00
bilal
29d3fa258a add fixture files 2020-06-16 17:22:53 +02:00
bilal
9a96bf708d update spec 2020-06-16 17:22:53 +02:00
bilal
ffc93b470b increase QrCode size; remove serial number from blank contract 2020-06-16 17:22:53 +02:00
bilal
2a6305b417 update feature specs 2020-06-16 17:22:53 +02:00
bilal
ed312c186f remove commented code 2020-06-16 17:22:53 +02:00
bilal
c903a2dcde use attachment key for BrayniacAI API payload 2020-06-16 17:22:53 +02:00
bilal
f2283782e8 send attachment keys using ActiveResource 2020-06-16 17:22:53 +02:00
bilal
21e8933471 add QrMatching to the BrayniacAI lib 2020-06-16 17:22:53 +02:00
bilal
94c0dc3732 Handle QrMatching response - mock 2020-06-16 17:22:53 +02:00
Senad Uka
dafef462b2 Sync of the branch 2020-06-16 17:22:53 +02:00
10 changed files with 14 additions and 75 deletions

View File

@@ -8,16 +8,11 @@ $(document).on "turbolinks:load", ->
# Called when the subscription has been terminated by the server
received: (data) ->
return unless document.querySelector("meta[name=broadcast-token][content='#{broadcastToken}']")
switch data.event
when "broadcast_stream_update"
return unless document.querySelector("meta[name=broadcast-token][current=true][content='#{broadcastToken}']")
@refreshBroadcastVideo(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)
when "broadcast_stream_update" then @refreshBroadcastVideo(data)
when "stream_recording_ready" then @showBroadcastRecordings(data)
when "file_upload_update" then @refreshBroadcastFilesTab(data)
refreshBroadcastVideo: (data) ->
$("#broadcast_updates").html data.status_content

View File

@@ -3,25 +3,15 @@
class Api::DirectUploadsController < Api::ApiController
include ActiveStorage::SetCurrent
deserializable_resource :direct_upload, only: [: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)
end
private
def blob_params
params.
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
def blob_args
params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, :metadata).to_h.symbolize_keys
end
class SerializableDirectUpload < JSONAPI::Serializable::Resource

View File

@@ -11,9 +11,7 @@ class ReleaseTemplateImportsController < ApplicationController
templates = []
filtered_contract_templates.each do |contract_template|
next if contract_template.duplicated? ||
contract_template.archived? ||
contract_template.project == @project
next if contract_template.duplicated? || contract_template.project == @project
already_imported = contract_template.duplicates.non_archived.pluck(:project_id).include?(@project.id)
templates << OpenStruct.new(template: contract_template, already_imported?: already_imported)

View File

@@ -51,10 +51,6 @@ class ContractTemplate < ApplicationRecord
parent.present?
end
def archived?
archived_at.present?
end
def archive
update(archived_at: Time.zone.now)
end

View File

@@ -23,7 +23,7 @@ class HeadshotCollection
collection_uid: collection_uid.to_s,
bucket_name: aws_bucket_name,
ids_to_images: map_ids_to_images,
}.reject { |k, v| v.blank? && k != :ids_to_images }
}.reject { |_, v| v.blank? }
end
private

View File

@@ -3,12 +3,12 @@
<meta name="project-id" content="<%= @project.id %>">
<% end %>
<% if @broadcast %>
<meta name="broadcast-token" current="true" content="<%= @broadcast.token %>">
<meta name="broadcast-token" content="<%= @broadcast.token %>">
<% end %>
<% # Subscribe to Action Cable for every broadcast including those in multi-view %>
<% @multi_view_broadcasts.each do |multi_view_broadcast| %>
<% 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 %>

View File

@@ -10,7 +10,7 @@ RSpec.describe Api::DirectUploadsController, type: :controller do
describe '#create' 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_body_data_attributes).to include('id', 'key', 'signed_id', 'url', 'headers')
@@ -19,7 +19,7 @@ RSpec.describe Api::DirectUploadsController, type: :controller do
private
def direct_upload_params
def blob_params
file = file_fixture("video_file.mp4")
checksum = Digest::MD5.base64digest(StringIO.new(file.read).to_s)

View File

@@ -8,10 +8,6 @@ FactoryBot.define do
guardian_clause "Is the signer a minor?"
fee "$0.00"
trait :archived do
archived_at Time.zone.now
end
factory :appearance_release_contract_template do
release_type "appearance"
end

View File

@@ -5,7 +5,6 @@ require 'rails_helper'
RSpec.feature 'User manages contract templates', type: :feature do
let(:current_user) { create(:user, :manager) }
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
let(:project2) { create(:project, members: current_user, account: current_user.primary_account, name: 'New project') }
before do
sign_in(current_user)
@@ -192,21 +191,6 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(page).not_to have_content('Test template')
end
scenario 'archived contract templates from other projects are not shown when importing contract templates' do
create(:contract_template, :archived, project: project2, name: 'Archived template')
create(:contract_template, project: project2, name: 'Active template')
create(:contract_template, project: project)
visit project_contract_templates_path(project)
expect(page).to have_content('Test template')
click_on import_template_button
expect(page).not_to have_content('Test template')
expect(page).not_to have_content('Archived template')
expect(page).to have_content('Active template')
end
context 'When the user is associate' do
let(:current_user) { create(:user, :associate) }
@@ -214,7 +198,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
visit project_contract_templates_path(project)
expect(page).not_to have_content('Create New Release Template')
expect(page).not_to have_content(import_template_button)
expect(page).not_to have_content('Import Release Template')
expect(page).not_to have_content('Delete')
end
end
@@ -234,14 +218,6 @@ RSpec.feature 'User manages contract templates', type: :feature do
private
def import_template_button
t 'contract_templates.index.actions.import'
end
def import_selected_templates_button
t 'release_template_imports.new.actions.import'
end
def preview_heading
t 'blank_contracts.new.preview_heading'
end

View File

@@ -97,18 +97,6 @@ describe HeadshotCollection do
expect(hash.keys).not_to include(:collection_uid)
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
private