From 9e574b33e81b507b625364ddd592dd4f6cf8af18 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Tue, 29 Jul 2014 23:04:28 -0500 Subject: [PATCH 01/16] * VRFS-1916 - two tables were used instead of one --- web/app/assets/javascripts/findSession.js | 4 ++-- web/app/views/clients/_sessionList.html.erb | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/web/app/assets/javascripts/findSession.js b/web/app/assets/javascripts/findSession.js index 2d8141a8e..80e0fa67f 100644 --- a/web/app/assets/javascripts/findSession.js +++ b/web/app/assets/javascripts/findSession.js @@ -273,11 +273,11 @@ } function clearResults() { - $('table#sessions-active').empty(); + $('table#sessions-active').find("tr:gt(0)").remove(); currentScheduledSessionsPage = 0; $ssScroller.infinitescroll('resume'); - $('table#sessions-scheduled').empty(); + $('table#sessions-scheduled').find("tr:gt(0)").remove(); $ssNoMoreEntries.hide(); } diff --git a/web/app/views/clients/_sessionList.html.erb b/web/app/views/clients/_sessionList.html.erb index 6a8ac17b3..d5d34f228 100644 --- a/web/app/views/clients/_sessionList.html.erb +++ b/web/app/views/clients/_sessionList.html.erb @@ -1,7 +1,7 @@

<%= title %>


- +
@@ -12,7 +12,4 @@
SESSION
- - -
\ No newline at end of file From 45ef4d05e3c829a3d1d67fb4da14eb1e3461386b Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 30 Jul 2014 08:41:47 -0500 Subject: [PATCH 02/16] VRFS-1989 - update to ftue video links --- web/app/controllers/users_controller.rb | 8 ++++---- .../views/clients/wizard/gear/_gear_wizard.html.haml | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/web/app/controllers/users_controller.rb b/web/app/controllers/users_controller.rb index 212a8e12b..c2d92c062 100644 --- a/web/app/controllers/users_controller.rb +++ b/web/app/controllers/users_controller.rb @@ -197,11 +197,11 @@ class UsersController < ApplicationController @slides = [ Slide.new("JamKazam Overview", "web/carousel_musicians.jpg", "http://www.youtube.com/embed/ylYcvTY9CVo?autoplay=1"), - Slide.new("Getting Started", "web/carousel_fans.jpg", "http://www.youtube.com/embed/VexH4834o9I?autoplay=1"), - Slide.new("Playing in a Session", "web/carousel_bands.jpg", "http://www.youtube.com/embed/ylYcvTY9CVo?autoplay=1"), + Slide.new("Getting Started", "web/carousel_fans.jpg", "http://www.youtube.com/embed/DBo--aj_P1w?autoplay=1"), + Slide.new("Playing in a Session", "web/carousel_bands.jpg", "http://www.youtube.com/embed/zJ68hA8-fLA?autoplay=1"), Slide.new("JamKazam Overview", "web/carousel_musicians.jpg", "http://www.youtube.com/embed/ylYcvTY9CVo?autoplay=1"), - Slide.new("Getting Started", "web/carousel_fans.jpg", "http://www.youtube.com/embed/VexH4834o9I?autoplay=1"), - Slide.new("Playing in a Session", "web/carousel_bands.jpg", "http://www.youtube.com/embed/ylYcvTY9CVo?autoplay=1") + Slide.new("Getting Started", "web/carousel_fans.jpg", "http://www.youtube.com/embed/DBo--aj_P1w?autoplay=1"), + Slide.new("Playing in a Session", "web/carousel_bands.jpg", "http://www.youtube.com/embed/zJ68hA8-fLA?autoplay=1") ] @promo_buzz = PromoBuzz.active diff --git a/web/app/views/clients/wizard/gear/_gear_wizard.html.haml b/web/app/views/clients/wizard/gear/_gear_wizard.html.haml index 37450ac88..44b4da12b 100644 --- a/web/app/views/clients/wizard/gear/_gear_wizard.html.haml +++ b/web/app/views/clients/wizard/gear/_gear_wizard.html.haml @@ -170,11 +170,11 @@ %h2 Tutorial Videos %ul %li - %a{href: '#'} Creating a Session + %a{href: 'https://www.youtube.com/watch?v=EZZuGcDUoWk', rel: 'external'} Creating a Session %li - %a{href: '#'} Finding a Session + %a{href: 'https://www.youtube.com/watch?v=xWponSJo-GU', rel: 'external'} Finding a Session %li - %a{href: '#'} Playing in a Session + %a{href: 'https://www.youtube.com/watch?v=zJ68hA8-fLA', rel: 'external'} Playing in a Session %li %a{href: '#'} Connecting with Other Musicians %li @@ -184,9 +184,9 @@ %h2 Other Valuable Resource Links %ul %li - %a{href: '#'} JamKazam Support Center + %a{href: 'https://jamkazam.desk.com/', rel: 'external'} JamKazam Support Center %li - %a{href: '#'} JamKazam Community Forum + %a{href: 'http://forums.jamkazam.com', rel: 'external'} JamKazam Community Forum .wizard-buttons %script{type: 'text/template', id: 'template-ftuesteps'} From 8966a3fc2f0cc9cffd7cead6f208dc25a23317e1 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 30 Jul 2014 15:11:03 -0500 Subject: [PATCH 03/16] * VRFS-1992 - check open_rsvps for daily session email, VRFS-1991 - remove hardcoded 10 in audio latency on create/join, VRFS-1990 - only send update rsvp notification if scheduled start time changes --- .../jam_ruby/models/active_music_session.rb | 6 +++--- .../models/email_batch_scheduled_sessions.rb | 3 +-- ruby/lib/jam_ruby/models/music_session.rb | 8 +++++++- .../email_batch_spec_scheduled_session.rb | 10 ++++++++++ .../spec/jam_ruby/models/music_session_spec.rb | 15 +++++++++++++++ web/app/assets/javascripts/jam_rest.js | 18 +----------------- web/app/assets/javascripts/wizard/gear_test.js | 2 +- .../assets/javascripts/wizard/gear_utils.js | 8 -------- .../api_music_sessions_controller.rb | 6 ++++-- web/app/controllers/api_scoring_controller.rb | 3 +++ web/app/controllers/api_users_controller.rb | 2 +- web/spec/features/profile_history_spec.rb | 1 + web/spec/support/app_config.rb | 4 ++++ 13 files changed, 51 insertions(+), 35 deletions(-) diff --git a/ruby/lib/jam_ruby/models/active_music_session.rb b/ruby/lib/jam_ruby/models/active_music_session.rb index edc98fd9f..b3640ec75 100644 --- a/ruby/lib/jam_ruby/models/active_music_session.rb +++ b/ruby/lib/jam_ruby/models/active_music_session.rb @@ -450,7 +450,7 @@ module JamRuby [music_sessions, user_scores] end - def self.participant_create user, music_session_id, client_id, as_musician, tracks + def self.participant_create user, music_session_id, client_id, as_musician, tracks, audio_latency music_session = MusicSession.find(music_session_id) if music_session.active_music_session @@ -462,7 +462,7 @@ module JamRuby active_music_session.with_lock do # VRFS-1297 active_music_session.tick_track_changes - connection = ConnectionManager.new.join_music_session(user, client_id, active_music_session, as_musician, tracks, 10) + connection = ConnectionManager.new.join_music_session(user, client_id, active_music_session, as_musician, tracks, audio_latency) if connection.errors.any? # rollback the transaction to make sure nothing is disturbed in the database @@ -519,7 +519,7 @@ module JamRuby # auto-join this user into the newly created session as_musician = true - connection = ConnectionManager.new.join_music_session(user, client_id, active_music_session, as_musician, tracks, 10) + connection = ConnectionManager.new.join_music_session(user, client_id, active_music_session, as_musician, tracks, audio_latency) unless connection.errors.any? user.update_progression_field(:first_music_session_at) diff --git a/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb b/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb index 50b542b89..9bc6a742c 100644 --- a/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb +++ b/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb @@ -140,8 +140,7 @@ INNER JOIN users ON users.id = msess.user_id INNER JOIN rsvp_slots AS rs ON rs.music_session_id = msess.id LEFT JOIN rsvp_requests_rsvp_slots AS rrrs ON rrrs.rsvp_slot_id = rs.id WHERE - musician_access = 't' AND - approval_required = 'f' AND + open_rsvps = TRUE AND users.last_jam_locidispid IS NOT NULL AND msess.created_at > '#{earliest_session_create_time}' AND msess.created_at < '#{latest_session_create_time}' AND diff --git a/ruby/lib/jam_ruby/models/music_session.rb b/ruby/lib/jam_ruby/models/music_session.rb index 290fd93f4..35a5a7892 100644 --- a/ruby/lib/jam_ruby/models/music_session.rb +++ b/ruby/lib/jam_ruby/models/music_session.rb @@ -10,7 +10,7 @@ module JamRuby RECURRING_MODES = [NO_RECURRING, RECURRING_WEEKLY] - attr_accessor :legal_terms, :language_description, :access_description + attr_accessor :legal_terms, :language_description, :access_description, :scheduling_info_changed attr_accessor :approved_rsvps, :open_slots, :pending_invitations @@ -58,11 +58,17 @@ module JamRuby before_create :generate_share_token before_create :add_to_feed #before_save :update_scheduled_start + before_save :check_scheduling_info_changed SHARE_TOKEN_LENGTH = 8 SEPARATOR = '|' + def check_scheduling_info_changed + @scheduling_info_changed = scheduled_start_changed? + true + end + def add_to_feed feed = Feed.new feed.music_session = self diff --git a/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb b/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb index b632234bc..c23eca414 100644 --- a/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb +++ b/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb @@ -89,6 +89,16 @@ describe EmailBatchScheduledSessions do expect(UserMailer.deliveries.length).to eq(2) end + it "won't find an open_rsvps=false session" do + session1.open_rsvps = false + session1.save! + session2.open_rsvps = false + session2.save! + + obj = scheduled_batch.fetch_recipients + expect(obj.count).to eq(0) + end + it 'handles large batches' do creators = [] 8.downto(1) do |nn| diff --git a/ruby/spec/jam_ruby/models/music_session_spec.rb b/ruby/spec/jam_ruby/models/music_session_spec.rb index ad4cc67de..f7b9f2a8f 100644 --- a/ruby/spec/jam_ruby/models/music_session_spec.rb +++ b/ruby/spec/jam_ruby/models/music_session_spec.rb @@ -779,5 +779,20 @@ describe MusicSession do end end end + + describe "scheduled session rescheduled logic" do + + it "detect change to scheduling info" do + + music_session1.description = "Hey!" + music_session1.save! + music_session1.scheduling_info_changed.should be_false + + music_session1.scheduled_start = Time.now - 1.days + music_session1.save! + music_session1.scheduling_info_changed.should be_true + + end + end end diff --git a/web/app/assets/javascripts/jam_rest.js b/web/app/assets/javascripts/jam_rest.js index 36cdcffc7..619ea3036 100644 --- a/web/app/assets/javascripts/jam_rest.js +++ b/web/app/assets/javascripts/jam_rest.js @@ -883,11 +883,7 @@ dataType: "json", contentType: 'application/json', url: "/api/users/progression/certified_gear", - processData: false, - data: JSON.stringify({ - success: options.success, - reason: options.reason - }) + data: JSON.stringify(options) }); } @@ -1184,17 +1180,6 @@ }); } - function updateAudioLatency(options) { - var id = getId(options); - return $.ajax({ - type: "POST", - url: '/api/users/' + id + '/audio_latency', - dataType: "json", - contentType: 'application/json', - data: options, - }); - } - function initialize() { return self; } @@ -1298,7 +1283,6 @@ this.getChatMessages = getChatMessages; this.createDiagnostic = createDiagnostic; this.getLatencyTester = getLatencyTester; - this.updateAudioLatency = updateAudioLatency; return this; }; diff --git a/web/app/assets/javascripts/wizard/gear_test.js b/web/app/assets/javascripts/wizard/gear_test.js index 032a427f2..c6c897daf 100644 --- a/web/app/assets/javascripts/wizard/gear_test.js +++ b/web/app/assets/javascripts/wizard/gear_test.js @@ -433,7 +433,7 @@ context.JK.GA.trackAudioTestData(uniqueDeviceName(), context.JK.GA.AudioTestDataReasons.pass, latencyScore); - rest.userCertifiedGear({success: true, client_id: app.clientId, audio_latency: getLatencyScore()}); + rest.userCertifiedGear({success: true, client_id: app.clientId, audio_latency: getLatencyScore().latency}); } function onGearTestFail(e, data) { diff --git a/web/app/assets/javascripts/wizard/gear_utils.js b/web/app/assets/javascripts/wizard/gear_utils.js index 6eb7aa2eb..13e182582 100644 --- a/web/app/assets/javascripts/wizard/gear_utils.js +++ b/web/app/assets/javascripts/wizard/gear_utils.js @@ -269,14 +269,6 @@ return result; } - gearUtils.updateAudioLatency = function(app) { - var latency = jamClient.FTUEGetExpectedLatency().latency; - return rest.updateAudioLatency({client_id: app.clientId, audio_latency: latency}) - .fail(function(jqXHR) { - app.notifyServerError(jqXHR, "Unable to sync audio latency") - }); - } - // if the user has a good user network score, immediately returns with a resolved deferred object. // if not, the user will have the network test dialog prompted... once it's closed, then you'll be told reject() if score is still bad, or resolve() if now good gearUtils.guardAgainstBadNetworkScore = function(app) { diff --git a/web/app/controllers/api_music_sessions_controller.rb b/web/app/controllers/api_music_sessions_controller.rb index ca84595f0..eae4ec2fb 100644 --- a/web/app/controllers/api_music_sessions_controller.rb +++ b/web/app/controllers/api_music_sessions_controller.rb @@ -224,7 +224,8 @@ class ApiMusicSessionsController < ApiController response.status = :unprocessable_entity respond_with @music_session else - Notification.send_scheduled_session_rescheduled(@music_session) + Notification.send_scheduled_session_rescheduled(@music_session) if @music_session.scheduling_info_changed + respond_with @music_session, responder: ApiResponder, :location => api_session_history_detail_url(@music_session) end else @@ -287,7 +288,8 @@ class ApiMusicSessionsController < ApiController params[:id], params[:client_id], params[:as_musician], - params[:tracks] + params[:tracks], + params[:audio_latency] ) if @connection.errors.any? diff --git a/web/app/controllers/api_scoring_controller.rb b/web/app/controllers/api_scoring_controller.rb index 34420e355..a72f5e579 100644 --- a/web/app/controllers/api_scoring_controller.rb +++ b/web/app/controllers/api_scoring_controller.rb @@ -24,6 +24,9 @@ class ApiScoringController < ApiController conn = Connection.where(client_id: clientid, user_id: current_user.id).first if conn.nil? then render :json => {message: 'session not found'}, :status => 404; return end + + if conn.locidispid.nil? then render :json => {message: 'no locidispid for connection'}, :status => 404; return end + # if !current_user.id.eql?(conn.user.id) then render :json => {message: 'session not owned by user'}, :status => 403; return end result_client_ids = JamRuby::GetWork.get_work_list(conn.locidispid, conn.addr) diff --git a/web/app/controllers/api_users_controller.rb b/web/app/controllers/api_users_controller.rb index 27f5f268d..30d507bc7 100644 --- a/web/app/controllers/api_users_controller.rb +++ b/web/app/controllers/api_users_controller.rb @@ -534,7 +534,7 @@ class ApiUsersController < ApiController if !@user.errors.any? # update audio gear latency information - @user.update_audio_latency(connection, params[:audio_latency]) + @user.update_audio_latency(connection, params[:audio_latency]) if params[:audio_latency] end else @user.failed_qualification(params[:reason]) diff --git a/web/spec/features/profile_history_spec.rb b/web/spec/features/profile_history_spec.rb index ef500f420..551b1dc22 100644 --- a/web/spec/features/profile_history_spec.rb +++ b/web/spec/features/profile_history_spec.rb @@ -8,6 +8,7 @@ describe "Profile History", :js => true, :type => :feature, :capybara_feature => before do MusicSession.delete_all + ActiveMusicSession.delete_all Recording.delete_all set_login_cookie user stub_const("APP_CONFIG", web_config) diff --git a/web/spec/support/app_config.rb b/web/spec/support/app_config.rb index 166145ae4..762168dde 100644 --- a/web/spec/support/app_config.rb +++ b/web/spec/support/app_config.rb @@ -54,6 +54,10 @@ def web_config def max_track_part_upload_failures 3 end + + def icecast_hardcoded_source_password + 'blueberryjam' + end end klass.new end From 0abb38d48a4bcf75a40d35bec0f22eec9cbc55d5 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 30 Jul 2014 15:13:07 -0500 Subject: [PATCH 04/16] * remove debugigng puts --- web/spec/requests/musician_search_api_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/web/spec/requests/musician_search_api_spec.rb b/web/spec/requests/musician_search_api_spec.rb index 9fff2b1f6..95a77fbc3 100644 --- a/web/spec/requests/musician_search_api_spec.rb +++ b/web/spec/requests/musician_search_api_spec.rb @@ -108,7 +108,6 @@ describe "Musician Search API", :type => :api do expect(@user4.followers.count).to be 3 get_query(orderby: :followed) good_response - puts last_response.body musician = json["musicians"][0] expect(musician["id"]).to eq(@user4.id) followings = musician['followings'] From 00993acfedd0b72e44102479ea85b5ad074cfea2 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 30 Jul 2014 15:35:56 -0500 Subject: [PATCH 05/16] * VRFS-1988 set up infra to allow for scheduler.yml override file --- web/lib/tasks/scheduler.rake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/lib/tasks/scheduler.rake b/web/lib/tasks/scheduler.rake index 099d915dc..387ff20ed 100644 --- a/web/lib/tasks/scheduler.rake +++ b/web/lib/tasks/scheduler.rake @@ -16,7 +16,15 @@ task :scheduler => :environment do # The schedule doesn't need to be stored in a YAML, it just needs to # be a hash. YAML is usually the easiest. - Resque.schedule = YAML.load_file(File.join(File.dirname(__FILE__), '../..', 'config/scheduler.yml')) + config = YAML.load_file(File.join(File.dirname(__FILE__), '../..', 'config/scheduler.yml')) + + if File.exist? File.join(File.dirname(__FILE__), '../..', 'config/scheduler_override.yml') + puts "scheduler_override file found. loading..." + override = YAML.load_file(File.join(File.dirname(__FILE__), '../..', 'config/scheduler_override.yml')) + config.merge!(override) + end + + Resque.schedule = config # If your schedule already has +queue+ set for each job, you don't # need to require your jobs. This can be an advantage since it's From 699e8a6c5d6cd70ef004e1027d2df90d1772352d Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 30 Jul 2014 15:44:46 -0500 Subject: [PATCH 06/16] * check for empty file for VRFS-1988 --- web/lib/tasks/scheduler.rake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/lib/tasks/scheduler.rake b/web/lib/tasks/scheduler.rake index 387ff20ed..913e68b65 100644 --- a/web/lib/tasks/scheduler.rake +++ b/web/lib/tasks/scheduler.rake @@ -21,7 +21,12 @@ task :scheduler => :environment do if File.exist? File.join(File.dirname(__FILE__), '../..', 'config/scheduler_override.yml') puts "scheduler_override file found. loading..." override = YAML.load_file(File.join(File.dirname(__FILE__), '../..', 'config/scheduler_override.yml')) - config.merge!(override) + if override # override will be false if file is empty + config.merge!(override) + else + puts "schedule_override is empty... skipping..." + end + end Resque.schedule = config From a11ae44a907061ed3269967c30060a2659797f13 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 30 Jul 2014 16:39:59 -0500 Subject: [PATCH 07/16] * VRFS-1951 - make sure staging emails don't get sent from my machie --- db/manifest | 3 +- db/up/define_environment_in_db.sql | 3 + ruby/lib/jam_ruby/models/generic_state.rb | 15 +++++ .../jam_ruby/models/generic_state_spec.rb | 60 +++++++++++++++++++ web/config/initializers/email.rb | 8 ++- 5 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 db/up/define_environment_in_db.sql create mode 100644 ruby/spec/jam_ruby/models/generic_state_spec.rb diff --git a/db/manifest b/db/manifest index 8bad4f17c..06a48eb7d 100755 --- a/db/manifest +++ b/db/manifest @@ -199,4 +199,5 @@ track_user_in_scores.sql median_aggregate.sql current_scores_use_median.sql current_scores_ams_index_sms_index_use_user_instrument.sql -locidispid_in_score_histories.sql \ No newline at end of file +locidispid_in_score_histories.sql +define_environment_in_db.sql \ No newline at end of file diff --git a/db/up/define_environment_in_db.sql b/db/up/define_environment_in_db.sql new file mode 100644 index 000000000..d05c9ef74 --- /dev/null +++ b/db/up/define_environment_in_db.sql @@ -0,0 +1,3 @@ +-- https://jamkazam.atlassian.net/browse/VRFS-1951 +-- we need to know the environment in the database for advanced behaviors +ALTER TABLE generic_state ADD COLUMN environment VARCHAR(255) NOT NULL DEFAULT 'development'; \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/generic_state.rb b/ruby/lib/jam_ruby/models/generic_state.rb index dae283c04..9390a58c2 100644 --- a/ruby/lib/jam_ruby/models/generic_state.rb +++ b/ruby/lib/jam_ruby/models/generic_state.rb @@ -4,6 +4,21 @@ module JamRuby self.table_name = 'generic_state' + validates :environment, :inclusion => {:in => ['development', 'staging', 'production', 'test']} + + def self.allow_emails? + + database_environment = singleton.environment + + # if the database says we are in production/staging, then the config has to also agree and say we are in production/staging to send emails + # this is to protect against developers loading a staging or production environment and possibly sending emails to + # we even go one step further, and make sure ENV['BUILD_NUMBER'] is set, which is something you do in production, but would be very rare in development + + # or if your database says 'development' and config say 'development', then we allow emails to go out too + (!ENV['BUILD_NUMBER'].nil? && (Environment.mode == 'production' || Environment.mode == 'staging') && (database_environment == 'production' || database_environment == 'staging')) || + (database_environment == 'development' && Environment.mode == 'development') + end + def self.singleton GenericState.find('default') end diff --git a/ruby/spec/jam_ruby/models/generic_state_spec.rb b/ruby/spec/jam_ruby/models/generic_state_spec.rb new file mode 100644 index 000000000..ba7ca0595 --- /dev/null +++ b/ruby/spec/jam_ruby/models/generic_state_spec.rb @@ -0,0 +1,60 @@ +require 'spec_helper' + +describe GenericState do + + def database_env (env) + singleton = GenericState.singleton + singleton.environment = env + singleton.save! + end + + def rails_env (env) + JamRuby::Environment.should_receive(:mode).any_number_of_times.and_return(env) + end + + describe "allow_emails?" do + + it "allows emails if database is production and env is production, with build number" do + database_env('production') + rails_env('production') + stub_const("ENV", {'BUILD_NUMBER' => 1}) + + GenericState.allow_emails?.should be_true + end + + it "no emails if database is production and env is production, no build number" do + database_env('production') + rails_env('production') + + GenericState.allow_emails?.should be_false + end + + it "allows emails if database is development and env is development" do + database_env('development') + rails_env('development') + + GenericState.allow_emails?.should be_true + end + + it "no emails if database development, and environment is test" do + database_env('development') + rails_env('test') + GenericState.allow_emails?.should be_false + end + + it "no emails if database production, and environment is development" do + database_env('production') + rails_env('development') + stub_const("ENV", {'BUILD_NUMBER' => 1}) + + GenericState.allow_emails?.should be_false + end + + it "no emails if database production, and environment is test" do + database_env('production') + rails_env('development') + + GenericState.allow_emails?.should be_false + end + end +end \ No newline at end of file diff --git a/web/config/initializers/email.rb b/web/config/initializers/email.rb index 41e1651d0..8d9daf5a5 100644 --- a/web/config/initializers/email.rb +++ b/web/config/initializers/email.rb @@ -1,5 +1,7 @@ +@@log = Logging.logger['EmailInitializer'] + ActionMailer::Base.raise_delivery_errors = true -ActionMailer::Base.delivery_method = Rails.env == "test" ? :test : :smtp +ActionMailer::Base.delivery_method = GenericState.allow_emails? ? :smtp : :test ActionMailer::Base.smtp_settings = { :address => Rails.application.config.email_smtp_address, :port => Rails.application.config.email_smtp_port, @@ -8,4 +10,6 @@ ActionMailer::Base.smtp_settings = { :user_name => Rails.application.config.email_smtp_user_name, :password => Rails.application.config.email_smtp_password , :enable_starttls_auto => Rails.application.config.email_smtp_starttls_auto -} \ No newline at end of file +} + +@@log.debug("ActionMailer.delivery_method = #{ActionMailer::Base.delivery_method}") From 2aab3c902dd0247758a9b1d13a39370aa7c760da Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 30 Jul 2014 17:29:26 -0500 Subject: [PATCH 08/16] * fixing test that failed on build server --- ruby/spec/jam_ruby/models/generic_state_spec.rb | 1 + web/config/initializers/resque.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ruby/spec/jam_ruby/models/generic_state_spec.rb b/ruby/spec/jam_ruby/models/generic_state_spec.rb index ba7ca0595..7fdb0137c 100644 --- a/ruby/spec/jam_ruby/models/generic_state_spec.rb +++ b/ruby/spec/jam_ruby/models/generic_state_spec.rb @@ -25,6 +25,7 @@ describe GenericState do it "no emails if database is production and env is production, no build number" do database_env('production') rails_env('production') + stub_const("ENV", {'BUILD_NUMBER' => nil}) GenericState.allow_emails?.should be_false end diff --git a/web/config/initializers/resque.rb b/web/config/initializers/resque.rb index 5077fea0f..a9d463f8d 100644 --- a/web/config/initializers/resque.rb +++ b/web/config/initializers/resque.rb @@ -1,7 +1,7 @@ Resque.redis = Rails.application.config.redis_host -if !$rails_rake_task && Rails.env == 'development' && ENV['RUN_JOBS_INLINE'] == '1' +if !$rails_rake_task && Rails.env == 'development' && (ENV['RUN_JOBS_INLINE'] == '1' || ENV['RUN_INLINE_JOBS'] == '1') Thread.new do system('INTERVAL=1 bundle exec rake all_jobs') From 72155c7ea6c151277c6fd035f9c54f9ab3e02f46 Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Wed, 30 Jul 2014 20:03:07 -0500 Subject: [PATCH 09/16] VRFS-1328 - built composite function resembling audio taper for DAW-like faders --- web/app/assets/javascripts/faderHelpers.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/web/app/assets/javascripts/faderHelpers.js b/web/app/assets/javascripts/faderHelpers.js index 98b901626..9da5eb923 100644 --- a/web/app/assets/javascripts/faderHelpers.js +++ b/web/app/assets/javascripts/faderHelpers.js @@ -203,6 +203,19 @@ return temp; }, + + convertPercentToAudioTaper: function (input) { + + // composite function resembling audio taper + if (input <= 1) { return -80; } + if (input <= 28) { return (2 * input - 80); } + if (input <= 79) { return (0.5 * input - 38); } + if (input < 99) { return (0.875 * input - 67.5); } + if (input >= 99) { return 20; } + + }, + + setFaderValue: function (faderId, faderValue) { var $fader = $('[fader-id="' + faderId + '"]'); this.setHandlePosition($fader, faderValue); From 70da64a26eadf466dffc6e07fc13082c086e16e8 Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Wed, 30 Jul 2014 20:05:04 -0500 Subject: [PATCH 10/16] VRFS-1328 - wire up faders to use audio taper curve instead of percentage --- web/app/assets/javascripts/session.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/assets/javascripts/session.js b/web/app/assets/javascripts/session.js index 25a5e0915..b77a45831 100644 --- a/web/app/assets/javascripts/session.js +++ b/web/app/assets/javascripts/session.js @@ -1147,8 +1147,8 @@ // volumes on trackVolumeObject, and call SetControlState to stick. var sliderValue = percentToMixerValue( currentMixerRangeMin, currentMixerRangeMax, volumePercent); - context.trackVolumeObject.volL = sliderValue; - context.trackVolumeObject.volR = sliderValue; + context.trackVolumeObject.volL = context.JK.FaderHelpers.convertPercentToAudioTaper(volumePercent); + context.trackVolumeObject.volR = context.JK.FaderHelpers.convertPercentToAudioTaper(volumePercent); // Special case for L2M mix: if (mixerId === '__L2M__') { logger.debug("L2M volumePercent=" + volumePercent); From 9544e3d075b5adb1815f7b429f54e74c895c2e07 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 30 Jul 2014 21:05:59 -0500 Subject: [PATCH 11/16] * rename new column because it's not working for reasons I can't understand on the build server --- db/up/define_environment_in_db.sql | 2 +- ruby/lib/jam_ruby/models/generic_state.rb | 4 ++-- ruby/spec/jam_ruby/models/generic_state_spec.rb | 2 +- web/spec/spec_helper.rb | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/db/up/define_environment_in_db.sql b/db/up/define_environment_in_db.sql index d05c9ef74..a419e8c8a 100644 --- a/db/up/define_environment_in_db.sql +++ b/db/up/define_environment_in_db.sql @@ -1,3 +1,3 @@ -- https://jamkazam.atlassian.net/browse/VRFS-1951 -- we need to know the environment in the database for advanced behaviors -ALTER TABLE generic_state ADD COLUMN environment VARCHAR(255) NOT NULL DEFAULT 'development'; \ No newline at end of file +ALTER TABLE generic_state ADD COLUMN env VARCHAR(255) NOT NULL DEFAULT 'development'; \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/generic_state.rb b/ruby/lib/jam_ruby/models/generic_state.rb index 9390a58c2..546006794 100644 --- a/ruby/lib/jam_ruby/models/generic_state.rb +++ b/ruby/lib/jam_ruby/models/generic_state.rb @@ -4,11 +4,11 @@ module JamRuby self.table_name = 'generic_state' - validates :environment, :inclusion => {:in => ['development', 'staging', 'production', 'test']} + validates :env, :inclusion => {:in => ['development', 'staging', 'production', 'test']} def self.allow_emails? - database_environment = singleton.environment + database_environment = singleton.env # if the database says we are in production/staging, then the config has to also agree and say we are in production/staging to send emails # this is to protect against developers loading a staging or production environment and possibly sending emails to diff --git a/ruby/spec/jam_ruby/models/generic_state_spec.rb b/ruby/spec/jam_ruby/models/generic_state_spec.rb index 7fdb0137c..671daeaba 100644 --- a/ruby/spec/jam_ruby/models/generic_state_spec.rb +++ b/ruby/spec/jam_ruby/models/generic_state_spec.rb @@ -4,7 +4,7 @@ describe GenericState do def database_env (env) singleton = GenericState.singleton - singleton.environment = env + singleton.env = env singleton.save! end diff --git a/web/spec/spec_helper.rb b/web/spec/spec_helper.rb index f92c77a43..d02e69c97 100644 --- a/web/spec/spec_helper.rb +++ b/web/spec/spec_helper.rb @@ -28,7 +28,6 @@ bputs "before db_config load" db_config = YAML::load(File.open('config/database.yml'))["test"] # initialize ActiveRecord's db connection\ - bputs "before recreate db" SpecDb::recreate_database(db_config) From ac13d9780821788462ffd956ba3078b18de46f77 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 30 Jul 2014 21:28:14 -0500 Subject: [PATCH 12/16] * VRFS-1996 - mixer-id added to wrong element --- web/app/assets/javascripts/session.js | 1 + 1 file changed, 1 insertion(+) diff --git a/web/app/assets/javascripts/session.js b/web/app/assets/javascripts/session.js index b77a45831..4a6d11ace 100644 --- a/web/app/assets/javascripts/session.js +++ b/web/app/assets/javascripts/session.js @@ -569,6 +569,7 @@ $voiceChat.show(); $voiceChat.attr('mixer-id', mixer.id); var $voiceChatGain = $voiceChat.find('.voicechat-gain'); + $voiceChatGain.attr('mixer-id', mixer.id); var $voiceChatMute = $voiceChat.find('.voicechat-mute').attr('mixer-id', mixer.id); var gainPercent = percentFromMixerValue( mixer.range_low, mixer.range_high, mixer.volume_left); From 2cdafacd16c871b9ef64d9d5cb380b82fa13ba24 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 30 Jul 2014 21:35:37 -0500 Subject: [PATCH 13/16] * adding more debugs for problem on server --- web/spec/spec_helper.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/spec/spec_helper.rb b/web/spec/spec_helper.rb index d02e69c97..d4aedf836 100644 --- a/web/spec/spec_helper.rb +++ b/web/spec/spec_helper.rb @@ -6,13 +6,18 @@ def bputs(msg) end end +bputs "before simplecov" + require 'simplecov' +bputs "before rubygems" require 'rubygems' +bputs "before omniauth" #require 'spork' require 'omniauth' #uncomment the following line to use spork with the debugger #require 'spork/ext/ruby-debug' + ENV["RAILS_ENV"] ||= 'test' bputs "before activerecord load" From 39c9b4335ae24fe80741894e65d76c434130a491 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Wed, 30 Jul 2014 21:55:40 -0500 Subject: [PATCH 14/16] * VRFS-1997 - click guard of create session --- web/app/assets/javascripts/scheduled_session.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/web/app/assets/javascripts/scheduled_session.js b/web/app/assets/javascripts/scheduled_session.js index 7b7de7843..8d4227e6d 100644 --- a/web/app/assets/javascripts/scheduled_session.js +++ b/web/app/assets/javascripts/scheduled_session.js @@ -570,21 +570,25 @@ } function startSessionClicked() { + var $btn = $(this); + if($btn.is('.disabled')) { return; } + $btn.addClass('disabled') if(willOptionStartSession()) { gearUtils.guardAgainstInvalidConfiguration(app) .fail(function() { + $btn.removeClass('disabled') app.notify( { title: "Unable to Start New Session", text: "You can only start a session once you have working audio gear and a tested internet connection." }) }) .done(function(){ - startSession(); + startSession($btn); }); } else { - startSession(); + startSession($btn); } } @@ -593,7 +597,7 @@ return createType == "immediately" || createType == "schedule-future" || createType == "rsvp"; } - function startSession() { + function startSession($startBtn) { var data = {}; @@ -700,6 +704,7 @@ context.JK.GA.trackSessionMusicians(context.JK.GA.SessionCreationTypes.create); }) .fail(function(jqXHR) { + $startBtn.removeClass('disabled'); var handled = false; if(jqXHR.status = 422) { var response = JSON.parse(jqXHR.responseText); @@ -712,6 +717,8 @@ app.notifyServerError(jqXHR, "Unable to Create Session"); } }) + .always(function() { + }) }; @@ -735,9 +742,10 @@ } }) .fail(function(jqXHR){ + $startBtn.removeClass('disabled'); logger.debug("unable to schedule a session") app.notifyServerError(jqXHR, "Unable to schedule a session"); - }); + }) } } From 8deddd269eeeedbafc37af18a0429b256a04e0eb Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Wed, 30 Jul 2014 23:43:04 -0500 Subject: [PATCH 15/16] Fixing intermittent test failure --- web/spec/support/utilities.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/spec/support/utilities.rb b/web/spec/support/utilities.rb index 27b50ad35..db6d009be 100644 --- a/web/spec/support/utilities.rb +++ b/web/spec/support/utilities.rb @@ -543,7 +543,7 @@ def change_session_genre #randomly just change it find('#session-settings-dialog') # ensure the dialog is visible within('#session-settings-dialog') do wait_for_ajax - @new_genre = get_options(here).-(["Select Genre"]).-(selected_genres).sample.to_s + @new_genre = get_options(here).-(["Select Genre", "Unspecified"]).-(selected_genres).sample.to_s jk_select(@new_genre, '#session-settings-dialog select[name="genres"]') wait_for_ajax find('#session-settings-dialog-submit').trigger(:click) From a1b9191402872aceccba3e7ae7b82f203480581e Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 31 Jul 2014 01:00:01 -0500 Subject: [PATCH 16/16] * open profile from account session details page in same window --- web/app/views/clients/_account_session_detail.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/views/clients/_account_session_detail.html.haml b/web/app/views/clients/_account_session_detail.html.haml index 4d6ee95c0..7057069b8 100644 --- a/web/app/views/clients/_account_session_detail.html.haml +++ b/web/app/views/clients/_account_session_detail.html.haml @@ -89,7 +89,7 @@ %td {{data.latency}} .right - %a{href: "/client#/profile/{{data.user_id}}", class: 'button-orange left', 'user-id' => "{{data.user_id}}", target: "_blank"} PROFILE + %a{href: "/client#/profile/{{data.user_id}}", class: 'button-orange left', 'user-id' => "{{data.user_id}}"} PROFILE %a{href: "#", class: 'button-orange left approveRsvpRequest', 'user-id' => "{{data.user_id}}", 'request-id' => "{{data.request_id}}"} APPROVE %a{href: "#", class: 'button-orange left declineRsvpRequest', 'user-id' => "{{data.user_id}}", 'request-id' => "{{data.request_id}}"} DECLINE .clearall