From 5691fbc51f17e4549475c0c3bfdb218db77fb650 Mon Sep 17 00:00:00 2001 From: Steven Miers Date: Tue, 14 Oct 2014 14:54:18 -0500 Subject: [PATCH 01/14] Require new scheduled_music_session_cleaner at class level. Fixes broken unit test. --- ruby/lib/jam_ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index 9daaa1e8d..394975a34 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -51,6 +51,7 @@ require "jam_ruby/resque/scheduled/new_musician_emailer" require "jam_ruby/resque/scheduled/music_session_scheduler" require "jam_ruby/resque/scheduled/active_music_session_cleaner" require "jam_ruby/resque/scheduled/score_history_sweeper" +require "jam_ruby/resque/scheduled/scheduled_music_session_cleaner" require "jam_ruby/resque/google_analytics_event" require "jam_ruby/resque/batch_email_job" require "jam_ruby/mq_router" From 10c5a66f248cdba6a699c51f84dfb5f368230a49 Mon Sep 17 00:00:00 2001 From: Steven Miers Date: Tue, 14 Oct 2014 17:17:05 -0500 Subject: [PATCH 02/14] VRFS-2033 - Youtube developer keys for test and dev environments --- web/config/environments/development.rb | 2 ++ web/config/environments/test.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/web/config/environments/development.rb b/web/config/environments/development.rb index 797e9aeba..8a4a4545c 100644 --- a/web/config/environments/development.rb +++ b/web/config/environments/development.rb @@ -83,4 +83,6 @@ SampleApp::Application.configure do config.send_join_session_email_notifications = true + # For product = JamKazamDev + config.youtube_developer_key = "AI39si5bPqiNc5GQHscWJh9Wl1WTAr9aZqr_YncUvaR7Kz0rgPdBVWVubHZ94xZ3KLIBqtE9mu3VZe-UpMU80QxXoC66kBNp7A" end diff --git a/web/config/environments/test.rb b/web/config/environments/test.rb index 55df32b20..a4d7933f0 100644 --- a/web/config/environments/test.rb +++ b/web/config/environments/test.rb @@ -76,6 +76,8 @@ SampleApp::Application.configure do config.twitter_app_id = 'e7hGc71gmcBgo6Wvdta6Sg' config.twitter_app_secret = 'PfG1jAUMnyrimPcDooUVQaJrG1IuDjUyGg5KciOo' + config.youtube_developer_key = "AI39si4VB6mzeQxS0CGWsZhnOvV3nptz7vtuyeMc6pw1Kwtv6J_O1b0ZMj0QLULFtv7hnfAkimAPFy9RfJJFWsds4vUAZjnDVg" + config.use_promos_on_homepage = false config.use_cached_session_scores = true From 077d3f4253657db2b3793b0349bec45b98fec79a Mon Sep 17 00:00:00 2001 From: Steven Miers Date: Tue, 14 Oct 2014 17:17:25 -0500 Subject: [PATCH 03/14] VRFS-2033 - YouTube client library --- ruby/Gemfile | 1 + web/Gemfile | 1 + 2 files changed, 2 insertions(+) diff --git a/ruby/Gemfile b/ruby/Gemfile index 8457d4649..a91503b42 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -48,6 +48,7 @@ gem 'rest-client' gem 'iso-639' gem 'rubyzip' gem 'sanitize' +gem 'youtube_it' # Access youtube API via oauth group :test do gem 'simplecov', '~> 0.7.1' diff --git a/web/Gemfile b/web/Gemfile index c97941bd1..d0dcdabf6 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -79,6 +79,7 @@ gem 'rubyzip' gem 'slim' gem 'htmlentities' gem 'sanitize' +gem 'youtube_it' # Access youtube API via oauth group :development, :test do gem 'rspec-rails', '2.14.2' From ece7cf2d56e9cb9a07cc1adc0c9e9889655c2bc2 Mon Sep 17 00:00:00 2001 From: Steven Miers Date: Wed, 15 Oct 2014 13:41:49 -0500 Subject: [PATCH 04/14] VRFS-2033 : Spec and fixes for google_oauth2 provider-type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit user_authentications. These are named “google_login” in our app. --- web/app/controllers/sessions_controller.rb | 13 ++++--- .../controllers/sessions_controller_spec.rb | 36 +++++++++++++++++++ 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/web/app/controllers/sessions_controller.rb b/web/app/controllers/sessions_controller.rb index f2f705141..7a2bb8ca7 100644 --- a/web/app/controllers/sessions_controller.rb +++ b/web/app/controllers/sessions_controller.rb @@ -134,11 +134,16 @@ class SessionsController < ApplicationController # Always make and save a new authorization. This is because they expire, and honestly there's no cost # to just making and saving it. + user_auth_hash = { + :provider => auth_hash[:provider], + :uid => auth_hash[:uid], + :token => auth_hash[:credentials][:token], + :token_expiration => Time.at(auth_hash[:credentials][:expires_at]), + :secret => auth_hash[:credentials][:secret] + } + #if authorization.nil? - authorization = current_user.user_authorizations.build :provider => auth_hash[:provider], - :uid => auth_hash[:uid], - :token => auth_hash[:credentials][:token], - :token_expiration => Time.at(auth_hash[:credentials][:expires_at]) + authorization = current_user.user_authorizations.build(user_auth_hash) authorization.save #end diff --git a/web/spec/controllers/sessions_controller_spec.rb b/web/spec/controllers/sessions_controller_spec.rb index 5ec9699d2..65aad4fff 100644 --- a/web/spec/controllers/sessions_controller_spec.rb +++ b/web/spec/controllers/sessions_controller_spec.rb @@ -111,6 +111,42 @@ describe SessionsController do end end + describe "google_login" do + before(:each) do + OmniAuth.config.mock_auth[:google_login] = OmniAuth::AuthHash.new({ + 'uid' => '100', + 'provider' => 'google_login', + 'credentials' => { + 'token' => 'google_logintoken', + 'secret' => 'google_loginsecret', + 'expires_at' => 1000000000 + } + }) + end + + it "should update user_authorization for existing user" do + cookie_jar[:remember_token] = user.remember_token # controller.current_user is not working. i think because of omniauth + request.env["omniauth.auth"] = OmniAuth.config.mock_auth[:google_login] + visit '/auth/google_login' + user.reload + auth = user.user_authorization('google_login') + auth.uid.should == '100' + auth.token.should == 'google_logintoken' + auth.secret.should == 'google_loginsecret' + + # also verify that a second visit does *not* create another new user + visit '/auth/google_login' + + user.reload + auth = user.user_authorization('google_login') + auth.uid.should == '100' + auth.token.should == 'google_logintoken' + auth.secret.should == 'google_loginsecret' + end + end + + + end From dacd702bd88bc215e395629211bdbe08cef9cda3 Mon Sep 17 00:00:00 2001 From: Steven Miers Date: Wed, 15 Oct 2014 13:44:31 -0500 Subject: [PATCH 05/14] VRFS-2029 : Migration/manifest for upload_to_youtube On claimed_recordings table. --- db/manifest | 1 + db/up/add_youtube_flag_to_claimed_recordings.sql | 1 + 2 files changed, 2 insertions(+) create mode 100644 db/up/add_youtube_flag_to_claimed_recordings.sql diff --git a/db/manifest b/db/manifest index 853a1cef6..dbc4afe31 100755 --- a/db/manifest +++ b/db/manifest @@ -221,3 +221,4 @@ connection_network_testing.sql video_sources.sql recorded_videos.sql emails_from_update2.sql +add_youtube_flag_to_claimed_recordings.sql \ No newline at end of file diff --git a/db/up/add_youtube_flag_to_claimed_recordings.sql b/db/up/add_youtube_flag_to_claimed_recordings.sql new file mode 100644 index 000000000..5ad549f7f --- /dev/null +++ b/db/up/add_youtube_flag_to_claimed_recordings.sql @@ -0,0 +1 @@ +ALTER TABLE claimed_recordings ADD COLUMN upload_to_youtube BOOLEAN NOT NULL DEFAULT false; \ No newline at end of file From d95a063648473747c86e78eb8fec7fcc04a55f95 Mon Sep 17 00:00:00 2001 From: Steven Miers Date: Wed, 15 Oct 2014 13:45:30 -0500 Subject: [PATCH 06/14] VRFS-2029 : Rails model attribute for upload_to_youtube flag Also includes Rails validation. --- ruby/lib/jam_ruby/models/claimed_recording.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ruby/lib/jam_ruby/models/claimed_recording.rb b/ruby/lib/jam_ruby/models/claimed_recording.rb index 9fa1e569a..88898cb89 100644 --- a/ruby/lib/jam_ruby/models/claimed_recording.rb +++ b/ruby/lib/jam_ruby/models/claimed_recording.rb @@ -3,7 +3,7 @@ module JamRuby include HtmlSanitize html_sanitize strict: [:name, :description] - attr_accessible :name, :description, :is_public, :genre_id, :recording_id, :user_id, as: :admin + attr_accessible :name, :description, :is_public, :genre_id, :recording_id, :user_id, :upload_to_youtube, as: :admin belongs_to :recording, :class_name => "JamRuby::Recording", :inverse_of => :claimed_recordings, :foreign_key => 'recording_id' belongs_to :user, :class_name => "JamRuby::User", :inverse_of => :claimed_recordings @@ -17,6 +17,8 @@ module JamRuby validates :name, no_profanity: true, length: {minimum: 3, maximum: 64}, presence: true validates :description, no_profanity: true, length: {maximum: 8000} validates :is_public, :inclusion => {:in => [true, false]} + validates :upload_to_youtube, :inclusion => {:in => [true, false]} + validates :genre, presence: true validates :user, presence: true validates_uniqueness_of :user_id, :scope => :recording_id From c1f2a2083f646e4530abf98075dcc97ccd549b79 Mon Sep 17 00:00:00 2001 From: Steven Miers Date: Wed, 15 Oct 2014 13:54:10 -0500 Subject: [PATCH 07/14] VRFS-2029 : Update REST API ApiRecordingsController#claim to accept and distribute upload_to_youtube flag as appropriate. Spec to verify. --- ruby/lib/jam_ruby/models/recording.rb | 3 ++- ruby/spec/jam_ruby/models/recording_spec.rb | 25 +++++++++++++++++++ .../controllers/api_recordings_controller.rb | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ruby/lib/jam_ruby/models/recording.rb b/ruby/lib/jam_ruby/models/recording.rb index f467fe563..12e6ca119 100644 --- a/ruby/lib/jam_ruby/models/recording.rb +++ b/ruby/lib/jam_ruby/models/recording.rb @@ -180,7 +180,7 @@ module JamRuby # Called when a user wants to "claim" a recording. To do this, the user must have been one of the tracks in the recording. - def claim(user, name, description, genre, is_public) + def claim(user, name, description, genre, is_public, upload_to_youtube=false) unless self.users.exists?(user) raise PermissionError, "user was not in this session" @@ -193,6 +193,7 @@ module JamRuby claimed_recording.description = description claimed_recording.genre = genre claimed_recording.is_public = is_public + claimed_recording.upload_to_youtube = upload_to_youtube self.claimed_recordings << claimed_recording if claimed_recording.save diff --git a/ruby/spec/jam_ruby/models/recording_spec.rb b/ruby/spec/jam_ruby/models/recording_spec.rb index 6a6ab6ee6..0989e777c 100644 --- a/ruby/spec/jam_ruby/models/recording_spec.rb +++ b/ruby/spec/jam_ruby/models/recording_spec.rb @@ -126,6 +126,7 @@ describe Recording do @claimed_recording.description.should == "description" @claimed_recording.genre.should == @genre @claimed_recording.is_public.should == true + @claimed_recording.upload_to_youtube.should == false end it "should fail if a user who was not in the session claims a recording" do @@ -149,6 +150,7 @@ describe Recording do @claimed_recording.description.should == "description2" @claimed_recording.genre.should == @genre2 @claimed_recording.is_public.should == false + @claimed_recording.upload_to_youtube.should == false end it "should only allow the owner to edit a claimed recording" do @@ -195,6 +197,29 @@ describe Recording do @recording.all_discarded.should == false end + it "should set youtube flag" do + + @connection.join_the_session(@music_session, true, nil, @user, 10) + @recording = Recording.start(@music_session, @user) + @recording.stop + @recording.reload + @genre = FactoryGirl.create(:genre) + @recording.claim(@user, "name", "description", @genre, true, true) + + @recording.reload + @recording.users.length.should == 1 + @recording.users.first.should == @user + @user.recordings.length.should == 1 + @user.recordings.first.should == @recording + @recording.claimed_recordings.length.should == 1 + @claimed_recording = @recording.claimed_recordings.first + @claimed_recording.name.should == "name" + @claimed_recording.description.should == "description" + @claimed_recording.genre.should == @genre + @claimed_recording.is_public.should == true + @claimed_recording.upload_to_youtube.should == true + end + it "should destroy the entire recording if there was only one claimed_recording which is discarded" do @recording = Recording.start(@music_session, @user) @recording.stop diff --git a/web/app/controllers/api_recordings_controller.rb b/web/app/controllers/api_recordings_controller.rb index 66c5625f9..e7c67b29d 100644 --- a/web/app/controllers/api_recordings_controller.rb +++ b/web/app/controllers/api_recordings_controller.rb @@ -79,7 +79,7 @@ class ApiRecordingsController < ApiController # claim will create a claimed recording for the creator def claim - claim = @recording.claim(current_user, params[:name], params[:description], Genre.find_by_id(params[:genre]), params[:is_public]) + claim = @recording.claim(current_user, params[:name], params[:description], Genre.find_by_id(params[:genre]), params[:is_public], params[:upload_to_youtube]) if claim.errors.any? response.status = :unprocessable_entity From e3dadf9c4b222d856a35e0699c979c6ee212f652 Mon Sep 17 00:00:00 2001 From: Steven Miers Date: Wed, 15 Oct 2014 15:17:03 -0500 Subject: [PATCH 08/14] VRFS-2032 : Youtube test account app name/developer key. --- ruby/Gemfile | 1 - web/Gemfile | 2 +- web/config/environments/development.rb | 1 + web/config/environments/test.rb | 1 + 4 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ruby/Gemfile b/ruby/Gemfile index a91503b42..8457d4649 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -48,7 +48,6 @@ gem 'rest-client' gem 'iso-639' gem 'rubyzip' gem 'sanitize' -gem 'youtube_it' # Access youtube API via oauth group :test do gem 'simplecov', '~> 0.7.1' diff --git a/web/Gemfile b/web/Gemfile index d0dcdabf6..4c31c7956 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -43,6 +43,7 @@ gem 'omniauth', '1.1.1' gem 'omniauth-facebook', '1.4.1' gem 'omniauth-twitter' gem 'omniauth-google-oauth2', '0.2.1' +gem 'google-api-client' gem 'twitter' gem 'fb_graph', '2.5.9' gem 'sendgrid', '1.2.0' @@ -79,7 +80,6 @@ gem 'rubyzip' gem 'slim' gem 'htmlentities' gem 'sanitize' -gem 'youtube_it' # Access youtube API via oauth group :development, :test do gem 'rspec-rails', '2.14.2' diff --git a/web/config/environments/development.rb b/web/config/environments/development.rb index 8a4a4545c..96431df93 100644 --- a/web/config/environments/development.rb +++ b/web/config/environments/development.rb @@ -85,4 +85,5 @@ SampleApp::Application.configure do # For product = JamKazamDev config.youtube_developer_key = "AI39si5bPqiNc5GQHscWJh9Wl1WTAr9aZqr_YncUvaR7Kz0rgPdBVWVubHZ94xZ3KLIBqtE9mu3VZe-UpMU80QxXoC66kBNp7A" + config.youtube_app_name = "JamKazamDev" end diff --git a/web/config/environments/test.rb b/web/config/environments/test.rb index a4d7933f0..0c9d096b0 100644 --- a/web/config/environments/test.rb +++ b/web/config/environments/test.rb @@ -77,6 +77,7 @@ SampleApp::Application.configure do config.twitter_app_secret = 'PfG1jAUMnyrimPcDooUVQaJrG1IuDjUyGg5KciOo' config.youtube_developer_key = "AI39si4VB6mzeQxS0CGWsZhnOvV3nptz7vtuyeMc6pw1Kwtv6J_O1b0ZMj0QLULFtv7hnfAkimAPFy9RfJJFWsds4vUAZjnDVg" + config.youtube_app_name = "JamKazamTest" config.use_promos_on_homepage = false From cce9fc15778e686bfe7acc25b4b55e5d60335877 Mon Sep 17 00:00:00 2001 From: Steven Miers Date: Wed, 15 Oct 2014 17:59:59 -0500 Subject: [PATCH 09/14] VRFS-2029 : Fix issue where a nil (instead of false) is causing claimed_recording not to save properly. --- ruby/lib/jam_ruby/models/recorded_video.rb | 4 ++++ ruby/lib/jam_ruby/models/recording.rb | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ruby/lib/jam_ruby/models/recorded_video.rb b/ruby/lib/jam_ruby/models/recorded_video.rb index fc787d20a..42f40ea9c 100644 --- a/ruby/lib/jam_ruby/models/recorded_video.rb +++ b/ruby/lib/jam_ruby/models/recorded_video.rb @@ -6,6 +6,10 @@ module JamRuby validates :client_video_source_id, :presence => true + def upload_sign(content_md5) + + end + def self.create_from_video_source(video_source, recording) recorded_video_source = self.new recorded_video_source.recording = recording diff --git a/ruby/lib/jam_ruby/models/recording.rb b/ruby/lib/jam_ruby/models/recording.rb index 12e6ca119..1d9c6fd9c 100644 --- a/ruby/lib/jam_ruby/models/recording.rb +++ b/ruby/lib/jam_ruby/models/recording.rb @@ -181,7 +181,7 @@ module JamRuby # Called when a user wants to "claim" a recording. To do this, the user must have been one of the tracks in the recording. def claim(user, name, description, genre, is_public, upload_to_youtube=false) - + upload_to_youtube = !!upload_to_youtube # Correct where nil is borking save unless self.users.exists?(user) raise PermissionError, "user was not in this session" end @@ -306,7 +306,7 @@ module JamRuby uploads = [] # Uploads now include videos in addition to the tracks. - # This is accomplished using a SQL union via arel, as follows: + # This is accomplished using a SQL UNION query via arel, as follows: # Select fields from track. Note the reorder, which removes # the default scope sort as it b0rks the union. Also note the @@ -357,7 +357,7 @@ module JamRuby # Further joining and criteria for the unioned object: arel = arel.joins("INNER JOIN (SELECT id as rec_id, all_discarded, duration FROM recordings) recs ON rec_id=recorded_items.recording_id") \ .where('recorded_items.user_id' => user.id) \ - .where('recorded_items.fully_uploaded =?', false) \ + .where('recorded_items.fully_uploaded = ?', false) \ .where('recorded_items.id > ?', since) \ .where("upload_failures <= #{APP_CONFIG.max_track_upload_failures}") \ .where("duration IS NOT NULL") \ From 87170b913417407814f0379fcdb31d7fcec0d515 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sat, 18 Oct 2014 14:43:22 -0400 Subject: [PATCH 10/14] VRFS-2322 changed all input fields to render black text --- web/app/assets/stylesheets/client/account.css.scss | 2 +- web/app/assets/stylesheets/client/band.css.scss | 2 +- web/app/assets/stylesheets/client/content.css.scss | 1 - web/app/assets/stylesheets/client/createSession.css.scss | 2 +- web/app/assets/stylesheets/client/jamkazam.css.scss | 2 -- web/app/assets/stylesheets/client/screen_common.css.scss | 1 - web/app/assets/stylesheets/easydropdown_jk.css.scss | 6 ------ 7 files changed, 3 insertions(+), 13 deletions(-) diff --git a/web/app/assets/stylesheets/client/account.css.scss b/web/app/assets/stylesheets/client/account.css.scss index 81d700c12..74183442c 100644 --- a/web/app/assets/stylesheets/client/account.css.scss +++ b/web/app/assets/stylesheets/client/account.css.scss @@ -115,7 +115,7 @@ background-color: #C5C5C5; border: medium none; box-shadow: 2px 2px 3px 0 #888888 inset; - color: #666666; + color: #000; font-size: 14px; height: 178px; overflow: auto; diff --git a/web/app/assets/stylesheets/client/band.css.scss b/web/app/assets/stylesheets/client/band.css.scss index 4da4130d3..d2e8504d5 100644 --- a/web/app/assets/stylesheets/client/band.css.scss +++ b/web/app/assets/stylesheets/client/band.css.scss @@ -13,7 +13,7 @@ border:none; -webkit-box-shadow: inset 2px 2px 3px 0px #888; box-shadow: inset 2px 2px 3px 0px #888; - color:#666; + color:#000; overflow:auto; font-size:14px; } diff --git a/web/app/assets/stylesheets/client/content.css.scss b/web/app/assets/stylesheets/client/content.css.scss index 68434368c..9bee28a72 100644 --- a/web/app/assets/stylesheets/client/content.css.scss +++ b/web/app/assets/stylesheets/client/content.css.scss @@ -222,7 +222,6 @@ border:none; -webkit-box-shadow: inset 2px 2px 3px 0px #888; box-shadow: inset 2px 2px 3px 0px #888; - color:#666; } } diff --git a/web/app/assets/stylesheets/client/createSession.css.scss b/web/app/assets/stylesheets/client/createSession.css.scss index a4cbec1dd..83eeba993 100644 --- a/web/app/assets/stylesheets/client/createSession.css.scss +++ b/web/app/assets/stylesheets/client/createSession.css.scss @@ -209,7 +209,7 @@ border: none; -webkit-box-shadow: inset 2px 2px 3px 0px #888; box-shadow: inset 2px 2px 3px 0px #888; - color: #666; + color: #000; overflow: auto; font-size: 14px; diff --git a/web/app/assets/stylesheets/client/jamkazam.css.scss b/web/app/assets/stylesheets/client/jamkazam.css.scss index 46df063a6..8ccd7a022 100644 --- a/web/app/assets/stylesheets/client/jamkazam.css.scss +++ b/web/app/assets/stylesheets/client/jamkazam.css.scss @@ -302,7 +302,6 @@ input[type="button"] { .search-box { float:left; - width:140px; margin-left: 10px; -webkit-border-radius: 6px; border-radius: 6px; @@ -321,7 +320,6 @@ input[type="button"] { input[type="text"], input[type="password"]{ background-color:$ColorTextBoxBackground; border:none; - color:#666; padding:3px; font-size:15px; } diff --git a/web/app/assets/stylesheets/client/screen_common.css.scss b/web/app/assets/stylesheets/client/screen_common.css.scss index 30cc32a06..f36438ea4 100644 --- a/web/app/assets/stylesheets/client/screen_common.css.scss +++ b/web/app/assets/stylesheets/client/screen_common.css.scss @@ -143,7 +143,6 @@ textarea { border:none; -webkit-box-shadow: inset 2px 2px 3px 0px #888; box-shadow: inset 2px 2px 3px 0px #888; - color:#333; } diff --git a/web/app/assets/stylesheets/easydropdown_jk.css.scss b/web/app/assets/stylesheets/easydropdown_jk.css.scss index 4b2ff52b6..47e43c108 100644 --- a/web/app/assets/stylesheets/easydropdown_jk.css.scss +++ b/web/app/assets/stylesheets/easydropdown_jk.css.scss @@ -106,15 +106,12 @@ body.jam { .dropdown-wrapper li { padding: 5px 5px; font-size:15px; - - color: #666666; } .dropdown-wrapper li { margin:0; padding:3px; font-size:15px; - color: #666666; &.focus { background-color: #ed3618; @@ -151,8 +148,6 @@ body.jam div.dropdown { .selected, .dropdown li { padding: 5px 5px; font-size:15px; - - color: #666666; } .selected:after { box-shadow: none; @@ -166,7 +161,6 @@ body.jam div.dropdown { margin:0; padding:3px; font-size:15px; - color: #666666; &.focus { background-color: #ed3618; From dd95558d17d683b85d05057fd16a86613c1350b0 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sat, 18 Oct 2014 16:47:45 -0400 Subject: [PATCH 11/14] VRFS-2322 change color to black for instrument text on signup page --- web/app/assets/stylesheets/client/ftue.css.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/assets/stylesheets/client/ftue.css.scss b/web/app/assets/stylesheets/client/ftue.css.scss index ef81f1a39..1082b843e 100644 --- a/web/app/assets/stylesheets/client/ftue.css.scss +++ b/web/app/assets/stylesheets/client/ftue.css.scss @@ -528,14 +528,14 @@ div[layout-id="ftue3"] { border:none; -webkit-box-shadow: inset 2px 2px 3px 0px #888; box-shadow: inset 2px 2px 3px 0px #888; - color:#666; + color:#000; overflow:auto; font-size:14px; } .ftue-instrumentlist select, .ftue-instrumentlist .easydropdown { width:100%; - color:#666; + color:#000; } table.audiogeartable { From a8987efaa1ab4b5ef4d8245d3f2cde92c9075e11 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sun, 19 Oct 2014 21:18:05 -0400 Subject: [PATCH 12/14] VRFS-2337 added latency badge to musician hover bubble --- ruby/lib/jam_ruby/models/user.rb | 10 +++- web/app/assets/javascripts/hoverMusician.js | 24 ++++++++++ web/app/assets/javascripts/session_utils.js | 20 ++++---- .../stylesheets/client/hoverBubble.css.scss | 46 +++++++++++++++++++ web/app/views/api_users/show.rabl | 6 +++ web/app/views/clients/_hoverMusician.html.erb | 5 ++ web/app/views/clients/_musicians.html.erb | 8 ++-- 7 files changed, 103 insertions(+), 16 deletions(-) diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index b33a1d2c0..de0592801 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -324,7 +324,7 @@ module JamRuby read_attribute(:music_session_id) end - # ===== ARTIFICIAL ATTRIBUTES CREATED BY ActiveMusicSession.ams_users, MusicSession.sms_uses + # ===== ARTIFICIAL ATTRIBUTES CREATED BY ActiveMusicSession.ams_users, MusicSession.sms_users def full_score return nil unless has_attribute?(:full_score) a = read_attribute(:full_score) @@ -344,6 +344,14 @@ module JamRuby end # ====== END ARTIFICAL ATTRIBUTES + def score_info(destination_user) + if self.last_jam_locidispid && destination_user.last_jam_locidispid + self.connection.execute("select score from current_network_scores where alocidispid = #{self.last_jam_locidispid} and blocidispid = #{destination_user.last_jam_locidispid}").check + else + nil + end + end + # mods comes back as text; so give ourselves a parsed version def mods_json @mods_json ||= mods ? JSON.parse(mods, symbolize_names: true) : {} diff --git a/web/app/assets/javascripts/hoverMusician.js b/web/app/assets/javascripts/hoverMusician.js index 70f688d35..95548d3f4 100644 --- a/web/app/assets/javascripts/hoverMusician.js +++ b/web/app/assets/javascripts/hoverMusician.js @@ -7,8 +7,12 @@ var logger = context.JK.logger; var rest = context.JK.Rest(); var hoverSelector = "#musician-hover"; + var helpBubble = context.JK.HelpBubbleHelper; + var $templateLatency = null; + var sessionUtils = context.JK.SessionUtils; this.showBubble = function() { + $templateLatency = $("#template-account-session-latency"); var mouseLeft = x < (document.body.clientWidth / 2); var mouseTop = y < (document.body.clientHeight / 2); var css = {}; @@ -82,10 +86,29 @@ } } + var fullScore = null; + + if (response.last_jam_audio_latency && response.my_audio_latency && response.internet_score) { + response.last_jam_audio_latency + response.my_audio_latency + response.internet_score; + } + + // latency badge template needs these 2 properties + $.extend(response, { + audio_latency: response.last_jam_audio_latency, + full_score: fullScore + }); + + var latencyBadge = context._.template( + $templateLatency.html(), + $.extend(sessionUtils.createLatency(response), response), + {variable: 'data'} + ); + var musicianHtml = context.JK.fillTemplate(template, { userId: response.id, avatar_url: context.JK.resolveAvatarUrl(response.photo_url), name: response.name, + first_name: response.first_name, location: response.location, instruments: instrumentHtml, friend_count: response.friend_count, @@ -95,6 +118,7 @@ session_display: sessionDisplayStyle, join_display: joinDisplayStyle, sessionId: sessionId, + latency_badge: latencyBadge, //friendAction: response.is_friend ? "removeMusicianFriend" : (response.pending_friend_request ? "" : "sendMusicianFriendRequest"), friendAction: response.is_friend ? "" : (response.pending_friend_request ? "" : "sendMusicianFriendRequest"), followAction: response.is_following ? "removeMusicianFollowing" : "addMusicianFollowing", diff --git a/web/app/assets/javascripts/session_utils.js b/web/app/assets/javascripts/session_utils.js index 725da855d..482aaeab1 100644 --- a/web/app/assets/javascripts/session_utils.js +++ b/web/app/assets/javascripts/session_utils.js @@ -77,34 +77,34 @@ description = 'me'; } else if (!full_score) { - latencyDescription = LATENCY.UNKNOWN.description; + latencyDescription = LATENCY.UNKNOWN.description; latencyStyle = LATENCY.UNKNOWN.style; - iconName = 'purple' - description = 'missing' + iconName = 'purple'; + description = 'missing'; } else if (full_score <= LATENCY.GOOD.max) { latencyDescription = LATENCY.GOOD.description; latencyStyle = LATENCY.GOOD.style; - iconName = 'green' - description = 'good' + iconName = 'green'; + description = 'good'; } else if (full_score <= LATENCY.MEDIUM.max) { latencyDescription = LATENCY.MEDIUM.description; latencyStyle = LATENCY.MEDIUM.style; iconName = 'yellow'; - description = 'fair' + description = 'fair'; } else if (full_score <= LATENCY.POOR.max) { latencyDescription = LATENCY.POOR.description; latencyStyle = LATENCY.POOR.style; - iconName = 'red' - description = 'poor' + iconName = 'red'; + description = 'poor'; } else { latencyStyle = LATENCY.UNACCEPTABLE.style; latencyDescription = LATENCY.UNACCEPTABLE.description; - iconName = 'blue' - description = 'unacceptable' + iconName = 'blue'; + description = 'unacceptable'; } return { diff --git a/web/app/assets/stylesheets/client/hoverBubble.css.scss b/web/app/assets/stylesheets/client/hoverBubble.css.scss index a53fff3b8..b8d6ec315 100644 --- a/web/app/assets/stylesheets/client/hoverBubble.css.scss +++ b/web/app/assets/stylesheets/client/hoverBubble.css.scss @@ -1,3 +1,5 @@ +@import 'common'; + .bubble { width:350px; min-height:200px; @@ -74,4 +76,48 @@ -moz-border-radius:12px; border-radius:12px; } + + .musician-latency { + margin-right:35px; + position:relative; + width:350px; + } + + .latency-holder { + position:absolute; + width:100%; + text-align:center; + } + + .latency { + min-width: 50px; + display:inline-block; + padding:4px; + font-family:Arial, Helvetica, sans-serif; + font-weight:200; + font-size:11px; + text-align:center; + @include border-radius(2px); + color:white; + } + + .latency-unknown { + background-color:$latencyBadgeUnknown; + } + + .latency-unacceptable { + background-color:$latencyBadgeUnacceptable; + } + + .latency-good { + background-color:$latencyBadgeGood; + } + + .latency-fair{ + background-color:$latencyBadgeFair; + } + + .latency-poor { + background-color:$latencyBadgePoor; + } } \ No newline at end of file diff --git a/web/app/views/api_users/show.rabl b/web/app/views/api_users/show.rabl index b2827fdba..fd8b9b87e 100644 --- a/web/app/views/api_users/show.rabl +++ b/web/app/views/api_users/show.rabl @@ -30,6 +30,12 @@ elsif current_user node :pending_friend_request do |uu| current_user.pending_friend_request?(@user) end + node :my_audio_latency do |user| + current_user.last_jam_audio_latency.round if current_user.last_jam_audio_latency + end + node :internet_score do |user| + current_user.score_info(user) + end end child :friends => :friends do diff --git a/web/app/views/clients/_hoverMusician.html.erb b/web/app/views/clients/_hoverMusician.html.erb index 0a185a3ed..dd1994d6d 100644 --- a/web/app/views/clients/_hoverMusician.html.erb +++ b/web/app/views/clients/_hoverMusician.html.erb @@ -115,6 +115,11 @@
{biography}

+
+ Your latency to {first_name} is:  {latency_badge} +
+
+
FOLLOWING:

{followings} diff --git a/web/app/views/clients/_musicians.html.erb b/web/app/views/clients/_musicians.html.erb index 60279346f..1bc7256d8 100644 --- a/web/app/views/clients/_musicians.html.erb +++ b/web/app/views/clients/_musicians.html.erb @@ -50,11 +50,9 @@
-
-
Your latency
to {musician_first_name} is:
-
- {latency_badge} -
+
+
Your latency
to {musician_first_name} is: {latency_badge}
+
From d6c269fec109ffbb588e4f2583f0a3a700396348 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sun, 19 Oct 2014 21:19:23 -0400 Subject: [PATCH 13/14] VRFS-2337 fix bug --- web/app/assets/javascripts/hoverMusician.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/assets/javascripts/hoverMusician.js b/web/app/assets/javascripts/hoverMusician.js index 95548d3f4..97af8da8a 100644 --- a/web/app/assets/javascripts/hoverMusician.js +++ b/web/app/assets/javascripts/hoverMusician.js @@ -89,7 +89,7 @@ var fullScore = null; if (response.last_jam_audio_latency && response.my_audio_latency && response.internet_score) { - response.last_jam_audio_latency + response.my_audio_latency + response.internet_score; + fullScore = response.last_jam_audio_latency + response.my_audio_latency + response.internet_score; } // latency badge template needs these 2 properties From 9ef7d2474f23e2629b68de41223c314f45950a0b Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sun, 19 Oct 2014 21:22:31 -0400 Subject: [PATCH 14/14] revert accidental modifications to musician view --- web/app/views/clients/_musicians.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/app/views/clients/_musicians.html.erb b/web/app/views/clients/_musicians.html.erb index 1bc7256d8..cd626c8f0 100644 --- a/web/app/views/clients/_musicians.html.erb +++ b/web/app/views/clients/_musicians.html.erb @@ -51,8 +51,10 @@
-
Your latency
to {musician_first_name} is: {latency_badge}
- +
Your latency
to {musician_first_name} is:
+
+ {latency_badge} +