From e6ea200b19db68a12a0ec539af452ce3dcc88289 Mon Sep 17 00:00:00 2001 From: Scott Comer Date: Tue, 6 May 2014 19:48:31 -0500 Subject: [PATCH 01/64] useful command to drop all jam db and recreate jam db. --- resetdb.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 resetdb.sh diff --git a/resetdb.sh b/resetdb.sh new file mode 100755 index 000000000..5a06c1ff0 --- /dev/null +++ b/resetdb.sh @@ -0,0 +1,7 @@ +#!/bin/sh -x +dropdb jam +dropdb jam_db_build +dropdb jam_ruby_test +dropdb jam_web_test +dropdb jam_websocket_test +createdb -Upostgres jam From 8f06168f1cb19e286401780842acf748a69661e2 Mon Sep 17 00:00:00 2001 From: developer Date: Thu, 8 May 2014 23:18:57 +0800 Subject: [PATCH 02/64] VRFS-1654 - configure feed layout --- admin/Gemfile | 2 +- admin/app/admin/feeds.rb | 61 +++++++++++++++++++ admin/app/admin/mix.rb | 4 +- .../assets/stylesheets/active_admin.css.scss | 1 + admin/app/assets/stylesheets/custom.css.scss | 15 +++++ admin/app/views/admin/feed/_form.html.erb | 6 ++ admin/app/views/admin/feed/_index.html.erb | 23 +++++++ atlassian-ide-plugin.xml | 5 ++ 8 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 admin/app/admin/feeds.rb create mode 100644 admin/app/views/admin/feed/_form.html.erb create mode 100644 admin/app/views/admin/feed/_index.html.erb create mode 100644 atlassian-ide-plugin.xml diff --git a/admin/Gemfile b/admin/Gemfile index 8a47660de..a53c17f5e 100644 --- a/admin/Gemfile +++ b/admin/Gemfile @@ -102,7 +102,7 @@ group :development, :test do gem 'rspec-rails' gem 'guard-rspec', '0.5.5' gem 'jasmine', '1.3.1' - gem 'pry' + # gem 'pry' gem 'execjs', '1.4.0' gem 'therubyracer' #, '0.11.0beta8' gem 'factory_girl_rails', '4.1.0' diff --git a/admin/app/admin/feeds.rb b/admin/app/admin/feeds.rb new file mode 100644 index 000000000..e1f5c2913 --- /dev/null +++ b/admin/app/admin/feeds.rb @@ -0,0 +1,61 @@ +ActiveAdmin.register_page 'Feed' do + content do + + # get user information via params + user_id = nil + user_id = params[:feed][:user_id] if params[:feed] + user_name = User.find(user_id).name if user_id + user_name = "All" unless user_id + + render :partial => 'form', :locals => {param: params} + + offset = 0 + limit = 10 + + # get feed ids + where_sql = '' + where_sql = "where user_id = '#{user_id}'" if user_id + sql_feed_ids = "SELECT id, 'music_session_histories' as type, created_at FROM music_sessions_history #{where_sql} + UNION ALL + SELECT DISTINCT recording_id as id, 'recordings' as type, created_at FROM recorded_tracks #{where_sql} + UNION ALL + SELECT id, 'diagnostics' as type, created_at FROM diagnostics #{where_sql} + ORDER BY created_at DESC + OFFSET #{offset} + LIMIT #{limit};" + + models = [] + id_types = ActiveRecord::Base.connection.execute(sql_feed_ids).values + id_types.each do |id_and_type| + if id_and_type[1] == "music_session_histories" + models << JamRuby::MusicSessionHistory.find(id_and_type[0]) + # elsif id_and_type[1] == "recordings" + # models << JamRuby::Recording.find(id_and_type[0]) + elsif id_and_type[1] == "recordings" + models << JamRuby::Diagnostics.find(id_and_type[0]) + else + raise "Unknown type returned from feed ids" + end + end + + columns do + column do + panel "Activity - #{user_name}" do + para id_types.inspect + ul do + models.each do |model| + li do + text_node model.inspect + end + end + end + end + end + end + end + + controller do + def index + end + end +end \ No newline at end of file diff --git a/admin/app/admin/mix.rb b/admin/app/admin/mix.rb index f2c86e7ec..16c623ca1 100644 --- a/admin/app/admin/mix.rb +++ b/admin/app/admin/mix.rb @@ -24,8 +24,8 @@ ActiveAdmin.register JamRuby::Mix, :as => 'Mixes' do attributes_table_for(mix) do row :recording do |mix| auto_link(mix.recording, mix.recording.id) end row :created_at do |mix| mix.created_at.strftime('%b %d %Y, %H:%M') end - row :s3_url do |mix| mix.url end - row :manifest do |mix| mix.manifest end + # row :s3_url do |mix| mix.url end + # row :manifest do |mix| mix.manifest end row :completed do |mix| "#{mix.completed ? "finished" : "not finished"}" end if mix.completed row :completed_at do |mix| mix.completed_at.strftime('%b %d %Y, %H:%M') end diff --git a/admin/app/assets/stylesheets/active_admin.css.scss b/admin/app/assets/stylesheets/active_admin.css.scss index 4798f7467..48aa7bb98 100644 --- a/admin/app/assets/stylesheets/active_admin.css.scss +++ b/admin/app/assets/stylesheets/active_admin.css.scss @@ -9,6 +9,7 @@ /* *= require jquery.ui.all +*= require custom */ // Active Admin's got SASS! @import "active_admin/mixins"; diff --git a/admin/app/assets/stylesheets/custom.css.scss b/admin/app/assets/stylesheets/custom.css.scss index 97651a7af..d3dabb8d0 100644 --- a/admin/app/assets/stylesheets/custom.css.scss +++ b/admin/app/assets/stylesheets/custom.css.scss @@ -2,4 +2,19 @@ .version-info { font-size:small; color:lightgray; +} + +.feed-pagination { + height: 20px; + .pagination { + float: left !important; + + ul { + list-style-type: none; + + li { + float: left; + } + } + } } \ No newline at end of file diff --git a/admin/app/views/admin/feed/_form.html.erb b/admin/app/views/admin/feed/_form.html.erb new file mode 100644 index 000000000..b72d211e3 --- /dev/null +++ b/admin/app/views/admin/feed/_form.html.erb @@ -0,0 +1,6 @@ +<%= semantic_form_for :feed, url: admin_feed_path, method: :get do |f| %> + <%= f.inputs do %> + <%= f.input :user, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path, :input_html => { :id_element => "#feed_user_id" }%> + <%= f.input :user_id, :as => :hidden %> + <% end %> +<% end %> \ No newline at end of file diff --git a/admin/app/views/admin/feed/_index.html.erb b/admin/app/views/admin/feed/_index.html.erb new file mode 100644 index 000000000..7ad3e71d2 --- /dev/null +++ b/admin/app/views/admin/feed/_index.html.erb @@ -0,0 +1,23 @@ + + + + + + + + <% @users.each do |user| %> + + + + <% end %> + +
User Name - <%= @user_id %>
+

+ <%= link_to admin_feed_path(feed: {user_id: user.id}) do %> + <%= user.name %> + <% end %>

+
+ +
+ <%= will_paginate @users %> +
\ No newline at end of file diff --git a/atlassian-ide-plugin.xml b/atlassian-ide-plugin.xml new file mode 100644 index 000000000..858eed55c --- /dev/null +++ b/atlassian-ide-plugin.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file From ac8a9a5af6ea9d6312d30930843a7b16d9b3b74e Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Thu, 8 May 2014 18:00:49 -0500 Subject: [PATCH 03/64] VRFS-1705 - fix test-www by a slight decouple --- web/spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/spec/spec_helper.rb b/web/spec/spec_helper.rb index 3ff0f6e46..5af0fbc83 100644 --- a/web/spec/spec_helper.rb +++ b/web/spec/spec_helper.rb @@ -30,7 +30,7 @@ db_config = YAML::load(File.open('config/database.yml'))["test"] bputs "before recreate db" -SpecDb::recreate_database(db_config) +SpecDb::recreate_database(db_config) unless ENV["TEST_WWW"] == "1" bputs "before connect db" ActiveRecord::Base.establish_connection(YAML::load(File.open('config/database.yml'))["test"]) From 3f688a8392e74b3a0b14d571f6b5b8cc337afce8 Mon Sep 17 00:00:00 2001 From: Scott Comer Date: Thu, 8 May 2014 19:44:52 -0500 Subject: [PATCH 04/64] update user home base (last_jam_blah) fields upon registation and joining a music session as a musician --- db/manifest | 1 + db/up/add_last_jam_user_fields.sql | 8 +++++ ruby/lib/jam_ruby/connection_manager.rb | 2 +- ruby/lib/jam_ruby/models/connection.rb | 7 ++++- ruby/lib/jam_ruby/models/user.rb | 17 +++++++++- .../jam_ruby/models/claimed_recording_spec.rb | 2 +- ruby/spec/jam_ruby/models/mix_spec.rb | 2 +- .../jam_ruby/models/music_session_spec.rb | 2 +- .../jam_ruby/models/musician_search_spec.rb | 4 +-- ruby/spec/jam_ruby/models/recording_spec.rb | 4 +-- web/lib/max_mind_manager.rb | 31 +++++++++++++------ web/lib/user_manager.rb | 14 ++++++--- .../api_claimed_recordings_spec.rb | 2 +- web/spec/features/social_meta_spec.rb | 4 +-- web/spec/helpers/recording_helper_spec.rb | 2 +- web/spec/requests/music_sessions_api_spec.rb | 2 +- web/spec/requests/users_api_spec.rb | 7 +++-- 17 files changed, 80 insertions(+), 31 deletions(-) create mode 100644 db/up/add_last_jam_user_fields.sql diff --git a/db/manifest b/db/manifest index 637e56cc4..55c694c7d 100755 --- a/db/manifest +++ b/db/manifest @@ -151,3 +151,4 @@ user_mods.sql connection_stale_expire.sql rename_chat_messages.sql fix_connection_fields.sql +add_last_jam_user_fields.sql diff --git a/db/up/add_last_jam_user_fields.sql b/db/up/add_last_jam_user_fields.sql new file mode 100644 index 000000000..5542ec4c7 --- /dev/null +++ b/db/up/add_last_jam_user_fields.sql @@ -0,0 +1,8 @@ +ALTER TABLE users ADD COLUMN last_jam_addr BIGINT; + +ALTER TABLE users ADD COLUMN last_jam_locidispid BIGINT; + +-- (j)oin session as musician, (r)egister, (f)tue, (n)etwork test +ALTER TABLE users ADD COLUMN last_jam_updated_reason CHAR(1); + +ALTER TABLE users ADD COLUMN last_jam_updated_at TIMESTAMP; diff --git a/ruby/lib/jam_ruby/connection_manager.rb b/ruby/lib/jam_ruby/connection_manager.rb index 59e7b8735..74aadc59c 100644 --- a/ruby/lib/jam_ruby/connection_manager.rb +++ b/ruby/lib/jam_ruby/connection_manager.rb @@ -352,7 +352,7 @@ SQL connection = Connection.find_by_client_id_and_user_id!(client_id, user.id) - connection.join_the_session(music_session, as_musician, tracks) + connection.join_the_session(music_session, as_musician, tracks, user) # connection.music_session_id = music_session.id # connection.as_musician = as_musician # connection.joining_session = true diff --git a/ruby/lib/jam_ruby/models/connection.rb b/ruby/lib/jam_ruby/models/connection.rb index 8e9836c30..6bc4a2530 100644 --- a/ruby/lib/jam_ruby/models/connection.rb +++ b/ruby/lib/jam_ruby/models/connection.rb @@ -146,13 +146,18 @@ module JamRuby true end - def join_the_session(music_session, as_musician, tracks) + def join_the_session(music_session, as_musician, tracks, user) self.music_session_id = music_session.id self.as_musician = as_musician self.joining_session = true self.joined_session_at = Time.now associate_tracks(tracks) unless tracks.nil? self.save + + # if user joins the session as a musician, update their addr and location + if as_musician + user.update_addr_loc(self, 'j') + end end def associate_tracks(tracks) diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 22a4a426e..eb4b9876b 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -773,7 +773,14 @@ module JamRuby user.country = location[:country] user.birth_date = birth_date - if user.musician # only update instruments if the user is a musician + if musician + user.last_jam_addr = location[:addr] + user.last_jam_locidispid = location[:locidispid] + user.last_jam_updated_reason = 'r' + user.last_jam_updated_at = Time.now + end + + if musician # only update instruments if the user is a musician unless instruments.nil? instruments.each do |musician_instrument_param| instrument = Instrument.find(musician_instrument_param[:instrument_id]) @@ -1138,6 +1145,14 @@ module JamRuby end end + def update_addr_loc(connection, reason) + self.last_jam_addr = connection.addr + self.last_jam_locidispid = connection.locidispid + self.last_jam_updated_reason = reason + self.last_jam_updated_at = Time.now + self.save + end + def top_followings @topf ||= User.joins("INNER JOIN follows ON follows.followable_id = users.id AND follows.followable_type = '#{self.class.to_s}'") .where(['follows.user_id = ?', self.id]) diff --git a/ruby/spec/jam_ruby/models/claimed_recording_spec.rb b/ruby/spec/jam_ruby/models/claimed_recording_spec.rb index fae09a6ab..e6be9e50b 100644 --- a/ruby/spec/jam_ruby/models/claimed_recording_spec.rb +++ b/ruby/spec/jam_ruby/models/claimed_recording_spec.rb @@ -21,7 +21,7 @@ describe ClaimedRecording do @music_session = FactoryGirl.create(:music_session, :creator => @user, :musician_access => true) # @music_session.connections << @connection @music_session.save - @connection.join_the_session(@music_session, true, nil) + @connection.join_the_session(@music_session, true, nil, @user) @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload diff --git a/ruby/spec/jam_ruby/models/mix_spec.rb b/ruby/spec/jam_ruby/models/mix_spec.rb index 7acb05f81..c04cfada3 100755 --- a/ruby/spec/jam_ruby/models/mix_spec.rb +++ b/ruby/spec/jam_ruby/models/mix_spec.rb @@ -10,7 +10,7 @@ describe Mix do @music_session = FactoryGirl.create(:music_session, :creator => @user, :musician_access => true) # @music_session.connections << @connection @music_session.save - @connection.join_the_session(@music_session, true, nil) + @connection.join_the_session(@music_session, true, nil, @user) @recording = Recording.start(@music_session, @user) @recording.stop @recording.claim(@user, "name", "description", Genre.first, true) diff --git a/ruby/spec/jam_ruby/models/music_session_spec.rb b/ruby/spec/jam_ruby/models/music_session_spec.rb index f76e264a8..8d48b5f57 100644 --- a/ruby/spec/jam_ruby/models/music_session_spec.rb +++ b/ruby/spec/jam_ruby/models/music_session_spec.rb @@ -398,7 +398,7 @@ describe MusicSession do @music_session = FactoryGirl.create(:music_session, :creator => @user1, :musician_access => true) # @music_session.connections << @connection @music_session.save! - @connection.join_the_session(@music_session, true, nil) + @connection.join_the_session(@music_session, true, nil, @user1) end describe "not recording" do diff --git a/ruby/spec/jam_ruby/models/musician_search_spec.rb b/ruby/spec/jam_ruby/models/musician_search_spec.rb index a3c1bdf07..70f220adb 100644 --- a/ruby/spec/jam_ruby/models/musician_search_spec.rb +++ b/ruby/spec/jam_ruby/models/musician_search_spec.rb @@ -115,7 +115,7 @@ describe 'Musician search' do music_session = FactoryGirl.create(:music_session, :creator => usr, :musician_access => true) # music_session.connections << connection music_session.save - connection.join_the_session(music_session, true, nil) + connection.join_the_session(music_session, true, nil, usr) recording = Recording.start(music_session, usr) recording.stop recording.reload @@ -130,7 +130,7 @@ describe 'Musician search' do music_session = FactoryGirl.create(:music_session, :creator => usr, :musician_access => true) # music_session.connections << connection music_session.save - connection.join_the_session(music_session, true, nil) + connection.join_the_session(music_session, true, nil, usr) end context 'musician stat counters' do diff --git a/ruby/spec/jam_ruby/models/recording_spec.rb b/ruby/spec/jam_ruby/models/recording_spec.rb index 56ccf176a..e66d8be6f 100644 --- a/ruby/spec/jam_ruby/models/recording_spec.rb +++ b/ruby/spec/jam_ruby/models/recording_spec.rb @@ -80,7 +80,7 @@ describe Recording do @track2 = FactoryGirl.create(:track, :connection => @connection2, :instrument => @instrument2) # @music_session.connections << @connection2 - @connection2.join_the_session(@music_session, true, nil) + @connection2.join_the_session(@music_session, true, nil, @user2) @recording = Recording.start(@music_session, @user) @user.recordings.length.should == 0 @@ -179,7 +179,7 @@ describe Recording do @track = FactoryGirl.create(:track, :connection => @connection2, :instrument => @instrument) # @music_session.connections << @connection2 @music_session.save - @connection2.join_the_session(@music_session, true, nil) + @connection2.join_the_session(@music_session, true, nil, @user2) @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload diff --git a/web/lib/max_mind_manager.rb b/web/lib/max_mind_manager.rb index e3a2a54f0..49353761a 100644 --- a/web/lib/max_mind_manager.rb +++ b/web/lib/max_mind_manager.rb @@ -10,7 +10,8 @@ class MaxMindManager < BaseManager def self.lookup(ip_address) city = state = country = nil - + locid = ispid = 0 + unless ip_address.nil? || ip_address !~ /^\d+\.\d+\.\d+\.\d+$/ #ActiveRecord::Base.connection_pool.with_connection do |connection| # pg_conn = connection.instance_variable_get("@connection") @@ -23,17 +24,29 @@ class MaxMindManager < BaseManager # end # end #end - ip_as_int = ip_address_to_int(ip_address) - block = GeoIpBlocks.lookup(ip_as_int) - location = block ? GeoIpLocations.lookup(block.locid) : nil - if location - country = location.countrycode - state = location.region - city = location.city + + addr = ip_address_to_int(ip_address) + + block = GeoIpBlocks.lookup(addr) + if block + locid = block.locid + + location = GeoIpLocations.lookup(locid) + if location + # todo translate countrycode to country, region(code) to region + country = location.countrycode + state = location.region + city = location.city + end + end + + isp = JamIsp.lookup(addr) + if isp + ispid = isp.coid end end - a = {:city => city, :state => state, :country => country} + {city: city, state: state, country: country, addr: addr, locidispid: locid*1000000+ispid} end def self.lookup_isp(ip_address) diff --git a/web/lib/user_manager.rb b/web/lib/user_manager.rb index 34be86248..d6765ad42 100644 --- a/web/lib/user_manager.rb +++ b/web/lib/user_manager.rb @@ -35,9 +35,15 @@ class UserManager < BaseManager raise PermissionError, "Signups are currently disabled" end - # a user should be able to specify their location, but if they don't, we'll best effort it - if location.nil? - location = MaxMindManager.lookup(remote_ip) + loc = MaxMindManager.lookup(remote_ip) + # there are three cases here: if location is missing, we'll auto set the city, etc. from + # the ip address; if location is present, empty or not empty, we'll set the city, etc. from + # what is present in location. we should NOT normally default city, etc. for the user, they + # own it, they may want it to be unspecified, that is their right. + if location + loc[:city] = location[:city] + loc[:state] = location[:state] + loc[:country] = location[:country] end # TODO: figure out why can't user verify_recaptcha here @@ -54,7 +60,7 @@ class UserManager < BaseManager password: password, password_confirmation: password_confirmation, terms_of_service: terms_of_service, - location: location, + location: loc, instruments: instruments, birth_date: birth_date, musician: musician, diff --git a/web/spec/controllers/api_claimed_recordings_spec.rb b/web/spec/controllers/api_claimed_recordings_spec.rb index 7c4b39560..77182b32c 100644 --- a/web/spec/controllers/api_claimed_recordings_spec.rb +++ b/web/spec/controllers/api_claimed_recordings_spec.rb @@ -11,7 +11,7 @@ describe ApiClaimedRecordingsController do @music_session = FactoryGirl.create(:music_session, :creator => @user, :musician_access => true) # @music_session.connections << @connection @music_session.save - @connection.join_the_session(@music_session, true, nil) + @connection.join_the_session(@music_session, true, nil, @user) @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload diff --git a/web/spec/features/social_meta_spec.rb b/web/spec/features/social_meta_spec.rb index db5dc403f..19b638aa0 100644 --- a/web/spec/features/social_meta_spec.rb +++ b/web/spec/features/social_meta_spec.rb @@ -65,7 +65,7 @@ describe "social metadata" do ms = FactoryGirl.create(:music_session, :creator => user, :musician_access => true) # ms.connections << connection ms.save! - connection.join_the_session(ms, true, nil) + connection.join_the_session(ms, true, nil, user) ms } @@ -93,7 +93,7 @@ describe "social metadata" do @music_session = FactoryGirl.create(:music_session, :creator => @user, :musician_access => true) # @music_session.connections << @connection @music_session.save - @connection.join_the_session(@music_session, true, nil) + @connection.join_the_session(@music_session, true, nil, @user) @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload diff --git a/web/spec/helpers/recording_helper_spec.rb b/web/spec/helpers/recording_helper_spec.rb index 30ef78ff2..536fa4496 100644 --- a/web/spec/helpers/recording_helper_spec.rb +++ b/web/spec/helpers/recording_helper_spec.rb @@ -10,7 +10,7 @@ describe MusicSessionHelper do @music_session = FactoryGirl.create(:music_session, :creator => @user, :musician_access => true) # @music_session.connections << @connection @music_session.save - @connection.join_the_session(@music_session, true, nil) + @connection.join_the_session(@music_session, true, nil, @user) @recording = Recording.start(@music_session, @user) @recording.stop @recording.reload diff --git a/web/spec/requests/music_sessions_api_spec.rb b/web/spec/requests/music_sessions_api_spec.rb index 592a375c9..6a5c35947 100755 --- a/web/spec/requests/music_sessions_api_spec.rb +++ b/web/spec/requests/music_sessions_api_spec.rb @@ -700,7 +700,7 @@ describe "Music Session API ", :type => :api do music_session = FactoryGirl.create(:music_session, :creator => user, :musician_access => true) # music_session.connections << connection music_session.save - connection.join_the_session(music_session, true, nil) + connection.join_the_session(music_session, true, nil, user) recording = Recording.start(music_session, user) recording.stop recording.reload diff --git a/web/spec/requests/users_api_spec.rb b/web/spec/requests/users_api_spec.rb index 07dd6eae4..fd46ed5bc 100644 --- a/web/spec/requests/users_api_spec.rb +++ b/web/spec/requests/users_api_spec.rb @@ -985,8 +985,9 @@ describe "User API", :type => :api do ms = FactoryGirl.create(:music_session, :creator => user, :musician_access => true) # ms.connections << connection ms.save! - connection.join_the_session(ms, true, nil) - ms } + connection.join_the_session(ms, true, nil, user) + ms + } it "fetches facebook successfully" do login(user.email, user.password, 200, true) @@ -1122,7 +1123,7 @@ describe "User API", :type => :api do @music_session = FactoryGirl.create(:music_session, :creator => user, :musician_access => true) # @music_session.connections << @connection @music_session.save - @connection.join_the_session(@music_session, true, nil) + @connection.join_the_session(@music_session, true, nil, user) @recording = Recording.start(@music_session, user) @recording.stop @recording.reload From 2c58ded35f6857e762f22c39230b854a4ea6d6e1 Mon Sep 17 00:00:00 2001 From: Bert Owen Date: Sat, 10 May 2014 00:37:51 +0800 Subject: [PATCH 05/64] VRFS-1700 fixed --- ruby/lib/jam_ruby/models/chat_message.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ruby/lib/jam_ruby/models/chat_message.rb b/ruby/lib/jam_ruby/models/chat_message.rb index c02ed1d7b..028e2d411 100644 --- a/ruby/lib/jam_ruby/models/chat_message.rb +++ b/ruby/lib/jam_ruby/models/chat_message.rb @@ -27,7 +27,10 @@ module JamRuby start = params[:start].presence start = start.to_i || 0 - query = ChatMessage.offset(start).limit(limit) + music_session_id = params[:music_session] + + query = ChatMessage.where('music_session_id = ?', music_session_id) + .offset(start).limit(limit) if query.length == 0 [query, nil] From dc6dec76cfdd498aa78973fd478c9dc66861cb15 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 9 May 2014 14:27:18 -0500 Subject: [PATCH 06/64] * move registerChatMessage so that it always gets a chance to fire --- web/app/assets/javascripts/chatPanel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/assets/javascripts/chatPanel.js b/web/app/assets/javascripts/chatPanel.js index fef16ab0b..7b7496a53 100644 --- a/web/app/assets/javascripts/chatPanel.js +++ b/web/app/assets/javascripts/chatPanel.js @@ -139,14 +139,14 @@ $form.submit(sendMessage); $textBox.keydown(handleEnter); $sendChatMessageBtn.click(sendMessage); - - registerChatMessage(bind); } else { $form.submit(null); $textBox.keydown(null); $sendChatMessageBtn.click(null); } + + registerChatMessage(bind); } // called from sidebar when messages come in From e3b17fb439841b6c71e586992f4c81facec42d20 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Fri, 9 May 2014 14:36:03 -0500 Subject: [PATCH 07/64] * .touch on the history entries --- admin/spec/features/feeds_spec.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/admin/spec/features/feeds_spec.rb b/admin/spec/features/feeds_spec.rb index 7c468c2f1..81f28e97e 100644 --- a/admin/spec/features/feeds_spec.rb +++ b/admin/spec/features/feeds_spec.rb @@ -49,6 +49,9 @@ describe 'Feeds' do describe 'activities' do before do + music_session.touch + recording.touch + diagnostic.touch visit admin_feed_path end From 589b0dad343a1da2d81e180cceb691407dec6fe9 Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Sat, 10 May 2014 05:59:19 +0000 Subject: [PATCH 08/64] VRFS-1706 fixed sporadic display of session rating --- web/app/views/clients/_rateSession.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/views/clients/_rateSession.html.erb b/web/app/views/clients/_rateSession.html.erb index fa87832f5..abc9d2bb5 100644 --- a/web/app/views/clients/_rateSession.html.erb +++ b/web/app/views/clients/_rateSession.html.erb @@ -1,4 +1,4 @@ -
+
<%= image_tag "shared/icon_session.png", {:height => 19, :width => 19, :class => "content-icon"} %> From 5d5dc51434da495bab19979ffcc619decf785655 Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Sat, 10 May 2014 14:08:39 -0500 Subject: [PATCH 09/64] Slight fix to chat text in sidebar --- web/app/views/clients/_sidebar.html.erb | 2 +- web/spec/features/chat_message_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/app/views/clients/_sidebar.html.erb b/web/app/views/clients/_sidebar.html.erb index 8836beb67..8c79172f6 100644 --- a/web/app/views/clients/_sidebar.html.erb +++ b/web/app/views/clients/_sidebar.html.erb @@ -102,7 +102,7 @@
- Chat is available during session is connected. + Chat is available when session is connected.
diff --git a/web/spec/features/chat_message_spec.rb b/web/spec/features/chat_message_spec.rb index 159f032d8..baaaf18ad 100644 --- a/web/spec/features/chat_message_spec.rb +++ b/web/spec/features/chat_message_spec.rb @@ -25,7 +25,7 @@ describe "Chat Message", :js => true, :type => :feature, :capybara_feature => tr sign_in_poltergeist(user1) find("[layout-id=\"panelChat\"] .panel-header").trigger(:click) - find(".chat-status", text: 'Chat is available during session is connected.') + find(".chat-status", text: 'Chat is available when session is connected.') end end From bf18a936c81ac611b09a869627d4e189ddcb3147 Mon Sep 17 00:00:00 2001 From: Anthony Davis Date: Sat, 10 May 2014 14:16:17 -0500 Subject: [PATCH 10/64] VRFS-1708 - fix failing feed tests, remove interdependency --- web/spec/features/feed_spec.rb | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/web/spec/features/feed_spec.rb b/web/spec/features/feed_spec.rb index 9fb9ec5a0..a177c63b5 100644 --- a/web/spec/features/feed_spec.rb +++ b/web/spec/features/feed_spec.rb @@ -4,7 +4,7 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do let (:user) { FactoryGirl.create(:user) } - before(:all) do + before(:each) do MusicSession.delete_all Recording.delete_all end @@ -13,7 +13,6 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do describe "sessions" do before(:each) do - MusicSession.delete_all create_session(creator: user) formal_leave_by(user) end @@ -94,11 +93,11 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do describe "recordings" do before(:each) do - MusicSession.delete_all - Recording.delete_all start_recording_with(user) stop_recording + claim_recording("my recording", "my recording description") formal_leave_by(user) + MusicSession.delete_all end # it "should render avatar" do @@ -127,13 +126,6 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do it "should render stats" do visit "/client#/feed" - # close recording finished dialog - claim_recording("my recording", "my recording description") - - MusicSession.delete_all - - find('#btn-refresh-feed').trigger(:click) - # initial stats find('span.plays').should have_content('0') find('span.comments').should have_content('0') @@ -161,13 +153,6 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do it "should render details" do visit "/client#/feed" - # close recording finished dialog - claim_recording("my recording", "my recording description") - - MusicSession.delete_all - - find('#btn-refresh-feed').trigger(:click) - find('.feed-details a.details').trigger(:click) # confirm user avatar exists From f83f333dd144eb57c1ef244f1778408beaac837e Mon Sep 17 00:00:00 2001 From: Jonathan Kolyer Date: Sun, 11 May 2014 00:17:44 +0000 Subject: [PATCH 11/64] VRFS-736 like us features --- web/app/controllers/users_controller.rb | 15 +++++++++------ web/app/views/clients/_footer.html.erb | 7 +++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/web/app/controllers/users_controller.rb b/web/app/controllers/users_controller.rb index d380c6b34..3a52f9e3b 100644 --- a/web/app/controllers/users_controller.rb +++ b/web/app/controllers/users_controller.rb @@ -370,18 +370,21 @@ class UsersController < ApplicationController end def endorse - if uu = User.where(['id = ? AND first_liked_us IS NULL',params[:id]]).limit(1).first + if uu = current_user || + uu = User.where(['id = ? AND first_liked_us IS NULL',params[:id]]).limit(1).first uu.first_liked_us = Time.now uu.save! - end if params[:id].present? + end if params[:id].present? && (service=params[:service]).present? - url, service = 'http://www.jamkazam.com', params[:service] + service ||= 'facebook' + url = CGI::escape('http://www.jamkazam.com') + txt = CGI::escape('Check out JamKazam -- Play music together over the Internet as if in the same room') if 'twitter'==service - url = 'https://twitter.com/jamkazam' + url = "https://twitter.com/intent/tweet?text=#{txt}&url=#{url}" elsif 'facebook'==service - url = 'https://www.facebook.com/JamKazam' + url = "http://www.facebook.com/sharer/sharer.php?u=#{url}&t=#{txt}" elsif 'google'==service - url = 'https://plus.google.com/u/0/106619885929396862606/about' + url = "https://plus.google.com/share?url=#{url}" end redirect_to url end diff --git a/web/app/views/clients/_footer.html.erb b/web/app/views/clients/_footer.html.erb index 5c4fee259..fdbcf9b0a 100644 --- a/web/app/views/clients/_footer.html.erb +++ b/web/app/views/clients/_footer.html.erb @@ -1,3 +1,10 @@ +
+
+ <% [:twitter, :facebook, :google].each do |src| %> + <%= link_to(image_tag("http://www.jamkazam.com/assets/content/icon_#{src}.png", :style => "vertical-align:top"), "/endorse/0/#{src}") %>  + <% end %> +
+