Compare commits
13 Commits
allow-task
...
add-csv-to
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ffa883462 | ||
|
|
e0cf5ba875 | ||
|
|
ebc13242de | ||
|
|
8538613a83 | ||
|
|
fcb6e093c3 | ||
|
|
33bcb6600a | ||
|
|
d585d3cad3 | ||
|
|
578403bb5c | ||
|
|
2020761649 | ||
|
|
bb8e5c9b73 | ||
|
|
5ed930108d | ||
|
|
a1abd70ae9 | ||
|
|
3918484a84 |
@@ -33,11 +33,6 @@ class BroadcastsController < ApplicationController
|
||||
end
|
||||
|
||||
def update
|
||||
unless params.has_key?(:broadcast)
|
||||
@broadcast.regenerate_token
|
||||
redirect_to([@project, @broadcast], notice: t('.reset_notice')) and return
|
||||
end
|
||||
|
||||
@broadcast.update(broadcast_params)
|
||||
@files = @broadcast.files.order("created_at DESC").paginate(page: 1)
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class ContractTemplatesController < ApplicationController
|
||||
:signature_legal_text, :fee,
|
||||
:applicable_medium_id, :applicable_medium_text,
|
||||
:territory_id, :territory_text,
|
||||
:term_id, :term_text, :accessibility,
|
||||
:term_id, :term_text,
|
||||
:restriction_id, :restriction_text,
|
||||
:question_1_text, :question_2_text,
|
||||
:question_3_text, :question_4_text,
|
||||
|
||||
@@ -28,9 +28,8 @@ class StreamNotificationsController < ApplicationController
|
||||
asset_uid = notification.dig(:object, :id)
|
||||
playback_uid = notification.dig(:data, :playback_ids, 0, :id)
|
||||
file_name = notification.dig(:data, :static_renditions, :files, -1, :name)
|
||||
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)
|
||||
recording = @broadcast.broadcast_recordings.create!(asset_uid: asset_uid, asset_playback_uid: playback_uid, file_name: file_name)
|
||||
recordings = @broadcast.broadcast_recordings.order_by_recent.paginate(page: params[:page])
|
||||
|
||||
link = helpers.link_to(recording.broadcast_name.titleize, recording.download_url, target: "_blank")
|
||||
|
||||
@@ -43,8 +43,6 @@ class ContractTemplate < ApplicationRecord
|
||||
scope :non_archived, -> { where(archived_at: nil) }
|
||||
scope :order_by_name, -> { order(:name) }
|
||||
|
||||
enum accessibility: [:public_template, :private_template]
|
||||
|
||||
def fee?
|
||||
!fee.zero?
|
||||
end
|
||||
@@ -68,10 +66,4 @@ class ContractTemplate < ApplicationRecord
|
||||
def has_questionnaire?
|
||||
(1..NUMBER_OF_CUSTOM_FIELDS).any? { |n| public_send("question_#{n}_text").presence }
|
||||
end
|
||||
|
||||
def attributes
|
||||
result = super()
|
||||
result[:signature_legal_text] = signature_legal_text.as_json
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,5 +6,5 @@ class TaskRequest < ApplicationRecord
|
||||
|
||||
scope :order_by_recent, -> { order(created_at: :desc) }
|
||||
|
||||
validates :time_allowed, numericality: { only_integer: true, greater_than_or_equal_to: 2 }, allow_blank: true
|
||||
validates :time_allowed, numericality: { only_integer: true, greater_than_or_equal_to: 2 }
|
||||
end
|
||||
|
||||
@@ -3,10 +3,8 @@ class ContractTemplatePolicy < ApplicationPolicy
|
||||
def resolve
|
||||
if user.account_manager?
|
||||
scope.left_outer_joins(:project).where(projects: {account: user.account})
|
||||
elsif user.manager?
|
||||
scope.left_outer_joins(project: :project_memberships).where(project_memberships: { user_id: user.id })
|
||||
else
|
||||
scope.public_template.left_outer_joins(project: :project_memberships).where(project_memberships: { user_id: user.id })
|
||||
scope.left_outer_joins(project: :project_memberships).where(project_memberships: { user_id: user.id })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -102,7 +102,6 @@
|
||||
<i class="fa fa-clipboard"></i>
|
||||
Copy URL
|
||||
</button>
|
||||
<%= link_to t('.actions.reset_url'), [@project, @broadcast], method: :patch, class: "btn btn-danger" %>
|
||||
</div>
|
||||
<% else %>
|
||||
<input type="text" class="form-control" value="<%= broadcast_url(@broadcast.token) %>" readonly>
|
||||
@@ -111,7 +110,6 @@
|
||||
<i class="fa fa-clipboard"></i>
|
||||
Copy URL
|
||||
</button>
|
||||
<%= link_to t('.actions.reset_url'), [@project, @broadcast], method: :patch, class: "btn btn-danger" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
<%= form.text_field :name, wrapper_class: "col-sm-6" %>
|
||||
<%= form.select :release_type, options_for_release_type_select(project, @release_type), { wrapper_class: "col-sm-6" }, data: { toggle: "collapse-select", target_show_values_mapping: { "#guardian_clause": %w(appearance talent misc medical), "#fee_field": %w(appearance talent location material acquired_media), "#exploitable_rights_fields": %w(appearance talent location material acquired_media), "#custom_fields": %w(medical misc) } }, class: "form-control custom-select" %>
|
||||
</div>
|
||||
<div class="form-row mb-3">
|
||||
<%= form.radio_button :accessibility, :public_template, label: "Public", wrapper_class: "mr-3" %>
|
||||
<%= form.radio_button :accessibility, :private_template, label: "Private" %>
|
||||
</div>
|
||||
<div class="form-row" id="fee_field">
|
||||
<%= form.number_field :fee, min:"0", max:"99999999", step: "0.01", prepend: "$", wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
|
||||
@@ -1,19 +1,9 @@
|
||||
<%= errors_summary_for task_request %>
|
||||
|
||||
<%= bootstrap_form_with model: model, url: [@project, @task_request, show_chat: true], local: true do |form| %>
|
||||
|
||||
<div class="d-flex">
|
||||
<div class="row">
|
||||
<div class="col-xl-10 col-12">
|
||||
<div class="alert alert-info text-center text-md-left">
|
||||
<%= fa_icon "info-circle" %>
|
||||
<strong><%= t '.info_message' %></strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-2 col-12">
|
||||
<%= form.submit t('.actions.chat_now'), class: "btn btn-block btn-warning pt-4 pb-4 mb-1", data: { disable_with: t("shared.disable_with") } %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-info text-center text-md-left">
|
||||
<%= fa_icon "info-circle" %>
|
||||
<strong><%= t '.info_message' %></strong>
|
||||
</div>
|
||||
|
||||
<%= form.text_area :description, label: t('.labels.description') %>
|
||||
|
||||
@@ -217,9 +217,6 @@ en:
|
||||
new:
|
||||
heading:
|
||||
Create Live Stream
|
||||
show:
|
||||
actions:
|
||||
reset_url: Reset URL
|
||||
splash:
|
||||
actions:
|
||||
book_demo: Schedule a Demo
|
||||
@@ -238,8 +235,6 @@ en:
|
||||
share_stream: Share live stream link with clients
|
||||
stream_from_mobile_app: Stream from ME Suite Mobile app, or via a professional camera
|
||||
stream_multiple_cameras: Stream multiple cameras at one time
|
||||
update:
|
||||
reset_notice: The Share URL has been reset, and the previous URL will no longer work. Please click "Copy URL" and share it again with those who you want to have access to this live stream
|
||||
bulk_taggings:
|
||||
new_bulk_tag_modal:
|
||||
submit: Add
|
||||
@@ -1284,9 +1279,7 @@ en:
|
||||
heading:
|
||||
Edit Task Request
|
||||
form:
|
||||
actions:
|
||||
chat_now: Chat Now
|
||||
info_message: For best results, please fill out this form prior to being connected with a TaskME assistant. However, if urgent, you can start speaking with a TaskME assistant by pressing the Chat Now button to the right
|
||||
info_message: After submitting this task request, you'll be connected via chat with a ME Suite representative.
|
||||
labels:
|
||||
additional_notes: Please add any additional notes we should be aware of regarding this task.
|
||||
deadline: What is the deadline for this task?
|
||||
|
||||
@@ -81,9 +81,6 @@ es:
|
||||
do_not_copy_warning: "Do not copy (ES)"
|
||||
serial_number_label: "Serial Number (ES)"
|
||||
broadcasts:
|
||||
show:
|
||||
actions:
|
||||
reset_url: Reset URL (ES)
|
||||
splash:
|
||||
actions:
|
||||
book_demo: Schedule a Demo
|
||||
@@ -102,8 +99,6 @@ es:
|
||||
share_stream: Share live stream link with clients
|
||||
stream_from_mobile_app: Stream from ME Suite Mobile app, or via a professional camera
|
||||
stream_multiple_cameras: Stream multiple cameras at one time
|
||||
update:
|
||||
reset_notice: The Share URL has been reset, and the previous URL will no longer work. Please click "Copy URL" and share it again with those who you want to have access to this live stream
|
||||
contract_templates:
|
||||
blank_contracts:
|
||||
create:
|
||||
@@ -484,9 +479,7 @@ es:
|
||||
create:
|
||||
success_message: Your task request was successfully submitted. Thank you. A chat window will pop up on the lower right in a few seconds. (ES)
|
||||
form:
|
||||
actions:
|
||||
chat_now: Chat Now (ES)
|
||||
info_message: For best results, please fill out this form prior to being connected with a TaskME assistant. However, if urgent, you can start speaking with a TaskME assistant by pressing the Chat Now button to the right (ES)
|
||||
info_message: After submitting this task request, you'll be connected via chat with a ME Suite representative. (ES)
|
||||
index:
|
||||
table_headers:
|
||||
task_request_description: Description (ES)
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
class AddDurationToBroadcastRecordings < ActiveRecord::DataMigration
|
||||
def up
|
||||
recordings = BroadcastRecording.where(duration: nil)
|
||||
client = MuxRuby::AssetsApi.new
|
||||
|
||||
recordings.each do |recording|
|
||||
begin
|
||||
response = client.get_asset(recording.asset_uid)
|
||||
duration = response.data.duration
|
||||
recording.update(duration: duration)
|
||||
rescue MuxRuby::ApiError => e
|
||||
Rails.logger.error("Failed to update duration for broadcast recording with id #{recording.id}\n" + e.message)
|
||||
end
|
||||
|
||||
sleep(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
class AddAccessibilityToContractTemplates < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :contract_templates, :accessibility, :integer, default: 0
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
class AddDurationToBroadcastRecordings < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :broadcast_recordings, :duration, :float
|
||||
end
|
||||
end
|
||||
@@ -494,8 +494,7 @@ CREATE TABLE public.broadcast_recordings (
|
||||
asset_playback_uid character varying NOT NULL,
|
||||
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
|
||||
updated_at timestamp(6) without time zone NOT NULL
|
||||
);
|
||||
|
||||
|
||||
@@ -630,8 +629,7 @@ CREATE TABLE public.contract_templates (
|
||||
question_12_text text,
|
||||
question_13_text text,
|
||||
question_14_text text,
|
||||
question_15_text text,
|
||||
accessibility integer DEFAULT 0
|
||||
question_15_text text
|
||||
);
|
||||
|
||||
|
||||
@@ -3908,8 +3906,6 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20200622180507'),
|
||||
('20200625144713'),
|
||||
('20200702152130'),
|
||||
('20200707155717'),
|
||||
('20200709120630'),
|
||||
('20200712181139');
|
||||
('20200707155717');
|
||||
|
||||
|
||||
|
||||
@@ -30,21 +30,6 @@ RSpec.describe Api::ContractTemplatesController, type: :controller do
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
it 'returns electronic signature legal text when present' do
|
||||
ct = create(:contract_template, name: 'ct1', project_id: project.id)
|
||||
ct.signature_legal_text = "some electronic signature legal text"
|
||||
ct.save
|
||||
|
||||
sign_in_to_api(current_user)
|
||||
get :show, params: { id: ct.id }
|
||||
|
||||
expect(response).to be_successful
|
||||
|
||||
expect(response.body).to include("signature_legal_text")
|
||||
expect(response.body).to include(ct.signature_legal_text.body.as_json)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -127,15 +127,8 @@ RSpec.describe Api::SyncController, type: :controller do
|
||||
get :index
|
||||
|
||||
medical_releases = attributes_for_type('medical_releases')
|
||||
expect(medical_releases.first).to include('id')
|
||||
end
|
||||
|
||||
it 'contains signature legal text for contract templates' do
|
||||
create_default_data_with_signature_legal_text
|
||||
get :index
|
||||
contract_templates = attributes_for_type('contract_templates')
|
||||
expect(contract_templates.first).to include('signature_legal_text')
|
||||
expect(contract_templates.first['signature_legal_text']).to eq ContractTemplate.first.signature_legal_text.as_json
|
||||
expect(medical_releases.first).to include('id')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -156,13 +149,6 @@ RSpec.describe Api::SyncController, type: :controller do
|
||||
create(:appearance_release, :minor_with_guardian_photo, project: project)
|
||||
end
|
||||
|
||||
def create_default_data_with_signature_legal_text
|
||||
create_default_data
|
||||
ct = create(:contract_template, name: "with signature legal text", project: Project.first)
|
||||
ct.signature_legal_text = "legal text example"
|
||||
ct.save
|
||||
end
|
||||
|
||||
def response_body_json
|
||||
JSON.parse(response.body)
|
||||
end
|
||||
|
||||
@@ -203,15 +203,6 @@ RSpec.describe BroadcastsController, type: :controller do
|
||||
|
||||
expect(BroadcastsChannel).to have_received(:broadcast_file_upload_updates)
|
||||
end
|
||||
|
||||
it "regenerates token if #update is called without broadcast param" do
|
||||
old_token = broadcast.token
|
||||
patch :update, params: { project_id: project.id, id: broadcast.id }
|
||||
|
||||
expect(response).to redirect_to [project, broadcast]
|
||||
expect(flash.notice).to eq token_reset_notice
|
||||
expect(Broadcast.last.token).not_to eq old_token
|
||||
end
|
||||
end
|
||||
|
||||
describe "#destroy" do
|
||||
@@ -261,8 +252,4 @@ RSpec.describe BroadcastsController, type: :controller do
|
||||
def create_stream
|
||||
t 'broadcasts.splash.actions.create_stream'
|
||||
end
|
||||
|
||||
def token_reset_notice
|
||||
t 'broadcasts.update.reset_notice'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,7 +7,6 @@ FactoryBot.define do
|
||||
body "This is a test contract template."
|
||||
guardian_clause "Is the signer a minor?"
|
||||
fee "$0.00"
|
||||
accessibility "public_template"
|
||||
|
||||
trait :archived do
|
||||
archived_at Time.zone.now
|
||||
|
||||
@@ -49,18 +49,12 @@ FactoryBot.define do
|
||||
predefined_client_name "nat_geo"
|
||||
end
|
||||
|
||||
factory :project_with_contract_template_public do
|
||||
factory :project_with_contract_template do
|
||||
after(:build) do |project, _|
|
||||
project.contract_templates << build(:contract_template, project: nil)
|
||||
end
|
||||
end
|
||||
|
||||
factory :project_with_contract_template_private do
|
||||
after(:build) do |project, _|
|
||||
project.contract_templates << build(:contract_template, project: nil, accessibility: "private_template")
|
||||
end
|
||||
end
|
||||
|
||||
factory :project_with_directories do
|
||||
after(:build) do |project, _|
|
||||
project.directories << build(:directory, project: nil, name: "Shared")
|
||||
|
||||
@@ -63,21 +63,6 @@ feature 'User managing broadcasts' do
|
||||
expect(page).to have_content(recording.download_file_name)
|
||||
end
|
||||
|
||||
scenario 'Clicking Reset URL regenerates broadcast token' do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
old_token = broadcast.token
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
expect(page).to have_content reset_url
|
||||
expect(page).to have_xpath "//input[@readonly][@value='#{broadcast_url(old_token)}']"
|
||||
|
||||
click_link reset_url
|
||||
expect(Broadcast.last.token).not_to eq old_token
|
||||
expect(page).to have_xpath "//input[@readonly][@value='#{broadcast_url(Broadcast.last.token)}']"
|
||||
expect(page).to have_content token_reset_notice
|
||||
end
|
||||
|
||||
scenario 'user can go back and forth between live session and previous sessions', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast)
|
||||
@@ -204,12 +189,4 @@ feature 'User managing broadcasts' do
|
||||
def create_stream
|
||||
t 'broadcasts.splash.actions.create_stream'
|
||||
end
|
||||
|
||||
def reset_url
|
||||
t 'broadcasts.show.actions.reset_url'
|
||||
end
|
||||
|
||||
def token_reset_notice
|
||||
t 'broadcasts.update.reset_notice'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -91,21 +91,6 @@ feature "User managing task requests" do
|
||||
expect(page).to have_content add_new_project_label
|
||||
end
|
||||
|
||||
scenario "user can click Chat Now and start chat event with a blank form" do
|
||||
visit project_task_requests_path(project)
|
||||
|
||||
click_on create_task_request
|
||||
|
||||
expect(page).to have_content chat_now_button
|
||||
expect(page).to have_content form_notice
|
||||
|
||||
expect do
|
||||
click_on chat_now_button
|
||||
end.to change(TaskRequest, :count).by(1)
|
||||
|
||||
expect(page).to have_content task_request_created_notice
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def no_task_requests_label
|
||||
@@ -135,20 +120,4 @@ feature "User managing task requests" do
|
||||
def schedule_demo
|
||||
t 'task_requests.splash.actions.book_demo'
|
||||
end
|
||||
|
||||
def create_task_request
|
||||
t 'task_requests.index.actions.new'
|
||||
end
|
||||
|
||||
def chat_now_button
|
||||
t 'task_requests.form.actions.chat_now'
|
||||
end
|
||||
|
||||
def form_notice
|
||||
t 'task_requests.form.info_message'
|
||||
end
|
||||
|
||||
def task_request_created_notice
|
||||
t 'task_requests.create.success_message'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@ RSpec.describe Project, type: :model do
|
||||
|
||||
describe "#import_contract_templates" do
|
||||
it "imports contract templates from other projects within the account" do
|
||||
existing_project = create(:project_with_contract_template_public)
|
||||
existing_project = create(:project_with_contract_template)
|
||||
new_project = create(:project, name: "New Project", account: existing_project.account)
|
||||
|
||||
expect {
|
||||
|
||||
@@ -13,4 +13,8 @@ RSpec.describe TaskRequest, type: :model do
|
||||
subject { described_class }
|
||||
it { is_expected.to respond_to(:order_by_recent) }
|
||||
end
|
||||
|
||||
describe "#validations" do
|
||||
it { should validate_numericality_of(:time_allowed).only_integer.is_greater_than_or_equal_to(2) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -75,17 +75,14 @@ describe ContractTemplatePolicy do
|
||||
end
|
||||
|
||||
permissions ".scope" do
|
||||
let!(:member_project_public_template) do
|
||||
create(:project_with_contract_template_public, name: "Member Project Public Template", members: user, account: account)
|
||||
end
|
||||
let!(:member_project_private_template) do
|
||||
create(:project_with_contract_template_private, name: "Member Project Private Template", members: user, account: account)
|
||||
let!(:member_project) do
|
||||
create(:project_with_contract_template, name: "Member Project", members: user, account: account)
|
||||
end
|
||||
let!(:non_member_project) do
|
||||
create(:project_with_contract_template_public, name: "Non-Member Project", account: account)
|
||||
create(:project_with_contract_template, name: "Non-Member Project", account: account)
|
||||
end
|
||||
let!(:outside_project) do
|
||||
create(:project_with_contract_template_public, name: "Outside Project", account: build(:account))
|
||||
create(:project_with_contract_template, name: "Outside Project", account: build(:account))
|
||||
end
|
||||
|
||||
let(:account) { build(:account) }
|
||||
@@ -96,8 +93,7 @@ describe ContractTemplatePolicy do
|
||||
context "for an account manager" do
|
||||
let(:user) { create(:user, :account_manager, primary_account: account)}
|
||||
|
||||
it { is_expected.to include(member_project_public_template.contract_templates.first) }
|
||||
it { is_expected.to include(member_project_private_template.contract_templates.first) }
|
||||
it { is_expected.to include(member_project.contract_templates.first) }
|
||||
it { is_expected.to include(non_member_project.contract_templates.first) }
|
||||
it { is_expected.not_to include(outside_project.contract_templates.first) }
|
||||
end
|
||||
@@ -105,17 +101,15 @@ describe ContractTemplatePolicy do
|
||||
context "for manager" do
|
||||
let(:user) { create(:user, :manager, primary_account: account) }
|
||||
|
||||
it { is_expected.to include(member_project_public_template.contract_templates.first) }
|
||||
it { is_expected.to include(member_project_private_template.contract_templates.first) }
|
||||
it { is_expected.to include(member_project.contract_templates.first) }
|
||||
it { is_expected.not_to include(non_member_project.contract_templates.first) }
|
||||
it { is_expected.not_to include(outside_project.contract_templates.first) }
|
||||
end
|
||||
|
||||
context "for associate" do
|
||||
let(:user) { create(:user, :associate, primary_account: account) }
|
||||
|
||||
it { is_expected.to include(member_project_public_template.contract_templates.first) }
|
||||
it { is_expected.not_to include(member_project_private_template.contract_templates.first) }
|
||||
|
||||
it { is_expected.to include(member_project.contract_templates.first) }
|
||||
it { is_expected.not_to include(non_member_project.contract_templates.first) }
|
||||
it { is_expected.not_to include(outside_project.contract_templates.first) }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user