Compare commits

..

1 Commits

Author SHA1 Message Date
Senad Uka
6a2fb533cb Directmeba 2020-06-29 10:42:08 +02:00
22 changed files with 171 additions and 187 deletions

View File

@@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "2.6.3"
# Bundle edge Rails instead: gem "rails", github: "rails/rails"
gem "rails", "~> 6.0.3.1"
gem "rails", "~> 6.0.0"
# Use postgresql as the database for Active Record
gem "pg", "~> 0.18"
# Use Puma as the app server

View File

@@ -44,71 +44,71 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.0.3)
actioncable (6.0.3.2)
actionpack (= 6.0.3.2)
actioncable (6.0.0)
actionpack (= 6.0.0)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.2)
actionpack (= 6.0.3.2)
activejob (= 6.0.3.2)
activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
actionmailbox (6.0.0)
actionpack (= 6.0.0)
activejob (= 6.0.0)
activerecord (= 6.0.0)
activestorage (= 6.0.0)
activesupport (= 6.0.0)
mail (>= 2.7.1)
actionmailer (6.0.3.2)
actionpack (= 6.0.3.2)
actionview (= 6.0.3.2)
activejob (= 6.0.3.2)
actionmailer (6.0.0)
actionpack (= 6.0.0)
actionview (= 6.0.0)
activejob (= 6.0.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.3.2)
actionview (= 6.0.3.2)
activesupport (= 6.0.3.2)
rack (~> 2.0, >= 2.0.8)
actionpack (6.0.0)
actionview (= 6.0.0)
activesupport (= 6.0.0)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3.2)
actionpack (= 6.0.3.2)
activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
actiontext (6.0.0)
actionpack (= 6.0.0)
activerecord (= 6.0.0)
activestorage (= 6.0.0)
activesupport (= 6.0.0)
nokogiri (>= 1.8.5)
actionview (6.0.3.2)
activesupport (= 6.0.3.2)
actionview (6.0.0)
activesupport (= 6.0.0)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_storage_base64 (1.0.0)
rails (~> 6.0)
activejob (6.0.3.2)
activesupport (= 6.0.3.2)
activejob (6.0.0)
activesupport (= 6.0.0)
globalid (>= 0.3.6)
activemodel (6.0.3.2)
activesupport (= 6.0.3.2)
activemodel (6.0.0)
activesupport (= 6.0.0)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (6.0.3.2)
activemodel (= 6.0.3.2)
activesupport (= 6.0.3.2)
activerecord (6.0.0)
activemodel (= 6.0.0)
activesupport (= 6.0.0)
activeresource (5.1.0)
activemodel (>= 5.0, < 7)
activemodel-serializers-xml (~> 1.0)
activesupport (>= 5.0, < 7)
activestorage (6.0.3.2)
actionpack (= 6.0.3.2)
activejob (= 6.0.3.2)
activerecord (= 6.0.3.2)
activestorage (6.0.0)
actionpack (= 6.0.0)
activejob (= 6.0.0)
activerecord (= 6.0.0)
marcel (~> 0.3.1)
activesupport (6.0.3.2)
activesupport (6.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
zeitwerk (~> 2.1, >= 2.1.8)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
afm (0.2.2)
@@ -181,7 +181,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.6)
concurrent-ruby (1.1.5)
connection_pool (2.2.2)
countries (2.1.4)
i18n_data (~> 0.8.0)
@@ -230,7 +230,7 @@ GEM
hubspot-ruby (0.9.0)
activesupport (>= 3.0.0)
httparty (>= 0.10.0)
i18n (1.8.3)
i18n (1.8.2)
concurrent-ruby (~> 1.0)
i18n_data (0.8.0)
i18n_yaml_sorter (0.2.0)
@@ -270,22 +270,22 @@ GEM
ruby_dep (~> 1.2)
loaf (0.8.1)
rails (>= 3.2)
loofah (2.6.0)
loofah (2.4.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (1.0.0)
method_source (0.9.2)
mime-types (3.3)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0904)
mimemagic (0.3.5)
mimemagic (0.3.3)
mini_magick (4.9.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.1)
minitest (5.14.0)
monetize (1.9.2)
money (~> 6.12)
money (6.13.4)
@@ -298,8 +298,8 @@ GEM
msgpack (1.3.1)
multi_xml (0.6.0)
multipart-post (2.1.1)
nio4r (2.5.2)
nokogiri (1.10.9)
nio4r (2.5.1)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
oath (1.1.0)
bcrypt
@@ -337,20 +337,20 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.0.3.2)
actioncable (= 6.0.3.2)
actionmailbox (= 6.0.3.2)
actionmailer (= 6.0.3.2)
actionpack (= 6.0.3.2)
actiontext (= 6.0.3.2)
actionview (= 6.0.3.2)
activejob (= 6.0.3.2)
activemodel (= 6.0.3.2)
activerecord (= 6.0.3.2)
activestorage (= 6.0.3.2)
activesupport (= 6.0.3.2)
rails (6.0.0)
actioncable (= 6.0.0)
actionmailbox (= 6.0.0)
actionmailer (= 6.0.0)
actionpack (= 6.0.0)
actiontext (= 6.0.0)
actionview (= 6.0.0)
activejob (= 6.0.0)
activemodel (= 6.0.0)
activerecord (= 6.0.0)
activestorage (= 6.0.0)
activesupport (= 6.0.0)
bundler (>= 1.3.0)
railties (= 6.0.3.2)
railties (= 6.0.0)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
@@ -363,9 +363,9 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (6.0.3.2)
actionpack (= 6.0.3.2)
activesupport (= 6.0.3.2)
railties (6.0.0)
actionpack (= 6.0.0)
activesupport (= 6.0.0)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
@@ -469,7 +469,7 @@ GEM
turbolinks-source (5.2.0)
typhoeus (1.3.1)
ethon (>= 0.9.0)
tzinfo (1.2.7)
tzinfo (1.2.6)
thread_safe (~> 0.1)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
@@ -494,9 +494,9 @@ GEM
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
websocket-driver (0.7.2)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
websocket-extensions (0.1.4)
will_paginate (3.2.1)
will_paginate-bootstrap4 (0.2.2)
will_paginate (~> 3.0, >= 3.0.0)
@@ -504,7 +504,7 @@ GEM
wkhtmltopdf-heroku (2.12.5.0)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.3.1)
zeitwerk (2.2.2)
PLATFORMS
ruby
@@ -561,7 +561,7 @@ DEPENDENCIES
rack!
rack-contrib (~> 2.0.1)
rack-cors
rails (~> 6.0.3.1)
rails (~> 6.0.0)
rails-controller-testing (~> 1.0.4)
rails-data-migrations (~> 1.2.0)
redcarpet (~> 3.4.0)

View File

@@ -12,7 +12,7 @@ class AcquiredMediaReleasePolicy < ApplicationPolicy
end
def destroy?
user.manager? || user.account_manager?
true
end
def tag_multiple?

View File

@@ -16,7 +16,7 @@ class AppearanceReleasePolicy < ReleasePolicy
end
def destroy?
user.manager? || user.account_manager?
true
end
def tag_multiple?

View File

@@ -16,7 +16,7 @@ class LocationReleasePolicy < ReleasePolicy
end
def destroy?
user.manager? || user.account_manager?
true
end
def edit_photos?

View File

@@ -16,7 +16,7 @@ class MaterialReleasePolicy < ReleasePolicy
end
def destroy?
user.manager? || user.account_manager?
true
end
def edit_photos?

View File

@@ -12,7 +12,7 @@ class MedicalReleasePolicy < ReleasePolicy
end
def destroy?
user.manager? || user.account_manager?
true
end
def edit_photos?

View File

@@ -12,7 +12,7 @@ class MiscReleasePolicy < ReleasePolicy
end
def destroy?
user.manager? || user.account_manager?
true
end
def edit_photos?

View File

@@ -12,7 +12,7 @@ class MusicReleasePolicy < ReleasePolicy
end
def destroy?
user.manager? || user.account_manager?
true
end
def tag_multiple?

View File

@@ -12,7 +12,7 @@ class TalentReleasePolicy < ReleasePolicy
end
def destroy?
user.manager? || user.account_manager?
true
end
def edit_photos?

View File

@@ -33,7 +33,7 @@
<%= link_to "Switch View", "#", class: "btn btn-light border dropdown-toggle", role: "button", id: "dropdownMenuLink", data: { toggle: "dropdown" }, aria: { haspopup: "true", expanded: "false" } %>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<h5 class="dropdown-header">Live Streams</h5>
<span class="dropdown-item active"><%= fa_icon("check", text: @broadcast.name.titleize) %></span>
<%= link_to fa_icon("check", text: @broadcast.name.titleize), "#", class: "dropdown-item active" %>
<% @multi_view_broadcasts.each do |broadcast| %>
<% if broadcast.id != @broadcast.id %>
<%= link_to broadcast.name.titleize, broadcast.url, class: class_string("dropdown-item", "active" => @broadcast.id == broadcast.id) %>
@@ -159,4 +159,4 @@
</div>
</div>
</div>
<div>
</div>

View File

@@ -9,6 +9,20 @@ 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: -
--
@@ -290,7 +304,7 @@ ALTER SEQUENCE public.active_storage_blobs_id_seq OWNED BY public.active_storage
CREATE TABLE public.appearance_releases (
id bigint NOT NULL,
person_name_old character varying,
person_address_street1 character varying,
person_address_old character varying,
person_phone character varying,
project_id bigint,
created_at timestamp without time zone NOT NULL,
@@ -319,6 +333,7 @@ CREATE TABLE public.appearance_releases (
guardian_last_name character varying,
identifier character varying,
guardian_email character varying,
person_address_street1 character varying,
person_address_street2 character varying,
person_address_city character varying,
person_address_state character varying,
@@ -1378,7 +1393,6 @@ CREATE TABLE public.settings (
--
CREATE SEQUENCE public.settings_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -1414,7 +1428,6 @@ CREATE TABLE public.taggings (
--
CREATE SEQUENCE public.taggings_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -1445,7 +1458,6 @@ CREATE TABLE public.tags (
--
CREATE SEQUENCE public.tags_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -3808,6 +3820,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200612121539'),
('20200615131722'),
('20200615133602'),
('20200615140920'),
('20200616124214'),
('20200619081446'),
('20200619085823'),

View File

@@ -54,6 +54,46 @@ feature "User managing broadcasts" do
expect(page).to have_content(recording.download_file_name)
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)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content broadcast.name.titleize, count: 1
expect(page).to have_content recording.download_file_name, count: 0
click_on switch_view_dropdown
expect(page).to have_content broadcast.name.titleize, count: 2
expect(page).to have_content recording.download_file_name, count: 1
live_stream_nav_item = page.find(".dropdown-item", text: broadcast.name.titleize)
recording_nav_item = page.find(".dropdown-item", text: recording.download_file_name)
expect(live_stream_nav_item[:class].include?("active")).to eq true
expect(recording_nav_item[:class].include?("active")).to eq false
click_on recording.download_file_name
expect(page).to have_content broadcast.name.titleize, count: 1
expect(page).to have_content recording.download_file_name, count: 0
expect(live_stream_nav_item[:class].include?("active")).to eq false
expect(recording_nav_item[:class].include?("active")).to eq true
click_on switch_view_dropdown
click_on broadcast.name.titleize
expect(page).to have_content broadcast.name.titleize, count: 1
expect(page).to have_content recording.download_file_name, count: 0
# Page is reloaded, we need to get dropdown items again
live_stream_nav_item = page.find(".dropdown-item", text: broadcast.name.titleize, visible: :all)
recording_nav_item = page.find(".dropdown-item", text: recording.download_file_name, visible: :all)
expect(live_stream_nav_item[:class].include?("active")).to eq true
expect(recording_nav_item[:class].include?("active")).to eq false
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)
@@ -74,9 +114,9 @@ feature "User managing broadcasts" do
new_window = window_opened_by { click_link "Multi-View" }
within_window new_window do
expect(page).to have_content("Switch View")
expect(page).to have_content switch_view_dropdown
click_on "Switch View"
click_on switch_view_dropdown
expect(page).to have_link("Broadcast 1")
expect(page).to have_link("Broadcast 2")
@@ -106,4 +146,8 @@ feature "User managing broadcasts" do
all('input[type="checkbox"]')[0].click
all('input[type="checkbox"]')[1].click
end
def switch_view_dropdown
"Switch View"
end
end

View File

@@ -133,8 +133,7 @@ RSpec.describe Account do
ZoomMeeting,
MedicalRelease,
MiscRelease,
MatchingRequest,
ActionMailbox::InboundEmail # This is Rails model, we are not using it and it is NOT added to the Account#storage_total calculation
MatchingRequest
]
Rails.application.eager_load!
ActiveRecord::Base.descendants.each do |model|

View File

@@ -1,8 +1,7 @@
require "rails_helper"
describe AcquiredMediaReleasePolicy do
let(:user) { create(:user, :manager) }
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
let(:user_context) { build(:user_context) }
subject { described_class }
@@ -25,14 +24,6 @@ describe AcquiredMediaReleasePolicy do
end
permissions :destroy? do
it { is_expected.to permit(user_context, :destroy) }
end
context "for an associate" do
let(:user) { create(:user, :associate) }
permissions :destroy? do
it { is_expected.not_to permit(user_context, :destroy) }
end
it { is_expected.to permit(:destroy) }
end
end

View File

@@ -1,8 +1,7 @@
require "rails_helper"
describe AppearanceReleasePolicy do
let(:user) { create(:user, :manager) }
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
let(:user_context) { build(:user_context) }
subject { described_class }
@@ -25,14 +24,6 @@ describe AppearanceReleasePolicy do
end
permissions :destroy? do
it { is_expected.to permit(user_context, :destroy) }
end
context "for an associate" do
let(:user) { create(:user, :associate) }
permissions :destroy? do
it { is_expected.not_to permit(user_context, :destroy) }
end
it { is_expected.to permit(:destroy) }
end
end

View File

@@ -1,8 +1,7 @@
require "rails_helper"
describe LocationReleasePolicy do
let(:user) { create(:user, :manager) }
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
let(:user_context) { build(:user_context) }
subject { described_class }
@@ -24,6 +23,10 @@ describe LocationReleasePolicy do
end
end
permissions :destroy? do
it { is_expected.to permit(:destroy) }
end
permissions :edit_photos? do
it { is_expected.to permit(:edit_photos) }
end
@@ -31,16 +34,4 @@ describe LocationReleasePolicy do
permissions :update_photos? do
it { is_expected.to permit(:update_photos) }
end
permissions :destroy? do
it { is_expected.to permit(user_context, :destroy) }
end
context "for an associate" do
let(:user) { create(:user, :associate) }
permissions :destroy? do
it { is_expected.not_to permit(user_context, :destroy) }
end
end
end

View File

@@ -1,8 +1,7 @@
require "rails_helper"
describe MaterialReleasePolicy do
let(:user) { create(:user, :manager) }
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
let(:user_context) { build(:user_context) }
subject { described_class }
@@ -24,6 +23,10 @@ describe MaterialReleasePolicy do
end
end
permissions :destroy? do
it { is_expected.to permit(:destroy) }
end
permissions :edit_photos? do
it { is_expected.to permit(:edit_photos) }
end
@@ -31,16 +34,4 @@ describe MaterialReleasePolicy do
permissions :update_photos? do
it { is_expected.to permit(:update_photos) }
end
permissions :destroy? do
it { is_expected.to permit(user_context, :destroy) }
end
context "for an associate" do
let(:user) { create(:user, :associate) }
permissions :destroy? do
it { is_expected.not_to permit(user_context, :destroy) }
end
end
end

View File

@@ -1,8 +1,7 @@
require "rails_helper"
describe MedicalReleasePolicy do
let(:user) { create(:user, :manager) }
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
let(:user_context) { build(:user_context) }
subject { described_class }
@@ -24,6 +23,10 @@ describe MedicalReleasePolicy do
end
end
permissions :destroy? do
it { is_expected.to permit(:destroy) }
end
permissions :edit_photos? do
it { is_expected.to permit(:edit_photos) }
end
@@ -31,16 +34,4 @@ describe MedicalReleasePolicy do
permissions :update_photos? do
it { is_expected.to permit(:update_photos) }
end
permissions :destroy? do
it { is_expected.to permit(user_context, :destroy) }
end
context "for an associate" do
let(:user) { create(:user, :associate) }
permissions :destroy? do
it { is_expected.not_to permit(user_context, :destroy) }
end
end
end

View File

@@ -1,8 +1,7 @@
require "rails_helper"
describe MiscReleasePolicy do
let(:user) { create(:user, :manager) }
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
let(:user_context) { build(:user_context) }
subject { described_class }
@@ -20,6 +19,10 @@ describe MiscReleasePolicy do
end
end
permissions :destroy? do
it { is_expected.to permit(:destroy) }
end
permissions :edit_photos? do
it { is_expected.to permit(:edit_photos) }
end
@@ -27,16 +30,4 @@ describe MiscReleasePolicy do
permissions :update_photos? do
it { is_expected.to permit(:update_photos) }
end
permissions :destroy? do
it { is_expected.to permit(user_context, :destroy) }
end
context "for an associate" do
let(:user) { create(:user, :associate) }
permissions :destroy? do
it { is_expected.not_to permit(user_context, :destroy) }
end
end
end

View File

@@ -1,8 +1,7 @@
require "rails_helper"
RSpec.describe MusicReleasePolicy do
let(:user) { create(:user, :manager) }
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
let(:user_context) { build(:user_context) }
subject { described_class }
@@ -19,14 +18,6 @@ RSpec.describe MusicReleasePolicy do
end
permissions :destroy? do
it { is_expected.to permit(user_context, :destroy) }
end
context "for an associate" do
let(:user) { create(:user, :associate) }
permissions :destroy? do
it { is_expected.not_to permit(user_context, :destroy) }
end
it { is_expected.to permit(:destroy) }
end
end

View File

@@ -1,8 +1,7 @@
require "rails_helper"
describe TalentReleasePolicy do
let(:user) { create(:user, :manager) }
let(:user_context) { build(:user_context, user: user, account: user.primary_account) }
let(:user_context) { build(:user_context) }
subject { described_class }
@@ -24,6 +23,10 @@ describe TalentReleasePolicy do
end
end
permissions :destroy? do
it { is_expected.to permit(:destroy) }
end
permissions :edit_photos? do
it { is_expected.to permit(:edit_photos) }
end
@@ -31,16 +34,4 @@ describe TalentReleasePolicy do
permissions :update_photos? do
it { is_expected.to permit(:update_photos) }
end
permissions :destroy? do
it { is_expected.to permit(user_context, :destroy) }
end
context "for an associate" do
let(:user) { create(:user, :associate) }
permissions :destroy? do
it { is_expected.not_to permit(user_context, :destroy) }
end
end
end