Compare commits

...

3 Commits

Author SHA1 Message Date
Bilal
62ef25e511 fix casting submission view page 2020-07-23 12:12:45 +02:00
Bilal
b82aaf77ff remove specs related to zoom url validation 2020-07-22 14:13:04 +02:00
Bilal
e08dd36d68 remove zoom url validation 2020-07-22 14:05:31 +02:00
7 changed files with 37 additions and 110 deletions

View File

@@ -6,34 +6,10 @@ class CastingSubmission < ApplicationRecord
has_secure_token
validates :performer_name, presence: true
validate :zoom_meeting_url_validation
scope :completed, -> { where.not(interviewed_at: nil) }
def join_zoom_meeting_url
uri = URI.parse(self.zoom_meeting_url)
zoom_meeting_id = uri.path.gsub("/j/", "")
zoom_meeting_pwd = uri.query.gsub("pwd=", "")
"zoommtg://zoom.us/join?confno=#{zoom_meeting_id}&pwd=#{zoom_meeting_pwd}"
end
def zip_file_name
"#{self.casting_call.title.parameterize}_#{self.performer_name.parameterize}_#{Time.now.strftime('%Y-%m-%d_%H-%M-%S')}"
end
def zoom_meeting_url_validation
# valid url format :
# https://us01web.zoom.us/j/12345?pwd=Ab103odw3ok343ko
valid_url_regex = %r{^https\://[a-z0-9]+\.zoom.us/j/[0-9]+\?pwd\=.+}
return true if zoom_meeting_url.match valid_url_regex
errors.add(:base, invalid_meeting_url_message)
end
private
def invalid_meeting_url_message
I18n.t('casting_submissions.validation_errors.invalid_meeting_url')
end
end

View File

@@ -45,7 +45,7 @@
</div>
</div>
<div class="row align-items-center justify-content-center mt-3">
<%= link_to "Start Interview", @casting_submission.join_zoom_meeting_url, target: "_blank", class: "btn btn-primary" %>
<%= link_to "Start Interview", @casting_submission.zoom_meeting_url, target: "_blank", class: "btn btn-primary" %>
</div>
</div>
</div>

View File

@@ -283,13 +283,6 @@ en:
empty: Casting Submission results will appear here.
show:
empty: Casting Submission files and recorded meeetings will appear here.
casting_submissions:
index:
empty: Casting Submission results will appear here.
show:
empty: Casting Submission files and recorded meeetings will appear here.
validation_errors:
invalid_meeting_url: Zoom Meeting URL is invalid
contract_downloads:
download:
failure: Your download could not be generated.

View File

@@ -76,9 +76,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
casting_submissions:
validation_errors:
invalid_meeting_url: Zoom Meeting URL is invalid (ES)
contract_templates:
blank_contracts:
create:

View File

@@ -9,20 +9,6 @@ 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: -
--
@@ -331,8 +317,8 @@ CREATE TABLE public.appearance_releases (
person_last_name character varying,
guardian_first_name character varying,
guardian_last_name character varying,
guardian_email character varying,
identifier character varying,
guardian_email character varying,
person_address_street2 character varying,
person_address_city character varying,
person_address_state character varying,
@@ -742,15 +728,6 @@ CREATE SEQUENCE public.contract_templates_id_seq
ALTER SEQUENCE public.contract_templates_id_seq OWNED BY public.contract_templates.id;
--
-- Name: data_migrations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.data_migrations (
version character varying NOT NULL
);
--
-- Name: directories; Type: TABLE; Schema: public; Owner: -
--
@@ -1492,6 +1469,7 @@ CREATE TABLE public.settings (
--
CREATE SEQUENCE public.settings_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -1527,6 +1505,7 @@ CREATE TABLE public.taggings (
--
CREATE SEQUENCE public.taggings_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -1557,6 +1536,7 @@ CREATE TABLE public.tags (
--
CREATE SEQUENCE public.tags_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
@@ -1917,9 +1897,9 @@ CREATE TABLE public.zoom_meetings (
api_meeting_id character varying,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
status integer DEFAULT 0,
zoom_user_id bigint,
project_id bigint
project_id bigint,
status integer DEFAULT 0
);
@@ -2426,14 +2406,6 @@ ALTER TABLE ONLY public.contract_templates
ADD CONSTRAINT contract_templates_pkey PRIMARY KEY (id);
--
-- Name: data_migrations data_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.data_migrations
ADD CONSTRAINT data_migrations_pkey PRIMARY KEY (version);
--
-- Name: directories directories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

View File

@@ -37,16 +37,6 @@ RSpec.describe Admin::CastingSubmissionsController, type: :controller do
post :create, params: { casting_submission: casting_submission_params }
}.to change(CastingSubmission, :count)
end
it "does not create new record if zoom meeting url is not valid" do
expect {
post :create, params: {
casting_submission: casting_submission_params
.except(:zoom_meeting_url)
.merge(zoom_meeting_url: "malformed_url")
}
}.to change(CastingSubmission, :count).by(0)
end
end
describe "#edit" do

View File

@@ -8,37 +8,6 @@ feature "Admin managing casting submissions" do
sign_in current_user
end
scenario "admin cannot create casting submission with invalid zoom url", js: true do
visit admin_casting_submissions_path
cc = create(:casting_call, title: "SpecialCastingCall")
click_link create_casting_submission_button
expect(page).to have_content new_casting_submission_heading
fill_in performer_name_field, with: "TestName"
select cc.title, from: casting_call_field
fill_in zoom_meeting_url_field, with: "malformed url"
expect do
click_on submit_casting_submission_form
end.to change(CastingSubmission, :count).by(0)
expect(page).to have_content zoom_meeting_url_invalid_error
fill_in zoom_meeting_url_field, with: "https://similar.google.com/j/24324324?pwd=334kni3j4"
expect do
click_on submit_casting_submission_form
end.to change(CastingSubmission, :count).by(0)
expect(page).to have_content zoom_meeting_url_invalid_error
fill_in zoom_meeting_url_field, with: "https://s01.zoom.us/j/343434?pwd=dawidj34ijij"
expect do
click_on submit_casting_submission_form
end.to change(CastingSubmission, :count).by(1)
expect(page).to have_content create_casting_submission_button
end
scenario "when creating new casting call interview - interview recording field is not visible" do
visit admin_casting_submissions_path
@@ -78,6 +47,20 @@ feature "Admin managing casting submissions" do
expect(page).to have_link CastingSubmission.last.interview_recording.attachment.blob.filename.to_s
end
scenario "when admin opens view page for casting submission, it does not fail if zoom meeting URL is invalid" do
cc = create(:casting_call)
cci = create(:casting_submission, casting_call: cc, zoom_meeting_url: "anything")
visit admin_casting_submissions_path
click_on manage_button
click_link view_link
expect(page).to have_content casting_submission_details_header
expect(page).to have_content interview_files_label
expect(page).to have_content cci.performer_name
end
private
def create_casting_submission_button
@@ -127,4 +110,20 @@ feature "Admin managing casting submissions" do
def current_interview_recording_label
'Current interview recording'
end
def manage_button
'Manage'
end
def view_link
'View'
end
def casting_submission_details_header
'Casting submission details'
end
def interview_files_label
'INTERVIEW FILES:'
end
end