Compare commits
4 Commits
add-photos
...
add-filmin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45b7b7ad5f | ||
|
|
6aaea8e008 | ||
|
|
c3caab3a65 | ||
|
|
b340863dfa |
@@ -6,11 +6,6 @@
|
|||||||
@import "dropzone/dist/dropzone";
|
@import "dropzone/dist/dropzone";
|
||||||
@import 'bootstrap-datepicker';
|
@import 'bootstrap-datepicker';
|
||||||
|
|
||||||
// Global styles
|
|
||||||
label {
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wordmarks
|
// Wordmarks
|
||||||
.suite-wordmark {
|
.suite-wordmark {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ class AcquiredMediaReleasesController < ApplicationController
|
|||||||
:name,
|
:name,
|
||||||
:territory,
|
:territory,
|
||||||
:term,
|
:term,
|
||||||
:person_first_name,
|
:person_name,
|
||||||
:person_last_name,
|
|
||||||
:person_phone,
|
:person_phone,
|
||||||
:person_email,
|
:person_email,
|
||||||
:person_company,
|
:person_company,
|
||||||
|
|||||||
@@ -45,9 +45,6 @@ class Public::AcquiredMediaReleasesController < Public::BaseController
|
|||||||
params.require(:acquired_media_release).permit(
|
params.require(:acquired_media_release).permit(
|
||||||
:name,
|
:name,
|
||||||
:description,
|
:description,
|
||||||
:person_first_name,
|
|
||||||
:person_last_name,
|
|
||||||
:person_email,
|
|
||||||
:person_title,
|
:person_title,
|
||||||
:person_phone,
|
:person_phone,
|
||||||
:person_fax,
|
:person_fax,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Public::MaterialReleasesController < Public::BaseController
|
|||||||
:person_first_name, :person_last_name, :person_title, :person_company, :person_phone, :person_email,
|
:person_first_name, :person_last_name, :person_title, :person_company, :person_phone, :person_email,
|
||||||
:person_address_street1, :person_address_street2, :person_address_city, :person_address_state, :person_address_zip, :person_address_country,
|
:person_address_street1, :person_address_street2, :person_address_city, :person_address_state, :person_address_zip, :person_address_country,
|
||||||
:signature_base64,
|
:signature_base64,
|
||||||
:locale, :contract_template, :description, photos: []
|
:locale, :contract_template, :description
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ module DropzoneHelper
|
|||||||
case releasable.model_name.param_key
|
case releasable.model_name.param_key
|
||||||
when "acquired_media_release"
|
when "acquired_media_release"
|
||||||
"To Add Photos & Videos to the release:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse photos and connect to Camera"
|
"To Add Photos & Videos to the release:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse photos and connect to Camera"
|
||||||
when "material_release"
|
|
||||||
t 'material_releases.form.photos.dropzone_label'
|
|
||||||
when "music_release"
|
when "music_release"
|
||||||
"To Add Audio Files to the release:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse files"
|
"To Add Audio Files to the release:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse files"
|
||||||
when "directory"
|
when "directory"
|
||||||
|
|||||||
@@ -43,8 +43,7 @@ class AcquiredMediaRelease < ApplicationRecord
|
|||||||
person_address_street1 person_address_street2 person_address_city person_address_state person_address_zip person_address_country
|
person_address_street1 person_address_street2 person_address_city person_address_state person_address_zip person_address_country
|
||||||
]
|
]
|
||||||
|
|
||||||
# CATEGORIES = ["Artwork", "Film Footage", "Video Footage", "Still Photograph"].freeze
|
CATEGORIES = ["Artwork", "Film Footage", "Video Footage", "Still Photograph"].freeze
|
||||||
CATEGORIES = ["Film Footage", "Video Footage", "Still Photograph"].freeze
|
|
||||||
|
|
||||||
def minor?
|
def minor?
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class Project < ApplicationRecord
|
|||||||
current_zoom_meeting = zoom_meetings.active.first
|
current_zoom_meeting = zoom_meetings.active.first
|
||||||
|
|
||||||
unless current_zoom_meeting.present?
|
unless current_zoom_meeting.present?
|
||||||
zoom_user = ZoomUser.for_new_meeting
|
zoom_user = ZoomUser.free.first || ZoomUser.create
|
||||||
current_zoom_meeting = ZoomMeeting.create(zoom_user: zoom_user, project: self)
|
current_zoom_meeting = ZoomMeeting.create(zoom_user: zoom_user, project: self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,19 @@
|
|||||||
require 'zoom_gateway'
|
require 'zoom_gateway'
|
||||||
require 'securerandom'
|
|
||||||
class ZoomUser < ApplicationRecord
|
class ZoomUser < ApplicationRecord
|
||||||
has_many :zoom_meetings, dependent: :nullify
|
has_many :zoom_meetings, dependent: :nullify
|
||||||
|
|
||||||
enum tier: [:basic, :pro]
|
|
||||||
|
|
||||||
after_create :create_api_user, if: -> { api_id.nil? }
|
after_create :create_api_user, if: -> { api_id.nil? }
|
||||||
before_destroy :abort_destroy
|
before_destroy :abort_destroy
|
||||||
|
|
||||||
scope :current_account, -> { where(account_number: ZoomGateway.ACCOUNT_NUMBER) }
|
|
||||||
scope :free, -> { where.not(id: ZoomMeeting.active.pluck(:zoom_user_id)) }
|
scope :free, -> { where.not(id: ZoomMeeting.active.pluck(:zoom_user_id)) }
|
||||||
|
|
||||||
|
def api_email
|
||||||
|
self.class.api_email(self.id)
|
||||||
|
end
|
||||||
|
|
||||||
def create_api_user
|
def create_api_user
|
||||||
retries ||= 0
|
self.api_id = gateway.create_host(api_email)
|
||||||
self.api_id = gateway.create_host(self.class.generate_api_email)
|
|
||||||
self.account_number = ZoomGateway.ACCOUNT_NUMBER
|
|
||||||
save
|
save
|
||||||
rescue ZoomGateway::UserAlreadyExists => e
|
|
||||||
retries += 1
|
|
||||||
if retries < 3
|
|
||||||
retry # new api email will be generated automatically
|
|
||||||
else
|
|
||||||
raise e
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_api_user
|
def delete_api_user
|
||||||
@@ -31,22 +22,9 @@ class ZoomUser < ApplicationRecord
|
|||||||
save
|
save
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_account?
|
|
||||||
account_number == ZoomGateway.ACCOUNT_NUMBER
|
|
||||||
end
|
|
||||||
|
|
||||||
# Static methods
|
|
||||||
class << self
|
class << self
|
||||||
def generate_api_email
|
def api_email(id)
|
||||||
"host#{SecureRandom.random_number(10000)}@directme"
|
"host#{id}@directme"
|
||||||
end
|
|
||||||
|
|
||||||
def for_new_meeting
|
|
||||||
user = public_send(ZoomGateway.USER_TYPE_NAME).current_account.free.first
|
|
||||||
if user.nil?
|
|
||||||
user = public_send(ZoomGateway.USER_TYPE_NAME).current_account.create
|
|
||||||
end
|
|
||||||
user
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<%= form.text_field :name, required: true, wrapper_class: "col-12" %>
|
<%= form.text_field :name, required: true, wrapper_class: "col-12" %>
|
||||||
</div>
|
</div>
|
||||||
<%= form.form_group :categories, label: { text: "Licensed property type" } do %>
|
<%= form.form_group :categories, label: { text: "Categories" } do %>
|
||||||
<% AcquiredMediaRelease::CATEGORIES.each do |category| %>
|
<% AcquiredMediaRelease::CATEGORIES.each do |category| %>
|
||||||
<%= form.check_box :categories, { multiple: true, label: category }, category, false %>
|
<%= form.check_box :categories, { multiple: true, label: category }, category, false %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -11,10 +11,14 @@
|
|||||||
|
|
||||||
<%= field_set_tag content_tag(:span, t(".signer_details.heading"), class: "h6 text-muted text-uppercase") do %>
|
<%= field_set_tag content_tag(:span, t(".signer_details.heading"), class: "h6 text-muted text-uppercase") do %>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<%= form.text_field :person_first_name, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_first_name, wrapper_class: "col-sm-3" %>
|
||||||
<%= form.text_field :person_last_name, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_last_name, wrapper_class: "col-sm-3" %>
|
||||||
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
<%= form.text_field :person_company, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_company, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,10 +13,14 @@
|
|||||||
|
|
||||||
<%= field_set_tag content_tag(:span, t(".signer_details.heading"), class: "h6 text-muted text-uppercase") do %>
|
<%= field_set_tag content_tag(:span, t(".signer_details.heading"), class: "h6 text-muted text-uppercase") do %>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<%= form.text_field :person_first_name, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_first_name, wrapper_class: "col-sm-3" %>
|
||||||
<%= form.text_field :person_last_name, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_last_name, wrapper_class: "col-sm-3" %>
|
||||||
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
<%= form.text_field :person_company, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_company, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
|
|
||||||
<%= card_field_set_tag t(".acquired_media_info.heading") do %>
|
<%= card_field_set_tag t(".acquired_media_info.heading") do %>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<%= form.text_field :name, required: true, wrapper_class: "col-12" %>
|
<%= form.text_field :name, required: true, wrapper_class: "col-12", label: 'Licensor ("Owner")' %>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<%= form.text_area :description, wrapper_class: "col-12" %>
|
<%= form.text_area :description, wrapper_class: "col-12" %>
|
||||||
</div>
|
</div>
|
||||||
<%= form.form_group :categories, label: { text: "Licensed property type" } do %>
|
<%= form.form_group :categories, label: { text: "Categories" } do %>
|
||||||
<% AcquiredMediaRelease::CATEGORIES.each do |category| %>
|
<% AcquiredMediaRelease::CATEGORIES.each do |category| %>
|
||||||
<%= form.check_box :categories, { multiple: true, label: category }, category, false %>
|
<%= form.check_box :categories, { multiple: true, label: category }, category, false %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -31,11 +31,8 @@
|
|||||||
|
|
||||||
<%= card_field_set_tag t(".personal_info.heading") do %>
|
<%= card_field_set_tag t(".personal_info.heading") do %>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<%= form.text_field :person_first_name, wrapper_class: "col-sm-6" %>
|
|
||||||
<%= form.text_field :person_last_name, wrapper_class: "col-sm-6" %>
|
|
||||||
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6", label: 'Phone' %>
|
<%= form.text_field :person_phone, wrapper_class: "col-sm-6", label: 'Phone' %>
|
||||||
<%= form.email_field :person_email, wrapper_class: "col-sm-6", label: 'Email' %>
|
|
||||||
<%= form.text_field :person_fax, wrapper_class: "col-sm-6", label: 'Fax' %>
|
<%= form.text_field :person_fax, wrapper_class: "col-sm-6", label: 'Fax' %>
|
||||||
</div>
|
</div>
|
||||||
<%= render "shared/address_fields", form: form, subject: "person" %>
|
<%= render "shared/address_fields", form: form, subject: "person" %>
|
||||||
|
|||||||
@@ -27,7 +27,11 @@
|
|||||||
<%= form.text_field :person_first_name, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_first_name, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.text_field :person_last_name, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_last_name, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
<%= form.text_field :person_company, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_company, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,17 +27,17 @@
|
|||||||
<%= form.text_field :person_first_name, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_first_name, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.text_field :person_last_name, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_last_name, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
<%= form.text_field :person_company, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_company, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
||||||
</div>
|
</div>
|
||||||
<%= render "shared/address_fields", form: form, subject: "person" %>
|
<%= render "shared/address_fields", form: form, subject: "person" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= card_field_set_tag t(".photo.heading") do %>
|
|
||||||
<%= render "shared/photos_dropzone_fields", form: form, release: @material_release %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<%= card_field_set_tag t(".signature.heading") do %>
|
<%= card_field_set_tag t(".signature.heading") do %>
|
||||||
|
|||||||
@@ -305,8 +305,6 @@ en:
|
|||||||
graphics_only_edl_file: If you do not upload a Graphics Only EDL, the software will not generate a Graphics Cue List.
|
graphics_only_edl_file: If you do not upload a Graphics Only EDL, the software will not generate a Graphics Cue List.
|
||||||
label:
|
label:
|
||||||
acquired_media_release:
|
acquired_media_release:
|
||||||
description: Description of licensed property
|
|
||||||
name: Name of licensed property
|
|
||||||
person_address: Address
|
person_address: Address
|
||||||
person_address_city: City
|
person_address_city: City
|
||||||
person_address_country: Country
|
person_address_country: Country
|
||||||
@@ -316,8 +314,6 @@ en:
|
|||||||
person_address_zip: Zip code
|
person_address_zip: Zip code
|
||||||
person_company: Company
|
person_company: Company
|
||||||
person_email: Email address
|
person_email: Email address
|
||||||
person_first_name: Licensor/Owner first name
|
|
||||||
person_last_name: Licensor/Owner last name
|
|
||||||
person_name: Name
|
person_name: Name
|
||||||
person_phone: Phone number
|
person_phone: Phone number
|
||||||
person_title: Title
|
person_title: Title
|
||||||
@@ -331,23 +327,16 @@ en:
|
|||||||
address_city: City
|
address_city: City
|
||||||
address_country: Country
|
address_country: Country
|
||||||
address_state: State
|
address_state: State
|
||||||
address_street1: Address of Property
|
address_street1: Address
|
||||||
address_street2: Address (Line 2)
|
address_street2: Address (Line 2)
|
||||||
address_zip: Zip code
|
address_zip: Zip code
|
||||||
filming_ended_on: Filming end date
|
|
||||||
filming_started_on: Filming start date
|
|
||||||
name: Name of property
|
|
||||||
person_address_city: City
|
person_address_city: City
|
||||||
person_address_country: Country
|
person_address_country: Country
|
||||||
person_address_state: State
|
person_address_state: State
|
||||||
person_address_street1: Address
|
person_address_street1: Address
|
||||||
person_address_street2: Address (Line 2)
|
person_address_street2: Address (Line 2)
|
||||||
person_address_zip: Zip code
|
person_address_zip: Zip code
|
||||||
person_first_name: Owner first name
|
|
||||||
person_last_name: Owner last name
|
|
||||||
material_release:
|
material_release:
|
||||||
description: Description of licensed material
|
|
||||||
name: Name of licensed material
|
|
||||||
person_address: Address
|
person_address: Address
|
||||||
person_address_city: City
|
person_address_city: City
|
||||||
person_address_country: Country
|
person_address_country: Country
|
||||||
@@ -357,8 +346,6 @@ en:
|
|||||||
person_address_zip: Zip code
|
person_address_zip: Zip code
|
||||||
person_company: Company
|
person_company: Company
|
||||||
person_email: Email address
|
person_email: Email address
|
||||||
person_first_name: Licensor/Owner first name
|
|
||||||
person_last_name: Licensor/Owner last name
|
|
||||||
person_name: Name
|
person_name: Name
|
||||||
person_phone: Phone number
|
person_phone: Phone number
|
||||||
person_title: Title
|
person_title: Title
|
||||||
@@ -557,7 +544,7 @@ en:
|
|||||||
photos:
|
photos:
|
||||||
heading: 4 of 4 Photos
|
heading: 4 of 4 Photos
|
||||||
signer_details:
|
signer_details:
|
||||||
heading: 2 of 4 Owner Details
|
heading: 2 of 4 Signer Details
|
||||||
index:
|
index:
|
||||||
actions:
|
actions:
|
||||||
new: Import Release
|
new: Import Release
|
||||||
@@ -590,9 +577,8 @@ en:
|
|||||||
heading: 1 of 3 Material Details
|
heading: 1 of 3 Material Details
|
||||||
photos:
|
photos:
|
||||||
heading: 4 of 4 Photos
|
heading: 4 of 4 Photos
|
||||||
dropzone_label: Tap to take a photo of Licensed Material (optional)
|
|
||||||
signer_details:
|
signer_details:
|
||||||
heading: 2 of 4 Licensor/Owner Details
|
heading: 2 of 4 Signer Details
|
||||||
index:
|
index:
|
||||||
actions:
|
actions:
|
||||||
new: Import Release
|
new: Import Release
|
||||||
@@ -755,7 +741,9 @@ en:
|
|||||||
legal:
|
legal:
|
||||||
heading: Legal
|
heading: Legal
|
||||||
personal_info:
|
personal_info:
|
||||||
heading: Licensor/Owner Contact Information
|
heading: Person Details
|
||||||
|
personal_info:
|
||||||
|
heading: Signer's Contact Information
|
||||||
signature:
|
signature:
|
||||||
heading: Signature
|
heading: Signature
|
||||||
appearance_releases:
|
appearance_releases:
|
||||||
@@ -794,7 +782,7 @@ en:
|
|||||||
new:
|
new:
|
||||||
cancel: Cancel
|
cancel: Cancel
|
||||||
contact_info:
|
contact_info:
|
||||||
heading: Owner Contact Information
|
heading: Signer Information
|
||||||
filming_info:
|
filming_info:
|
||||||
heading: Filming Information
|
heading: Filming Information
|
||||||
legal:
|
legal:
|
||||||
@@ -809,15 +797,13 @@ en:
|
|||||||
new:
|
new:
|
||||||
cancel: Cancel
|
cancel: Cancel
|
||||||
contact_info:
|
contact_info:
|
||||||
heading: Licensor/Owner Contact Information
|
heading: Signer's Contact Information
|
||||||
legal:
|
legal:
|
||||||
heading: Legal
|
heading: Legal
|
||||||
release_info:
|
release_info:
|
||||||
heading: Release Information
|
heading: Release Information
|
||||||
signature:
|
signature:
|
||||||
heading: Sign Below
|
heading: Sign Below
|
||||||
photo:
|
|
||||||
heading: Photos
|
|
||||||
talent_releases:
|
talent_releases:
|
||||||
create:
|
create:
|
||||||
notice: Your release has been signed. Thank you!
|
notice: Your release has been signed. Thank you!
|
||||||
|
|||||||
@@ -175,10 +175,6 @@ es:
|
|||||||
show:
|
show:
|
||||||
choose_project: ¿Qué proyecto de la lista de abajo asistirá?
|
choose_project: ¿Qué proyecto de la lista de abajo asistirá?
|
||||||
welcome_html: Bienvenidos a la plataforma de firma autorizaciónes de <strong>%{name}</strong>
|
welcome_html: Bienvenidos a la plataforma de firma autorizaciónes de <strong>%{name}</strong>
|
||||||
material_releases:
|
|
||||||
new:
|
|
||||||
photo:
|
|
||||||
heading: Photos (ES)
|
|
||||||
shared:
|
shared:
|
||||||
print: Print (ES)
|
print: Print (ES)
|
||||||
talent_releases:
|
talent_releases:
|
||||||
@@ -186,7 +182,3 @@ es:
|
|||||||
photos:
|
photos:
|
||||||
guardian_photo:
|
guardian_photo:
|
||||||
heading: Guardian Photo (ES)
|
heading: Guardian Photo (ES)
|
||||||
material_releases:
|
|
||||||
form:
|
|
||||||
photos:
|
|
||||||
dropzone_label: Tap to take a photo of Licensed Material (optional)
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
class AssignAccountNumberAndTypeToZoomUsers < ActiveRecord::DataMigration
|
|
||||||
def up
|
|
||||||
ZoomUser.find_each do |zu|
|
|
||||||
zu.update account_number: ENV.fetch('ZOOM_ACCOUNT_NUMBER'), tier: (ENV['ZOOM_USER_TYPE'] == 'pro' ? 1 : 0)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
class AddAccountNumberAndTypeToZoomUsers < ActiveRecord::Migration[6.0]
|
|
||||||
def change
|
|
||||||
add_column :zoom_users, :account_number, :string
|
|
||||||
add_column :zoom_users, :tier, :integer, default: 0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1592,9 +1592,7 @@ CREATE TABLE public.zoom_users (
|
|||||||
id bigint NOT NULL,
|
id bigint NOT NULL,
|
||||||
api_id character varying,
|
api_id character varying,
|
||||||
created_at timestamp(6) without time zone NOT NULL,
|
created_at timestamp(6) without time zone NOT NULL,
|
||||||
updated_at timestamp(6) without time zone NOT NULL,
|
updated_at timestamp(6) without time zone NOT NULL
|
||||||
account_number character varying,
|
|
||||||
tier integer DEFAULT 0
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -3501,7 +3499,6 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||||||
('20200427073429'),
|
('20200427073429'),
|
||||||
('20200428091105'),
|
('20200428091105'),
|
||||||
('20200507110804'),
|
('20200507110804'),
|
||||||
('20200512161738'),
|
('20200512161738');
|
||||||
('20200526113516');
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ class ZoomGateway
|
|||||||
class MeetingExpired < StandardError; end
|
class MeetingExpired < StandardError; end
|
||||||
class UserNotFound < StandardError; end
|
class UserNotFound < StandardError; end
|
||||||
class TooManyHosts < StandardError; end
|
class TooManyHosts < StandardError; end
|
||||||
class UserAlreadyExists < StandardError; end
|
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def USER_TYPE_NAME
|
def USER_TYPE_NAME
|
||||||
@@ -24,12 +23,8 @@ class ZoomGateway
|
|||||||
"#{self.USER_TYPE_NAME}-directme-host"
|
"#{self.USER_TYPE_NAME}-directme-host"
|
||||||
end
|
end
|
||||||
|
|
||||||
def ACCOUNT_NUMBER
|
|
||||||
ENV['ZOOM_ACCOUNT_NUMBER']
|
|
||||||
end
|
|
||||||
|
|
||||||
def enable_recordings?
|
def enable_recordings?
|
||||||
ENV['ZOOM_ENABLE_RECORDINGS'] == 'true'
|
ENV['ZOOM_ENABLE_RECORDINGS'] == '1'
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_limits?
|
def apply_limits?
|
||||||
@@ -102,8 +97,6 @@ class ZoomGateway
|
|||||||
raise UserNotFound, error.message
|
raise UserNotFound, error.message
|
||||||
elsif error.status_code == 3001
|
elsif error.status_code == 3001
|
||||||
raise MeetingExpired, error.message
|
raise MeetingExpired, error.message
|
||||||
elsif error.status_code == 1005
|
|
||||||
raise UserAlreadyExists, error.message
|
|
||||||
else
|
else
|
||||||
raise error
|
raise error
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,15 +7,6 @@ describe Public::MaterialReleasesController do
|
|||||||
render_views
|
render_views
|
||||||
|
|
||||||
describe "#create" do
|
describe "#create" do
|
||||||
it "allows photos param" do
|
|
||||||
contract_template = create(:contract_template, project: project)
|
|
||||||
|
|
||||||
post :create, params: { account_id: user.primary_account.to_param, project_id: project, contract_template_id: contract_template, material_release: material_release_params_with_photos }
|
|
||||||
|
|
||||||
expect(response).to be_successful
|
|
||||||
expect(MaterialRelease.last.photos.attached?).to eq true
|
|
||||||
end
|
|
||||||
|
|
||||||
it "logs analytics" do
|
it "logs analytics" do
|
||||||
contract_template = create(:contract_template, project: project)
|
contract_template = create(:contract_template, project: project)
|
||||||
|
|
||||||
@@ -74,11 +65,6 @@ describe Public::MaterialReleasesController do
|
|||||||
attributes_for(:material_release, :native).except(:signature).merge(signature_param)
|
attributes_for(:material_release, :native).except(:signature).merge(signature_param)
|
||||||
end
|
end
|
||||||
|
|
||||||
def material_release_params_with_photos
|
|
||||||
attributes_for(:material_release, :native, :with_photo).except(:signature).merge(signature_param)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def signature_param
|
def signature_param
|
||||||
file = file_fixture("signature.png")
|
file = file_fixture("signature.png")
|
||||||
data_uri = Base64Image.from_image(file).data_uri
|
data_uri = Base64Image.from_image(file).data_uri
|
||||||
|
|||||||
@@ -15,14 +15,6 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :with_photo do
|
|
||||||
photos do
|
|
||||||
path = Rails.root.join("spec", "fixtures", "files", "material_photo.png")
|
|
||||||
[Rack::Test::UploadedFile.new(path, "image/png")]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
trait :non_native do
|
trait :non_native do
|
||||||
contract do
|
contract do
|
||||||
path = Rails.root.join("spec", "fixtures", "files", "contract.pdf")
|
path = Rails.root.join("spec", "fixtures", "files", "contract.pdf")
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
require 'zoom_gateway'
|
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :zoom_user do
|
factory :zoom_user do
|
||||||
account_number ZoomGateway.ACCOUNT_NUMBER
|
|
||||||
trait ZoomGateway.USER_TYPE_NAME
|
|
||||||
|
|
||||||
trait :with_api_id do
|
trait :with_api_id do
|
||||||
api_id "api_user_id"
|
api_id "api_user_id"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ feature "User managing acquired_media releases" do
|
|||||||
|
|
||||||
click_button "I have read and agree to the above"
|
click_button "I have read and agree to the above"
|
||||||
|
|
||||||
expect(AcquiredMediaRelease.last.categories).to include("Video Footage")
|
expect(AcquiredMediaRelease.last.categories).to include("Artwork")
|
||||||
expect(AcquiredMediaRelease.last.categories).to include("Still Photograph")
|
expect(AcquiredMediaRelease.last.categories).to include("Still Photograph")
|
||||||
expect(page).to have_content("Your release was successfully submitted. Thank you.")
|
expect(page).to have_content("Your release was successfully submitted. Thank you.")
|
||||||
end
|
end
|
||||||
@@ -210,7 +210,7 @@ feature "User managing acquired_media releases" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
def acquired_media_category_fields
|
def acquired_media_category_fields
|
||||||
find(:css, "#acquired_media_release_categories_video_footage").set(true)
|
find(:css, "#acquired_media_release_categories_artwork").set(true)
|
||||||
find(:css, "#acquired_media_release_categories_still_photograph").set(true)
|
find(:css, "#acquired_media_release_categories_still_photograph").set(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ feature "User managing material releases" do
|
|||||||
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
|
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
|
||||||
|
|
||||||
context "when signed out" do
|
context "when signed out" do
|
||||||
scenario "creating a release without photos", js: true do
|
scenario "creating a release", js: true do
|
||||||
contract_template = create(:contract_template, project: project)
|
contract_template = create(:contract_template, project: project)
|
||||||
|
|
||||||
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
|
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
|
||||||
@@ -17,27 +17,10 @@ feature "User managing material releases" do
|
|||||||
draw_signature file_fixture("signature.png"), "material_release_signature_base64"
|
draw_signature file_fixture("signature.png"), "material_release_signature_base64"
|
||||||
end
|
end
|
||||||
|
|
||||||
click_button submit_release_button
|
click_button "I have read and agree to the above"
|
||||||
|
|
||||||
expect(page).to have_content("Your release was successfully submitted. Thank you.")
|
expect(page).to have_content("Your release was successfully submitted. Thank you.")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "creating a release with photos", js: true do
|
|
||||||
contract_template = create(:contract_template, project: project)
|
|
||||||
|
|
||||||
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
|
|
||||||
|
|
||||||
fill_in material_name_field, with: "Pepsi Logo"
|
|
||||||
fill_in person_first_name_field, with: "Jane"
|
|
||||||
fill_in person_last_name_field, with: "Doe"
|
|
||||||
draw_signature file_fixture("signature.png"), "material_release_signature_base64"
|
|
||||||
|
|
||||||
drop_file Rails.root.join(file_fixture("material_photo.png")), type: :dropzone
|
|
||||||
click_button submit_release_button
|
|
||||||
|
|
||||||
expect(page).to have_content("Your release was successfully submitted. Thank you.")
|
|
||||||
expect(MaterialRelease.last.photos.attached?).to eq true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when signed in" do
|
context "when signed in" do
|
||||||
@@ -241,10 +224,6 @@ feature "User managing material releases" do
|
|||||||
t "helpers.submit.material_release.create"
|
t "helpers.submit.material_release.create"
|
||||||
end
|
end
|
||||||
|
|
||||||
def submit_release_button
|
|
||||||
t 'shared.submit_release_long'
|
|
||||||
end
|
|
||||||
|
|
||||||
def create_release_notice
|
def create_release_notice
|
||||||
t "material_releases.create.notice"
|
t "material_releases.create.notice"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -521,8 +521,8 @@ feature "User performs video analysis" do
|
|||||||
new_path = polymorphic_path([:new, video, release, :video_release_confirmation])
|
new_path = polymorphic_path([:new, video, release, :video_release_confirmation])
|
||||||
first("form[action='#{new_path}']").click_button
|
first("form[action='#{new_path}']").click_button
|
||||||
|
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
expect(page).to have_content "Source File Name"
|
expect(page).to have_content "Source file name"
|
||||||
|
|
||||||
click_on "Show/Hide EDL Events"
|
click_on "Show/Hide EDL Events"
|
||||||
within "#edl_events" do
|
within "#edl_events" do
|
||||||
@@ -572,8 +572,8 @@ feature "User performs video analysis" do
|
|||||||
new_path = polymorphic_path([:new, video, release, :video_release_confirmation])
|
new_path = polymorphic_path([:new, video, release, :video_release_confirmation])
|
||||||
first("form[action='#{new_path}']").click_button
|
first("form[action='#{new_path}']").click_button
|
||||||
|
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
expect(page).to have_content "Source File Name"
|
expect(page).to have_content "Source file name"
|
||||||
|
|
||||||
click_on "Show/Hide EDL Events"
|
click_on "Show/Hide EDL Events"
|
||||||
within "#edl_events" do
|
within "#edl_events" do
|
||||||
@@ -748,8 +748,8 @@ feature "User performs video analysis" do
|
|||||||
|
|
||||||
open_graphics_element_modal(video)
|
open_graphics_element_modal(video)
|
||||||
|
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
expect(page).to have_content "Source File Name"
|
expect(page).to have_content "Source file name"
|
||||||
|
|
||||||
click_on "Show/Hide EDL Events"
|
click_on "Show/Hide EDL Events"
|
||||||
within "#edl_events" do
|
within "#edl_events" do
|
||||||
@@ -796,8 +796,8 @@ feature "User performs video analysis" do
|
|||||||
|
|
||||||
open_graphics_element_modal(video)
|
open_graphics_element_modal(video)
|
||||||
|
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
expect(page).to have_content "Source File Name"
|
expect(page).to have_content "Source file name"
|
||||||
|
|
||||||
click_on "Show/Hide EDL Events"
|
click_on "Show/Hide EDL Events"
|
||||||
within "#edl_events" do
|
within "#edl_events" do
|
||||||
@@ -1188,8 +1188,8 @@ feature "User performs video analysis" do
|
|||||||
open_audio_confirmation_modal
|
open_audio_confirmation_modal
|
||||||
|
|
||||||
expect(page).to have_field("Origin", with: "Original Music")
|
expect(page).to have_field("Origin", with: "Original Music")
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
expect(page).to have_content "Source File Name"
|
expect(page).to have_content "Source file name"
|
||||||
expect(page).to have_field("Source EDL", with: "Audio")
|
expect(page).to have_field("Source EDL", with: "Audio")
|
||||||
|
|
||||||
click_on "Show/Hide EDL Events"
|
click_on "Show/Hide EDL Events"
|
||||||
@@ -1219,10 +1219,10 @@ feature "User performs video analysis" do
|
|||||||
expect(page).to have_field("Source EDL", with: "All Tracks")
|
expect(page).to have_field("Source EDL", with: "All Tracks")
|
||||||
expect(page).to have_field("Channel", with: "A1")
|
expect(page).to have_field("Channel", with: "A1")
|
||||||
expect(page).to have_field("Origin", with: "Library Music")
|
expect(page).to have_field("Origin", with: "Library Music")
|
||||||
expect(page).to have_field("Timecode In", with: "01:00:00:00")
|
expect(page).to have_field("Timecode in", with: "01:00:00:00")
|
||||||
expect(page).to have_field("Timecode out", with: "01:00:02:00")
|
expect(page).to have_field("Timecode out", with: "01:00:02:00")
|
||||||
expect(page).to have_field("Duration", with: "00:00:02")
|
expect(page).to have_field("Duration", with: "00:00:02")
|
||||||
expect(page).to have_field("Source File Name", with: "source_file_name.wav")
|
expect(page).to have_field("Source file name", with: "source_file_name.wav")
|
||||||
expect(page).to have_field("Clip name", with: "clip_name")
|
expect(page).to have_field("Clip name", with: "clip_name")
|
||||||
expect(page).to have_field("Description", with: "description")
|
expect(page).to have_field("Description", with: "description")
|
||||||
|
|
||||||
@@ -1323,8 +1323,8 @@ feature "User performs video analysis" do
|
|||||||
|
|
||||||
open_unreleased_modal(video)
|
open_unreleased_modal(video)
|
||||||
|
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
expect(page).to have_content "Source File Name"
|
expect(page).to have_content "Source file name"
|
||||||
|
|
||||||
click_on "Show/Hide EDL Events"
|
click_on "Show/Hide EDL Events"
|
||||||
within "#edl_events" do
|
within "#edl_events" do
|
||||||
@@ -1371,8 +1371,8 @@ feature "User performs video analysis" do
|
|||||||
|
|
||||||
open_unreleased_modal(video)
|
open_unreleased_modal(video)
|
||||||
|
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
expect(page).to have_content "Source File Name"
|
expect(page).to have_content "Source file name"
|
||||||
|
|
||||||
click_on "Show/Hide EDL Events"
|
click_on "Show/Hide EDL Events"
|
||||||
within "#edl_events" do
|
within "#edl_events" do
|
||||||
@@ -1445,7 +1445,7 @@ feature "User performs video analysis" do
|
|||||||
|
|
||||||
first("#suggested_matches form[action='#{new_path}']").click_button
|
first("#suggested_matches form[action='#{new_path}']").click_button
|
||||||
|
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
|
|
||||||
within "form[action='#{create_path}']" do
|
within "form[action='#{create_path}']" do
|
||||||
click_button "Confirm Release"
|
click_button "Confirm Release"
|
||||||
@@ -1462,7 +1462,7 @@ feature "User performs video analysis" do
|
|||||||
$("#audio_matches .releasable-match button")[0].click()
|
$("#audio_matches .releasable-match button")[0].click()
|
||||||
JS
|
JS
|
||||||
|
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
end
|
end
|
||||||
|
|
||||||
def select_option(select_id, text)
|
def select_option(select_id, text)
|
||||||
@@ -1486,7 +1486,7 @@ feature "User performs video analysis" do
|
|||||||
JS
|
JS
|
||||||
|
|
||||||
expect(page).to have_field("Origin", with: "Library Music")
|
expect(page).to have_field("Origin", with: "Library Music")
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
|
|
||||||
within "form[action='#{create_path}']" do
|
within "form[action='#{create_path}']" do
|
||||||
expect(page).to have_selector("#matched_file_name", text: "library_file_name")
|
expect(page).to have_selector("#matched_file_name", text: "library_file_name")
|
||||||
@@ -1518,7 +1518,7 @@ feature "User performs video analysis" do
|
|||||||
|
|
||||||
first("form[action='#{new_path}']", text: text).click_button
|
first("form[action='#{new_path}']", text: text).click_button
|
||||||
|
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
|
|
||||||
within "form[action='#{create_path}']" do
|
within "form[action='#{create_path}']" do
|
||||||
click_button "Confirm Release"
|
click_button "Confirm Release"
|
||||||
@@ -1536,7 +1536,7 @@ feature "User performs video analysis" do
|
|||||||
first("#music_releases form[action='#{new_path}']", text: text).click_button
|
first("#music_releases form[action='#{new_path}']", text: text).click_button
|
||||||
|
|
||||||
expect(page).to have_field("Origin", with: "Original Music")
|
expect(page).to have_field("Origin", with: "Original Music")
|
||||||
expect(page).to have_content "Timecode In"
|
expect(page).to have_content "Timecode in"
|
||||||
|
|
||||||
within "form[action='#{create_path}']" do
|
within "form[action='#{create_path}']" do
|
||||||
select "Vocal", from: "Music type"
|
select "Vocal", from: "Music type"
|
||||||
|
|||||||
@@ -66,26 +66,19 @@ RSpec.describe ZoomGateway do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context '.enable_recordings?' do
|
context '.enable_recordings?' do
|
||||||
it 'is truthy when ZOOM_ENABLE_RECORDINGS is set to true' do
|
it 'is truthy when ZOOM_ENABLE_RECORDINGS is set to 1' do
|
||||||
stub_env_variable('ZOOM_ENABLE_RECORDINGS', 'true')
|
stub_env_variable('ZOOM_ENABLE_RECORDINGS', '1')
|
||||||
expect(ZoomGateway.enable_recordings?).to be_truthy
|
expect(ZoomGateway.enable_recordings?).to be_truthy
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is falsey otherwise' do
|
it 'is falsey otherwise' do
|
||||||
stub_env_variable('ZOOM_ENABLE_RECORDINGS', '1')
|
stub_env_variable('ZOOM_ENABLE_RECORDINGS', '0')
|
||||||
expect(ZoomGateway.enable_recordings?).to be_falsey
|
expect(ZoomGateway.enable_recordings?).to be_falsey
|
||||||
|
|
||||||
stub_env_variable('ZOOM_ENABLE_RECORDINGS', 'false')
|
stub_env_variable('ZOOM_ENABLE_RECORDINGS', '2')
|
||||||
expect(ZoomGateway.enable_recordings?).to be_falsey
|
expect(ZoomGateway.enable_recordings?).to be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context '.ACCOUNT_NUMBER' do
|
|
||||||
it 'depends on ENV["ZOOM_ACCOUNT_NUMBER"]' do
|
|
||||||
stub_env_variable('ZOOM_ACCOUNT_NUMBER', 'xxx-yyy-zzz')
|
|
||||||
expect(ZoomGateway.ACCOUNT_NUMBER).to eq('xxx-yyy-zzz')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".find_meeting" do
|
describe ".find_meeting" do
|
||||||
@@ -124,7 +117,9 @@ RSpec.describe ZoomGateway do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'raises an exception' do
|
it 'raises an exception' do
|
||||||
stub_env_variables(ZOOM_USER_TYPE: 'pro', ZOOM_PRO_USERS_LIMIT: 2)
|
allow(ENV).to receive(:[]).and_call_original
|
||||||
|
allow(ENV).to receive(:[]).with('ZOOM_USER_TYPE').and_return('pro')
|
||||||
|
allow(ENV).to receive(:[]).with('ZOOM_PRO_USERS_LIMIT').and_return('2')
|
||||||
|
|
||||||
expect { gateway.create_host('host-email@address') }.to raise_error(ZoomGateway::TooManyHosts)
|
expect { gateway.create_host('host-email@address') }.to raise_error(ZoomGateway::TooManyHosts)
|
||||||
end
|
end
|
||||||
@@ -138,4 +133,11 @@ RSpec.describe ZoomGateway do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def stub_env_variable(name, value)
|
||||||
|
allow(ENV).to receive(:[]).and_call_original
|
||||||
|
allow(ENV).to receive(:[]).with(name.to_s).and_return(value.to_s)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -147,4 +147,10 @@ describe AppHost do
|
|||||||
expect(app_domain.protocol).to eq :http
|
expect(app_domain.protocol).to eq :http
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def stub_env(key, value)
|
||||||
|
allow(ENV).to receive(:fetch).with(key).and_return(value)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ RSpec.describe Project, type: :model do
|
|||||||
|
|
||||||
context 'there is no meeting' do
|
context 'there is no meeting' do
|
||||||
context 'there is a free user available' do
|
context 'there is a free user available' do
|
||||||
let!(:free_zoom_user) { create(:zoom_user, :with_api_id) }
|
let!(:free_zoom_user) { create(:zoom_user, api_id: 'user_id') }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(ZoomGateway).to receive(:create_meeting).and_return('new-meeting-id')
|
allow_any_instance_of(ZoomGateway).to receive(:create_meeting).and_return('new-meeting-id')
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
require 'zoom_gateway'
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe ZoomUser, type: :model do
|
RSpec.describe ZoomUser, type: :model do
|
||||||
@@ -6,10 +5,6 @@ RSpec.describe ZoomUser, type: :model do
|
|||||||
it { is_expected.to have_many(:zoom_meetings).dependent(:nullify) }
|
it { is_expected.to have_many(:zoom_meetings).dependent(:nullify) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "enums" do
|
|
||||||
it { is_expected.to define_enum_for(:tier).with_values([:basic, :pro]) }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'callbacks' do
|
describe 'callbacks' do
|
||||||
let(:zoom_user) { build(:zoom_user) }
|
let(:zoom_user) { build(:zoom_user) }
|
||||||
|
|
||||||
@@ -27,120 +22,10 @@ RSpec.describe ZoomUser, type: :model do
|
|||||||
zoom_user.save
|
zoom_user.save
|
||||||
expect(zoom_user.api_id).to eq "retrieved_api_id"
|
expect(zoom_user.api_id).to eq "retrieved_api_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'assigns current account number' do
|
|
||||||
allow_any_instance_of(ZoomGateway).to receive(:create_host).and_return("retrieved_api_id")
|
|
||||||
ENV['ZOOM_ACCOUNT_NUMBER'] = 'xxx-yyy-zzz'
|
|
||||||
|
|
||||||
zoom_user.save
|
|
||||||
expect(zoom_user.account_number).to eq 'xxx-yyy-zzz'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context '#before_destroy' do
|
context '#before_destroy' do
|
||||||
pending 'aborts if there is api_id assigned'
|
pending 'aborts if there is api_id assigned'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'scopes' do
|
|
||||||
context '.current_account' do
|
|
||||||
before do
|
|
||||||
create_list(:zoom_user, 10, :with_api_id, account_number: 'first-account-id')
|
|
||||||
create_list(:zoom_user, 25, :with_api_id, account_number: 'second-account-id')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'only returns users from currently set account' do
|
|
||||||
ENV['ZOOM_ACCOUNT_NUMBER'] = 'first-account-id'
|
|
||||||
expect(ZoomUser.current_account.count).to eq 10
|
|
||||||
expect(ZoomUser.current_account.pluck(:account_number).uniq.count).to eq 1
|
|
||||||
expect(ZoomUser.current_account.pluck(:account_number).uniq.first).to eq 'first-account-id'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context '.free' do
|
|
||||||
let(:free_user) { create(:zoom_user, :with_api_id) }
|
|
||||||
let(:busy_user) { create(:zoom_user, :with_api_id) }
|
|
||||||
let(:second_busy_user) { create(:zoom_user, :with_api_id) }
|
|
||||||
let!(:meeting_started) { create(:zoom_meeting, zoom_user: busy_user, status: :started) }
|
|
||||||
let!(:meeting_created) { create(:zoom_meeting, zoom_user: second_busy_user, status: :created) }
|
|
||||||
|
|
||||||
it 'returns only the users without started / created meetings' do
|
|
||||||
users = ZoomUser.free
|
|
||||||
|
|
||||||
expect(users).to include(free_user)
|
|
||||||
expect(users).not_to include(busy_user)
|
|
||||||
expect(users).not_to include(second_busy_user)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
describe '.current_account?' do
|
|
||||||
let(:zoom_user) { create(:zoom_user, :with_api_id, account_number: 'xxx-xxx-xxx') }
|
|
||||||
|
|
||||||
it 'returns true if it belongs to currently set account' do
|
|
||||||
ENV['ZOOM_ACCOUNT_NUMBER'] = 'xxx-xxx-xxx'
|
|
||||||
expect(zoom_user.current_account?).to be_truthy
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'returns false if it doesn\'t belong to currently set account' do
|
|
||||||
ENV['ZOOM_ACCOUNT_NUMBER'] = 'yyy-yyy-yyy'
|
|
||||||
expect(zoom_user.current_account?).to be_falsey
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
context 'static methods' do
|
|
||||||
describe '.generate_api_email' do
|
|
||||||
it 'contains @' do
|
|
||||||
expect(ZoomUser.generate_api_email).to include('@')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '.for_new_meeting' do
|
|
||||||
let(:a_basic) { create(:zoom_user, :with_api_id, account_number: 'aaa', tier: :basic) }
|
|
||||||
let(:b_basic) { create(:zoom_user, :with_api_id, account_number: 'bbb', tier: :basic) }
|
|
||||||
let(:a_pro) { create(:zoom_user, :with_api_id, account_number: 'aaa', tier: :pro) }
|
|
||||||
let(:b_pro) { create(:zoom_user, :with_api_id, account_number: 'bbb', tier: :pro) }
|
|
||||||
|
|
||||||
it 'picks free user of requested type from current account' do
|
|
||||||
[a_basic, a_pro, b_basic, b_pro]
|
|
||||||
|
|
||||||
stub_env_variables(ZOOM_USER_TYPE: 'basic', ZOOM_ACCOUNT_NUMBER: 'aaa')
|
|
||||||
expect(ZoomUser.for_new_meeting).to eq(a_basic)
|
|
||||||
|
|
||||||
stub_env_variables(ZOOM_USER_TYPE: 'pro', ZOOM_ACCOUNT_NUMBER: 'aaa')
|
|
||||||
expect(ZoomUser.for_new_meeting).to eq(a_pro)
|
|
||||||
|
|
||||||
stub_env_variables(ZOOM_USER_TYPE: 'basic', ZOOM_ACCOUNT_NUMBER: 'bbb')
|
|
||||||
expect(ZoomUser.for_new_meeting).to eq(b_basic)
|
|
||||||
|
|
||||||
stub_env_variables(ZOOM_USER_TYPE: 'pro', ZOOM_ACCOUNT_NUMBER: 'bbb')
|
|
||||||
expect(ZoomUser.for_new_meeting).to eq(b_pro)
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'no free user' do
|
|
||||||
before do
|
|
||||||
allow_any_instance_of(ZoomGateway).to receive(:create_host).and_return('host-id')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'creates new user if there is no requested user free available under account' do
|
|
||||||
[a_basic, a_pro, b_basic]
|
|
||||||
stub_env_variables(ZOOM_USER_TYPE: 'pro', ZOOM_ACCOUNT_NUMBER: 'bbb')
|
|
||||||
|
|
||||||
expect_any_instance_of(ZoomGateway).to receive(:create_host)
|
|
||||||
ZoomUser.for_new_meeting
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'creates new user if requested user is busy' do
|
|
||||||
[a_basic, a_pro, b_basic, b_pro]
|
|
||||||
stub_env_variables(ZOOM_USER_TYPE: 'pro', ZOOM_ACCOUNT_NUMBER: 'aaa')
|
|
||||||
create(:zoom_meeting, zoom_user: a_pro, status: :started)
|
|
||||||
|
|
||||||
expect_any_instance_of(ZoomGateway).to receive(:create_host)
|
|
||||||
ZoomUser.for_new_meeting
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
module EnvHelper
|
|
||||||
def stub_env_variables(vars)
|
|
||||||
allow(ENV).to receive(:[]).and_call_original
|
|
||||||
vars.each do |variable, value|
|
|
||||||
allow(ENV).to receive(:[]).with(variable.to_s).and_return(value)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def stub_env_variable(key, value)
|
|
||||||
stub_env_variables({key => value})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
RSpec.configure do |config|
|
|
||||||
config.include EnvHelper
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user