From 956ff422f403610518048b5b364af75037855f89 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Wed, 19 Feb 2014 22:48:34 -0500 Subject: [PATCH 01/28] fix sidebar for recordings --- ruby/lib/jam_ruby/models/band.rb | 3 +-- ruby/lib/jam_ruby/models/music_session_history.rb | 4 ---- ruby/lib/jam_ruby/models/recording.rb | 8 -------- ruby/lib/jam_ruby/models/user.rb | 3 +-- web/app/views/recordings/show.html.erb | 2 +- web/app/views/shared/_landing_sidebar.html.erb | 7 ++++--- 6 files changed, 7 insertions(+), 20 deletions(-) diff --git a/ruby/lib/jam_ruby/models/band.rb b/ruby/lib/jam_ruby/models/band.rb index 72838fad0..ea14cabe5 100644 --- a/ruby/lib/jam_ruby/models/band.rb +++ b/ruby/lib/jam_ruby/models/band.rb @@ -67,8 +67,7 @@ module JamRuby end def recent_history - recordings = ClaimedRecording.joins(:recording) - .where(:recordings => {:band_id => "#{self.id}"}) + recordings = Recording.where(:band_id => self.id) .order('created_at DESC') .limit(10) diff --git a/ruby/lib/jam_ruby/models/music_session_history.rb b/ruby/lib/jam_ruby/models/music_session_history.rb index b98d1d106..1c917fa2a 100644 --- a/ruby/lib/jam_ruby/models/music_session_history.rb +++ b/ruby/lib/jam_ruby/models/music_session_history.rb @@ -39,10 +39,6 @@ module JamRuby feed.music_session_history = self end - def like_count - self.likes.size - end - def comment_count self.comments.size end diff --git a/ruby/lib/jam_ruby/models/recording.rb b/ruby/lib/jam_ruby/models/recording.rb index 7e8ea3ac9..8fc666e0f 100644 --- a/ruby/lib/jam_ruby/models/recording.rb +++ b/ruby/lib/jam_ruby/models/recording.rb @@ -40,14 +40,6 @@ module JamRuby self.band_id = nil if self.band_id == '' end - def like_count - self.likes.size - end - - def play_count - self.plays.size - end - def comment_count self.comments.size end diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 1c4f49700..7ff867717 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -275,8 +275,7 @@ module JamRuby end def recent_history - recordings = ClaimedRecording.joins(:recording) - .where(:recordings => {:owner_id => "#{self.id}"}) + recordings = Recording.where(:owner_id => self.id) .order('created_at DESC') .limit(10) diff --git a/web/app/views/recordings/show.html.erb b/web/app/views/recordings/show.html.erb index 82ea6adb5..dff09958b 100644 --- a/web/app/views/recordings/show.html.erb +++ b/web/app/views/recordings/show.html.erb @@ -18,7 +18,7 @@ <% end %>
- <% unless @claimed_recording.recording.band.nil? %> + <% unless @claimed_recording.recording.band.blank? %>
<% unless @claimed_recording.recording.band.photo_url.blank? %> <%= image_tag "#{@claimed_recording.recording.band.photo_url}", {:alt => ""} %> diff --git a/web/app/views/shared/_landing_sidebar.html.erb b/web/app/views/shared/_landing_sidebar.html.erb index ab14d09fc..673acebf7 100644 --- a/web/app/views/shared/_landing_sidebar.html.erb +++ b/web/app/views/shared/_landing_sidebar.html.erb @@ -4,14 +4,15 @@ <% recent_history.each do |history_record| %> - <% if history_record.instance_of? ClaimedRecording %> + <% if history_record.instance_of? Recording %>
<%= history_record.created_at.strftime("%b #{history_record.created_at.day.ordinalize}") %>:
+
<%= history_record.claimed_recordings.first.description %>
<% elsif history_record.instance_of? MusicSessionHistory %>
@@ -31,9 +32,9 @@ Session Ended. Unavailable. <% end %>
+
<%= history_record.description %>
<% end %> -
<%= history_record.description %>
<% if history_record != recent_history.last %>

<% end %> From 069e9c829708fb696218e1f3eb500f5cbaa0448c Mon Sep 17 00:00:00 2001 From: Daniel Weigh Date: Thu, 20 Feb 2014 00:18:11 -0500 Subject: [PATCH 02/28] VRFS-1135 allow empty string to be passed in to start parameter (due to jQuery not stripping null / empty params and refactor) --- ruby/lib/jam_ruby/models/feed.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby/lib/jam_ruby/models/feed.rb b/ruby/lib/jam_ruby/models/feed.rb index 27ba46c68..f85912c58 100644 --- a/ruby/lib/jam_ruby/models/feed.rb +++ b/ruby/lib/jam_ruby/models/feed.rb @@ -20,7 +20,7 @@ module JamRuby sort ||= 'date' raise "not valid sort #{sort}" unless SORT_TYPES.include?(sort) - start = params[:start] + start = params[:start].presence if sort == 'date' start ||= FIXNUM_MAX else From ca64966c7f2dcd2b5098539237290fe70caa0a66 Mon Sep 17 00:00:00 2001 From: Daniel Weigh Date: Thu, 20 Feb 2014 00:16:59 -0500 Subject: [PATCH 03/28] * duplicate entry $ bundle exec rails server Your Gemfile lists the gem bcrypt-ruby (= 3.0.1) more than once. You should probably keep only one of them. While it's not a problem now, it could cause errors if you change the version of just one of them later. --- admin/Gemfile | 1 - 1 file changed, 1 deletion(-) diff --git a/admin/Gemfile b/admin/Gemfile index 74f6a2125..5ec8a3411 100644 --- a/admin/Gemfile +++ b/admin/Gemfile @@ -37,7 +37,6 @@ gem 'bootstrap-will_paginate', '0.0.6' gem 'carrierwave', '0.9.0' gem 'carrierwave_direct' gem 'uuidtools', '2.1.2' -gem 'bcrypt-ruby', '3.0.1' gem 'jquery-rails' # , '2.3.0' # pinned because jquery-ui-rails was split from jquery-rails, but activeadmin doesn't support this gem yet gem 'jquery-ui-rails' gem 'rails3-jquery-autocomplete' From 1ecc21fd9c1ca053dbf74709af510bf0a632d9a3 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 20 Feb 2014 02:03:00 -0500 Subject: [PATCH 04/28] VRFS-1188 play/pause for recording landing page --- .../stylesheets/web/recordings.css.scss | 1 - web/app/views/recordings/show.html.erb | 47 +++++++++++++++++-- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/web/app/assets/stylesheets/web/recordings.css.scss b/web/app/assets/stylesheets/web/recordings.css.scss index 45e591aa1..2e3ac9e24 100644 --- a/web/app/assets/stylesheets/web/recordings.css.scss +++ b/web/app/assets/stylesheets/web/recordings.css.scss @@ -45,7 +45,6 @@ .recording-slider { position:absolute; - left:25%; top:0px; } diff --git a/web/app/views/recordings/show.html.erb b/web/app/views/recordings/show.html.erb index dff09958b..be3de35d8 100644 --- a/web/app/views/recordings/show.html.erb +++ b/web/app/views/recordings/show.html.erb @@ -51,17 +51,19 @@
<%= @claimed_recording.description %>

- <%= image_tag "content/icon_playbutton.png", {:width => 20, :height => 20, :alt => ""} %> + <%= image_tag "content/icon_playbutton.png", {:id => "imgPlayPause", :width => 20, :height => 20, :alt => ""} %>
0:00
<%= image_tag "content/slider_playcontrols.png", {:width => 5, :height => 16, :alt => ""} %>
-
4:59
+
-
1:23
+
0:00
+
-
<%= @claimed_recording.genre_id.capitalize %>
<%= @claimed_recording.recording.play_count %> @@ -99,9 +101,44 @@ <% content_for :extra_js do %> <% end %> From f37e7de42ed61c6ab3a86bec91539f4925bce52e Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 20 Feb 2014 02:07:09 -0500 Subject: [PATCH 05/28] VRFS-1188 remove hard-coded audio source / reset slider when playback is complete --- web/app/views/recordings/show.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/app/views/recordings/show.html.erb b/web/app/views/recordings/show.html.erb index be3de35d8..1eef34c11 100644 --- a/web/app/views/recordings/show.html.erb +++ b/web/app/views/recordings/show.html.erb @@ -61,7 +61,8 @@
0:00
<%= @claimed_recording.genre_id.capitalize %>
@@ -123,8 +124,10 @@ $(".recording-slider").css({'left': percentComplete + '%'}); $(".recording-current").html(formatTime(htmlAudio.currentTime)); + // reset icon to play and slider to far left when done if (percentComplete === 100) { $("#imgPlayPause").attr('src', '/assets/content/icon_playbutton.png'); + $(".recording-slider").css({'left': 0 + '%'}); } }); From df14676495dedd01d12cd0590280dea3122a12b0 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 20 Feb 2014 07:45:51 +0000 Subject: [PATCH 06/28] * VRFS-1135 - user and band targetting possible --- db/manifest | 3 +- db/up/music_session_history_public.sql | 1 + ruby/lib/jam_ruby/models/feed.rb | 71 +++++- ruby/lib/jam_ruby/models/music_session.rb | 6 +- .../jam_ruby/models/music_session_history.rb | 3 +- ruby/spec/factories.rb | 3 +- ruby/spec/jam_ruby/connection_manager_spec.rb | 2 +- ruby/spec/jam_ruby/models/feed_spec.rb | 212 ++++++++++++++++++ .../models/music_session_history_spec.rb | 9 +- .../music_sessions_user_history_spec.rb | 11 +- ruby/spec/spec_helper.rb | 1 + web/Gemfile | 1 - web/app/controllers/api_feeds_controller.rb | 4 +- web/lib/music_session_manager.rb | 10 +- .../controllers/api_feeds_controller_spec.rb | 27 +++ web/spec/factories.rb | 10 +- web/spec/spec_helper.rb | 54 +++-- web/spec/support/utilities.rb | 4 +- 18 files changed, 363 insertions(+), 69 deletions(-) create mode 100644 db/up/music_session_history_public.sql diff --git a/db/manifest b/db/manifest index def0d818f..6d546452d 100755 --- a/db/manifest +++ b/db/manifest @@ -113,4 +113,5 @@ feed_use_recording.sql feed_autoincrement_primary_key.sql music_sessions_plays.sql plays_likes_counters.sql -add_upright_bass.sql \ No newline at end of file +add_upright_bass.sql +music_session_history_public.sql \ No newline at end of file diff --git a/db/up/music_session_history_public.sql b/db/up/music_session_history_public.sql new file mode 100644 index 000000000..cbff9b62a --- /dev/null +++ b/db/up/music_session_history_public.sql @@ -0,0 +1 @@ +ALTER TABLE music_sessions_history ADD COLUMN fan_access BOOLEAN NOT NULL; \ No newline at end of file diff --git a/ruby/lib/jam_ruby/models/feed.rb b/ruby/lib/jam_ruby/models/feed.rb index 27ba46c68..b505b71af 100644 --- a/ruby/lib/jam_ruby/models/feed.rb +++ b/ruby/lib/jam_ruby/models/feed.rb @@ -36,17 +36,18 @@ module JamRuby type_filter ||= 'all' raise "not valid type #{type_filter}" unless TYPE_FILTERS.include?(type_filter) - include_private = params[:include_private] - include_private ||= false # default to false - include_private = false if user.nil? # and force to false if the current user is nil + target_user = params[:user] + target_band = params[:band] - - query = Feed.includes([:recording]).includes([:music_session_history]).limit(limit) + #query = Feed.includes([:recording]).includes([:music_session_history]).limit(limit) + query = Feed.joins("LEFT OUTER JOIN recordings ON recordings.id = feeds.recording_id") + .joins("LEFT OUTER JOIN music_sessions_history ON music_sessions_history.id = feeds.music_session_id") + .limit(limit) # handle sort if sort == 'date' - query = query.where("id < #{start}") - query = query.order('id DESC') + query = query.where("feeds.id < #{start}") + query = query.order('feeds.id DESC') elsif sort == 'plays' query = query.offset(start) query = query.order("COALESCE(recordings.play_count, music_sessions_history.play_count) DESC ") @@ -65,18 +66,64 @@ module JamRuby # handle type filters if type_filter == 'music_session_history' - query = query.where('music_session_id is not NULL') + query = query.where('feeds.music_session_id is not NULL') elsif type_filter == 'recording' - query = query.where('recording_id is not NULL') + query = query.where('feeds.recording_id is not NULL') end - # handle private times - if include_private + if target_user + + if target_user != user.id + require_public_recordings = "claimed_recordings.is_public = TRUE AND" + require_public_sessions = "music_sessions_history.fan_access = TRUE AND" + end + + query = query.joins("LEFT OUTER JOIN claimed_recordings ON recordings.id = claimed_recordings.recording_id AND #{require_public_recordings} (claimed_recordings.user_id = '#{target_user}' OR (recordings.band_id IN (SELECT band_id FROM bands_musicians where user_id='#{target_user}')))") + query = query.joins("LEFT OUTER JOIN music_sessions_user_history ON music_sessions_history.id = music_sessions_user_history.music_session_id AND #{require_public_sessions} music_sessions_user_history.user_id = '#{target_user}'") + query = query.group("feeds.id, feeds.recording_id, feeds.music_session_id, feeds.created_at, feeds.updated_at, recordings.id, music_sessions_history.id") + if sort == 'plays' + query = query.group("COALESCE(recordings.play_count, music_sessions_history.play_count)") + elsif sort == 'likes' + query = query.group("COALESCE(recordings.like_count, music_sessions_history.like_count)") + end + query = query.where('recordings.id is NULL OR claimed_recordings.id IS NOT NULL') + query = query.where('music_sessions_history.id is NULL OR music_sessions_user_history.id IS NOT NULL') + + elsif target_band + + unless Band.find(target_band).users.include?(user) + require_public_recordings = "claimed_recordings.is_public = TRUE AND" + require_public_sessions = "music_sessions_history.fan_access = TRUE AND" + end + + query = query.joins("LEFT OUTER JOIN claimed_recordings ON recordings.id = claimed_recordings.recording_id AND #{require_public_recordings} recordings.band_id = '#{target_band}'") + query = query.where("music_sessions_history IS NULL OR #{require_public_sessions} music_sessions_history.band_id = '#{target_band}'") + query = query.group("feeds.id, feeds.recording_id, feeds.music_session_id, feeds.created_at, feeds.updated_at, recordings.id, music_sessions_history.id") + if sort == 'plays' + query = query.group("COALESCE(recordings.play_count, music_sessions_history.play_count)") + elsif sort == 'likes' + query = query.group("COALESCE(recordings.like_count, music_sessions_history.like_count)") + end + query = query.where('recordings.id is NULL OR claimed_recordings.id IS NOT NULL') + #query = query.where('music_sessions_history.id is NULL OR music_sessions_user_history.id IS NOT NULL') else - + query = query.joins('LEFT OUTER JOIN claimed_recordings ON recordings.id = claimed_recordings.recording_id AND claimed_recordings.is_public = TRUE') + query = query.joins("LEFT OUTER JOIN music_sessions_user_history ON music_sessions_history.id = music_sessions_user_history.music_session_id AND music_sessions_history.fan_access = TRUE") + query = query.group("feeds.id, feeds.recording_id, feeds.music_session_id, feeds.created_at, feeds.updated_at, recordings.id, music_sessions_history.id") + if sort == 'plays' + query = query.group("COALESCE(recordings.play_count, music_sessions_history.play_count)") + elsif sort == 'likes' + query = query.group("COALESCE(recordings.like_count, music_sessions_history.like_count)") + end + query = query.where('recordings.id is NULL OR claimed_recordings.is_public = TRUE') + query = query.where('music_sessions_history.id is NULL OR music_sessions_user_history.id IS NOT NULL') end + + + + if query.length == 0 [query, nil] elsif query.length < limit diff --git a/ruby/lib/jam_ruby/models/music_session.rb b/ruby/lib/jam_ruby/models/music_session.rb index e4ca47cfb..c32e2650e 100644 --- a/ruby/lib/jam_ruby/models/music_session.rb +++ b/ruby/lib/jam_ruby/models/music_session.rb @@ -24,7 +24,7 @@ module JamRuby has_many :recordings, :class_name => "JamRuby::Recording", :inverse_of => :music_session belongs_to :band, :inverse_of => :music_sessions, :class_name => "JamRuby::Band", :foreign_key => "band_id" - after_save :require_at_least_one_genre, :limit_max_genres + after_save :require_at_least_one_genre, :limit_max_genres, :sync_music_session_history after_destroy do |obj| JamRuby::MusicSessionHistory.removed_music_session(obj.id) @@ -277,5 +277,9 @@ module JamRuby end end end + + def sync_music_session_history + MusicSessionHistory.save(self) + end end end diff --git a/ruby/lib/jam_ruby/models/music_session_history.rb b/ruby/lib/jam_ruby/models/music_session_history.rb index b98d1d106..09b6ab5b2 100644 --- a/ruby/lib/jam_ruby/models/music_session_history.rb +++ b/ruby/lib/jam_ruby/models/music_session_history.rb @@ -19,7 +19,7 @@ module JamRuby :class_name => 'JamRuby::MusicSession', :foreign_key => 'music_session_id') - has_many :music_session_user_histories, :class_name => "JamRuby::MusicSessionUserHistory", :foreign_key => "music_session_id" + has_many :music_session_user_histories, :class_name => "JamRuby::MusicSessionUserHistory", :foreign_key => "music_session_id", :dependent => :delete_all has_many :comments, :class_name => "JamRuby::MusicSessionComment", :foreign_key => "music_session_id" has_many :likes, :class_name => "JamRuby::MusicSessionLiker", :foreign_key => "session_id" has_many :plays, :class_name => "JamRuby::MusicSessionPlay", :foreign_key => "music_session_id" @@ -131,6 +131,7 @@ module JamRuby session_history.user_id = music_session.creator.id session_history.band_id = music_session.band.id unless music_session.band.nil? session_history.genres = music_session.genres.map { |g| g.id }.join SEPARATOR + session_history.fan_access = music_session.fan_access session_history.save! end diff --git a/ruby/spec/factories.rb b/ruby/spec/factories.rb index 8c61cc99d..8f277cd51 100644 --- a/ruby/spec/factories.rb +++ b/ruby/spec/factories.rb @@ -50,7 +50,7 @@ FactoryGirl.define do factory :music_session do after(:create) { |session| - MusicSessionHistory.save(session) + FactoryGirl.create(:music_session_user_history, :history => session.music_session_history, :user => session.creator) } factory :music_session_with_mount do @@ -66,6 +66,7 @@ FactoryGirl.define do music_session nil end + fan_access true music_session_id { music_session.id } description { music_session.description } user_id { music_session.user_id } diff --git a/ruby/spec/jam_ruby/connection_manager_spec.rb b/ruby/spec/jam_ruby/connection_manager_spec.rb index dc093a0cb..99bc51a4e 100644 --- a/ruby/spec/jam_ruby/connection_manager_spec.rb +++ b/ruby/spec/jam_ruby/connection_manager_spec.rb @@ -23,7 +23,7 @@ describe ConnectionManager do description = "some session" @conn.exec("INSERT INTO music_sessions (user_id, description, musician_access, approval_required, fan_chat, fan_access) VALUES ($1, $2, $3, $4, $5, $6) RETURNING id", [user_id, description, options[:musician_access], options[:approval_required], options[:fan_chat], options[:fan_access]]) do |result| session_id = result.getvalue(0, 0) - @conn.exec("INSERT INTO music_sessions_history (music_session_id, description, user_id) VALUES ($1, $2, $3)", [session_id, description, user_id]) + @conn.exec("INSERT INTO music_sessions_history (music_session_id, description, user_id, fan_access) VALUES ($1, $2, $3, $4)", [session_id, description, user_id, true]) return session_id end end diff --git a/ruby/spec/jam_ruby/models/feed_spec.rb b/ruby/spec/jam_ruby/models/feed_spec.rb index 9c86b974c..7ec9a5f79 100644 --- a/ruby/spec/jam_ruby/models/feed_spec.rb +++ b/ruby/spec/jam_ruby/models/feed_spec.rb @@ -6,6 +6,7 @@ describe Feed do let (:user2) { FactoryGirl.create(:user) } let (:user3) { FactoryGirl.create(:user) } let (:user4) { FactoryGirl.create(:user) } + let (:band) { FactoryGirl.create(:band) } it "no result" do feeds, start = Feed.index(user1) @@ -14,6 +15,7 @@ describe Feed do it "one claimed recording" do claimed_recording = FactoryGirl.create(:claimed_recording) + MusicSessionUserHistory.delete_all # the factory makes a music_session while making the recording/claimed_recording MusicSessionHistory.delete_all # the factory makes a music_session while making the recording/claimed_recording feeds, start = Feed.index(user1) feeds.length.should == 1 @@ -25,6 +27,7 @@ describe Feed do second_track = FactoryGirl.create(:recorded_track, recording: recording) recording.recorded_tracks << second_track FactoryGirl.create(:claimed_recording, recording: recording, user: second_track.user) + MusicSessionUserHistory.delete_all # the factory makes a music_session while making the recording/claimed_recording MusicSessionHistory.delete_all # verify the mess above only made one recording @@ -41,6 +44,16 @@ describe Feed do feeds[0].music_session_history == music_session.music_session_history end + it "does not return a recording with no claimed recordings" do + recording = FactoryGirl.create(:recording) + MusicSessionUserHistory.delete_all # the factory makes a music_session while making the recording/claimed_recording + MusicSessionHistory.delete_all + + + feeds, start = Feed.index(user1) + feeds.length.should == 0 + end + describe "sorting" do it "sorts by index (date) DESC" do claimed_recording = FactoryGirl.create(:claimed_recording) @@ -242,6 +255,205 @@ describe Feed do end end + describe "public feed" do + it "only public" do + claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1.is_public = false + claimed_recording1.save! + + feeds, start = Feed.index(claimed_recording1.user) + feeds.length.should == 1 + + claimed_recording1.recording.music_session.fan_access = false + claimed_recording1.recording.music_session.save! + + feeds, start = Feed.index(claimed_recording1.user) + feeds.length.should == 0 + end + end + + describe "band feeds" do + it "does show other band's stuff in this feed" do + other_band = FactoryGirl.create(:band) + music_session = FactoryGirl.create(:music_session, band: other_band) + FactoryGirl.create(:music_session_user_history, :history => music_session.music_session_history, :user => user1) + + claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1.is_public = true + claimed_recording1.recording.band = other_band + claimed_recording1.recording.save! + claimed_recording1.save! + + feeds, start = Feed.index(user1, band: band.id) + feeds.length.should == 0 + end + + it "shows public recordings to you and to others" do + user1.bands << band + user1.save! + music_session = FactoryGirl.create(:music_session, band: band) + music_session.music_session_history.fan_access.should be_true + + feeds, start = Feed.index(user1, band: band.id) + feeds.length.should == 1 + feeds[0].music_session_history.should == music_session.music_session_history + + feeds, start = Feed.index(user2, band: band.id) + feeds.length.should == 1 + feeds[0].music_session_history.should == music_session.music_session_history + end + + it "shows private sessions to you, not to others" do + user1.bands << band + user1.save! + music_session = FactoryGirl.create(:music_session, band: band, fan_access: false) + music_session.music_session_history.fan_access.should be_false + + feeds, start = Feed.index(user1, band: band.id) + feeds.length.should == 1 + feeds[0].music_session_history.should == music_session.music_session_history + feeds[0].music_session_history.fan_access.should be_false + + + feeds, start = Feed.index(user2, band: band.id) + feeds.length.should == 0 + end + + it "shows public recordings to you and to others" do + claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1.is_public = true + claimed_recording1.recording.band = band + claimed_recording1.recording.save! + claimed_recording1.save! + + feeds, start = Feed.index(claimed_recording1.user, band: band.id) + feeds.length.should == 1 + feeds[0].recording.should == claimed_recording1.recording + + feeds, start = Feed.index(user1, band: band.id) + feeds.length.should == 1 + feeds[0].recording.should == claimed_recording1.recording + end + + it "shows private recordings to you, not to others" do + claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1.is_public = false + claimed_recording1.recording.band = band + claimed_recording1.recording.save! + claimed_recording1.save! + + claimed_recording1.user.bands << band + claimed_recording1.user.save! + + feeds, start = Feed.index(claimed_recording1.user, band: band.id) + feeds.length.should == 1 + feeds[0].recording.should == claimed_recording1.recording + + feeds, start = Feed.index(user1, band: band.id) + feeds.length.should == 0 + end + end + + describe "user feeds" do + it "does not show stuff from other people" do + music_session = FactoryGirl.create(:music_session) + FactoryGirl.create(:music_session_user_history, :history => music_session.music_session_history, :user => user2) + + claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1.is_public = true + claimed_recording1.save! + + feeds, start = Feed.index(user1, user: user1.id) + feeds.length.should == 0 + end + + it "shows public sessions to you and to others" do + music_session = FactoryGirl.create(:music_session) + FactoryGirl.create(:music_session_user_history, :history => music_session.music_session_history, :user => user1) + + feeds, start = Feed.index(user1, user: user1.id) + feeds.length.should == 1 + feeds[0].music_session_history.should == music_session.music_session_history + + feeds, start = Feed.index(user2, user: user1.id) + feeds.length.should == 1 + feeds[0].music_session_history.should == music_session.music_session_history + end + + + it "shows private sessions to you, not to others" do + music_session = FactoryGirl.create(:music_session, fan_access: false) + music_session.music_session_history.fan_access.should be_false + FactoryGirl.create(:music_session_user_history, :history => music_session.music_session_history, :user => user1) + + feeds, start = Feed.index(user1, user: user1.id) + feeds.length.should == 1 + feeds[0].music_session_history.should == music_session.music_session_history + feeds[0].music_session_history.fan_access.should be_false + + + feeds, start = Feed.index(user2, user: user1.id) + feeds.length.should == 0 + end + + it "shows public recordings to you and to others" do + claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1.is_public = true + claimed_recording1.save! + + feeds, start = Feed.index(claimed_recording1.user, user: claimed_recording1.user.id) + feeds.length.should == 1 + feeds[0].recording.should == claimed_recording1.recording + + feeds, start = Feed.index(user1, user: claimed_recording1.user.id) + feeds.length.should == 1 + feeds[0].recording.should == claimed_recording1.recording + end + + it "shows private recordings to you, not to others" do + claimed_recording1 = FactoryGirl.create(:claimed_recording) + claimed_recording1.is_public = false + claimed_recording1.save! + + feeds, start = Feed.index(claimed_recording1.user, user: claimed_recording1.user.id) + feeds.length.should == 1 + feeds[0].recording.should == claimed_recording1.recording + + feeds, start = Feed.index(user1, user: claimed_recording1.user.id) + feeds.length.should == 0 + end + + it "shows band recordings to you even though you did not claim a recording" do + user1.bands << band + user1.save! + user2.bands << band + user2.save! + + claimed_recording1 = FactoryGirl.create(:claimed_recording, user: user2) + claimed_recording1.is_public = true + claimed_recording1.recording.band = band + claimed_recording1.recording.save! + claimed_recording1.save! + + feeds, start = Feed.index(user1, user: user1.id) + feeds.length.should == 1 + feeds[0].recording.should == claimed_recording1 .recording + + # make it private; should still be available + claimed_recording1.is_public = false + claimed_recording1.save! + + feeds, start = Feed.index(user1, user: user1.id) + feeds.length.should == 1 + feeds[0].recording.should == claimed_recording1 .recording + + # take user1 out of the band; shouldn't be able to see it + user1.bands.delete_all + + feeds, start = Feed.index(user1, user: user1.id) + feeds.length.should == 0 + end + end end diff --git a/ruby/spec/jam_ruby/models/music_session_history_spec.rb b/ruby/spec/jam_ruby/models/music_session_history_spec.rb index 183e9f6c4..0a66ec69b 100644 --- a/ruby/spec/jam_ruby/models/music_session_history_spec.rb +++ b/ruby/spec/jam_ruby/models/music_session_history_spec.rb @@ -4,18 +4,17 @@ describe MusicSessionHistory do let(:some_user) { FactoryGirl.create(:user) } let(:music_session) { FactoryGirl.create(:music_session_no_history) } - let(:history) { FactoryGirl.create(:music_session_history, :music_session => music_session) } - let(:user_history1) { FactoryGirl.create(:music_session_user_history, :history => history, :user => music_session.creator) } - let(:user_history2) { FactoryGirl.create(:music_session_user_history, :history => history, :user => some_user) } + let(:user_history1) { FactoryGirl.create(:music_session_user_history, :history => music_session.music_session_history, :user => music_session.creator) } + let(:user_history2) { FactoryGirl.create(:music_session_user_history, :history => music_session.music_session_history, :user => some_user) } it "create" do - history.description.should eql(music_session.description) + music_session.music_session_history.description.should eql(music_session.description) end it "unique users" do user_history1.should_not be_nil user_history2.should_not be_nil - users = history.unique_users + users = music_session.music_session_history.unique_users users.length.should eql(2) diff --git a/ruby/spec/jam_ruby/models/music_sessions_user_history_spec.rb b/ruby/spec/jam_ruby/models/music_sessions_user_history_spec.rb index b6c719151..3d7713b86 100644 --- a/ruby/spec/jam_ruby/models/music_sessions_user_history_spec.rb +++ b/ruby/spec/jam_ruby/models/music_sessions_user_history_spec.rb @@ -4,9 +4,8 @@ describe MusicSessionUserHistory do let(:some_user) { FactoryGirl.create(:user) } let(:music_session) { FactoryGirl.create(:music_session_no_history) } - let(:history) { FactoryGirl.create(:music_session_history, :music_session => music_session) } - let(:user_history1) { FactoryGirl.create(:music_session_user_history, :history => history, :user => music_session.creator) } - let(:user_history2) { FactoryGirl.create(:music_session_user_history, :history => history, :user => some_user) } + let(:user_history1) { FactoryGirl.create(:music_session_user_history, :history => music_session.music_session_history, :user => music_session.creator) } + let(:user_history2) { FactoryGirl.create(:music_session_user_history, :history => music_session.music_session_history, :user => some_user) } describe "create" do it {user_history1.music_session_id.should == music_session.id } @@ -78,7 +77,7 @@ describe MusicSessionUserHistory do end it "two histories with same user within bounds of history1" do - user_history3 = FactoryGirl.create(:music_session_user_history, :history => history, :user => some_user) + user_history3 = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session_history, :user => some_user) # if user2 comes and goes 2 times while user one is there, it shouldn't be a false 3 user_history1.session_removed_at = user_history1.created_at + 5 @@ -99,7 +98,7 @@ describe MusicSessionUserHistory do it "two histories with different user within bounds of history1" do third_user = FactoryGirl.create(:user); - user_history3 = FactoryGirl.create(:music_session_user_history, :history => history, :user => third_user) + user_history3 = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session_history, :user => third_user) # if user2 comes and goes 2 times while user one is there, it shouldn't be a false 3 user_history1.session_removed_at = user_history1.created_at + 5 @@ -120,7 +119,7 @@ describe MusicSessionUserHistory do it "two overlapping histories with different user within bounds of history1" do third_user = FactoryGirl.create(:user); - user_history3 = FactoryGirl.create(:music_session_user_history, :history => history, :user => third_user) + user_history3 = FactoryGirl.create(:music_session_user_history, :history => music_session.music_session_history, :user => third_user) # if user2 comes and goes 2 times while user one is there, it shouldn't be a false 3 user_history1.session_removed_at = user_history1.created_at + 5 diff --git a/ruby/spec/spec_helper.rb b/ruby/spec/spec_helper.rb index 8b747ead5..60f32513b 100644 --- a/ruby/spec/spec_helper.rb +++ b/ruby/spec/spec_helper.rb @@ -61,6 +61,7 @@ Spork.prefork do # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| + config.color_enabled = true config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus diff --git a/web/Gemfile b/web/Gemfile index b6e8db78b..beabc2ec6 100644 --- a/web/Gemfile +++ b/web/Gemfile @@ -54,7 +54,6 @@ gem 'fog' gem 'haml-rails' gem 'unf' #optional fog dependency gem 'devise', '>= 1.1.2' -gem 'puma' # the presence of this gem on mac seems to prevent normal startup of rails. gem 'postgres-copy' #group :libv8 do # gem 'libv8', "~> 3.11.8" diff --git a/web/app/controllers/api_feeds_controller.rb b/web/app/controllers/api_feeds_controller.rb index 370f17647..db17218b1 100644 --- a/web/app/controllers/api_feeds_controller.rb +++ b/web/app/controllers/api_feeds_controller.rb @@ -8,7 +8,9 @@ class ApiFeedsController < ApiController limit: params[:limit], sort: params[:sort], time_range: params[:time_range], - type: params[:type]) + type: params[:type], + user: params[:user], + band: params[:band]) render "api_feeds/index", :layout => nil end diff --git a/web/lib/music_session_manager.rb b/web/lib/music_session_manager.rb index b9d69fae7..3efc2cb90 100644 --- a/web/lib/music_session_manager.rb +++ b/web/lib/music_session_manager.rb @@ -43,9 +43,6 @@ MusicSessionManager < BaseManager # save session parameters for next session User.save_session_settings(user, music_session) - # save session history - MusicSessionHistory.save(music_session) - # auto-join this user into the newly created session as_musician = true connection = ConnectionManager.new.join_music_session(user, client_id, music_session, as_musician, tracks) @@ -96,12 +93,9 @@ MusicSessionManager < BaseManager update[:genres] = genre_array end - if music_session.update_attributes(update) - # save session history (only thing that could change is description) - MusicSessionHistory.save(music_session) - end + music_session.update_attributes(update) - return music_session + music_session end def participant_create(user, music_session_id, client_id, as_musician, tracks) diff --git a/web/spec/controllers/api_feeds_controller_spec.rb b/web/spec/controllers/api_feeds_controller_spec.rb index bc581e267..4841f3f73 100644 --- a/web/spec/controllers/api_feeds_controller_spec.rb +++ b/web/spec/controllers/api_feeds_controller_spec.rb @@ -9,6 +9,7 @@ describe ApiFeedsController do before(:each) do MusicSession.delete_all + MusicSessionUserHistory.delete_all MusicSessionHistory.delete_all Recording.delete_all end @@ -23,6 +24,7 @@ describe ApiFeedsController do it "returns a recording" do claimed_recording.touch # artifact of factory of :claimed_recording that this gets created + MusicSessionUserHistory.delete_all MusicSessionHistory.delete_all get :index @@ -109,4 +111,29 @@ describe ApiFeedsController do _next.should be_nil end end + + describe "user targetting" do + + it "user viewing own profile" do + pending 'not tested' + music_session.fan_access = false + music_session.save! + controller.current_user = music_session.creator + + get :index + json = JSON.parse(response.body, :symbolize_names => true) + json[:entries].length.should == 1 + end + + it "user viewing someone else's profile" do + pending 'not tested' + music_session.fan_access = false + music_session.save! + controller.current_user = user + + get :index + json = JSON.parse(response.body, :symbolize_names => true) + json[:entries].length.should == 0 + end + end end diff --git a/web/spec/factories.rb b/web/spec/factories.rb index 71b608c6a..1d5716708 100644 --- a/web/spec/factories.rb +++ b/web/spec/factories.rb @@ -52,12 +52,20 @@ FactoryGirl.define do association :creator, :factory => :user after(:create) { |session| - MusicSessionHistory.save(session) + FactoryGirl.create(:music_session_user_history, :history => session.music_session_history, :user => session.creator) } end factory :music_session_user_history, :class => JamRuby::MusicSessionUserHistory do + ignore do + history nil + user nil + end + + music_session_id { history.music_session_id } + user_id { user.id } + sequence(:client_id) { |n| "Connection #{n}" } end diff --git a/web/spec/spec_helper.rb b/web/spec/spec_helper.rb index ab3f7597c..24192489b 100644 --- a/web/spec/spec_helper.rb +++ b/web/spec/spec_helper.rb @@ -1,6 +1,6 @@ require 'simplecov' require 'rubygems' -require 'spork' +#require 'spork' require 'omniauth' #uncomment the following line to use spork with the debugger #require 'spork/ext/ruby-debug' @@ -33,44 +33,23 @@ ActionMailer::Base.delivery_method = :test RecordedTrack.observers.disable :all # only a few tests want this observer active -Spork.prefork do +#Spork.prefork do # Loading more in this block will cause your tests to run faster. However, # if you change any configuration or code from libraries loaded here, you'll # need to restart spork for it take effect. # This file is copied to spec/ when you run 'rails generate rspec:install' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' - require 'rspec/autorun' + #require 'rspec/autorun' require 'capybara' require 'capybara/rspec' require 'capybara-screenshot/rspec' require 'capybara/poltergeist' - Capybara.register_driver :poltergeist do |app| - driver = Capybara::Poltergeist::Driver.new(app, { debug: false, phantomjs_logger: File.open('log/phantomjs.out', 'w') }) - end - Capybara.javascript_driver = :poltergeist - Capybara.default_wait_time = 10 - if defined?(TEST_CONNECT_STATES) && TEST_CONNECT_STATES - TEST_CONNECT_STATE_JS_CONSOLE_IO = File.open(TEST_CONNECT_STATE_JS_CONSOLE, 'w') - Capybara.register_driver :poltergeist do |app| - Capybara::Poltergeist::Driver.new(app, { phantomjs_logger: TEST_CONNECT_STATE_JS_CONSOLE_IO }) - end - Capybara.javascript_driver = :poltergeist - end - Capybara.configure do |config| - config.match = :one - config.exact_options = true - config.ignore_hidden_elements = true - config.visible_text_only = true - end - Capybara.server do |app, port| - require 'rack/handler/puma' - Rack::Handler::Puma.run(app, :Port => port) - end + # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. @@ -79,6 +58,25 @@ Spork.prefork do ActiveRecord::Base.logger = Logger.new(STDOUT) if defined?(ActiveRecord::Base) RSpec.configure do |config| + Capybara.register_driver :poltergeist do |app| + driver = Capybara::Poltergeist::Driver.new(app, { debug: false, phantomjs_logger: File.open('log/phantomjs.out', 'w') }) + end + Capybara.javascript_driver = :poltergeist + Capybara.default_wait_time = 10 + + Capybara.configure do |config| + config.match = :one + config.exact_options = true + config.ignore_hidden_elements = true + config.visible_text_only = true + config.run_server = false + end + + Capybara.server do |app, port| + raise "gaaag" + require 'rack/handler/puma' + Rack::Handler::Puma.run(app, :Port => port) + end # ## Mock Framework # # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: @@ -154,12 +152,12 @@ Spork.prefork do wipe_s3_test_bucket end end -end +#end -Spork.each_run do +#Spork.each_run do # This code will be run each time you run your specs. -end +#end diff --git a/web/spec/support/utilities.rb b/web/spec/support/utilities.rb index a38b77ce7..7d44a27ea 100644 --- a/web/spec/support/utilities.rb +++ b/web/spec/support/utilities.rb @@ -56,8 +56,8 @@ end def sign_in_poltergeist(user) visit signin_path - fill_in "Email Address:", with: user.email - fill_in "Password:", with: user.password + fill_in "session_email", with: user.email + fill_in "session_password", with: user.password click_button "SIGN IN" if Capybara.javascript_driver == :poltergeist From 1940e6d8ffd0cde5ec2dd4efe275c501aafda32a Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 20 Feb 2014 08:01:18 +0000 Subject: [PATCH 07/28] * VRFS-1135 a few more tests in controller for user and band targetting --- web/app/views/api_feeds/show.rabl | 4 +- .../controllers/api_feeds_controller_spec.rb | 46 +++++++++++++++++-- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/web/app/views/api_feeds/show.rabl b/web/app/views/api_feeds/show.rabl index d3253d3d7..899cb9b52 100644 --- a/web/app/views/api_feeds/show.rabl +++ b/web/app/views/api_feeds/show.rabl @@ -7,7 +7,7 @@ glue :music_session_history do 'music_session_history' end - attributes :id, :description, :genres, :created_at, :session_removed_at, :comment_count, :like_count, :play_count + attributes :id, :description, :genres, :created_at, :session_removed_at, :comment_count, :like_count, :play_count, :fan_access child(:user => :creator) { @@ -67,7 +67,7 @@ glue :recording do child(:claimed_recordings => :claimed_recordings) { - attributes :id, :name, :description, :is_public, :is_downloadable, :genre_id + attributes :id, :name, :description, :is_public, :genre_id child(:user => :creator) { attributes :id, :first_name, :last_name, :photo_url diff --git a/web/spec/controllers/api_feeds_controller_spec.rb b/web/spec/controllers/api_feeds_controller_spec.rb index 4841f3f73..e3c906744 100644 --- a/web/spec/controllers/api_feeds_controller_spec.rb +++ b/web/spec/controllers/api_feeds_controller_spec.rb @@ -4,6 +4,8 @@ describe ApiFeedsController do render_views let(:user) { FactoryGirl.create(:user) } + let(:user2) { FactoryGirl.create(:user) } + let(:band) { FactoryGirl.create(:band) } let(:music_session) {FactoryGirl.create(:music_session, creator: user) } let(:claimed_recording) {FactoryGirl.create(:claimed_recording) } @@ -115,23 +117,59 @@ describe ApiFeedsController do describe "user targetting" do it "user viewing own profile" do - pending 'not tested' music_session.fan_access = false music_session.save! controller.current_user = music_session.creator - get :index + get :index, { user: music_session.creator.id } json = JSON.parse(response.body, :symbolize_names => true) json[:entries].length.should == 1 end it "user viewing someone else's profile" do - pending 'not tested' music_session.fan_access = false music_session.save! + controller.current_user = user2 + music_session.music_session_history.reload + music_session.music_session_history.fan_access.should be_false + + get :index, { user: music_session.creator.id } + json = JSON.parse(response.body, :symbolize_names => true) + json[:entries].length.should == 0 + end + end + + describe "band targetting" do + + it "user viewing own band" do + user.bands << band + user.save! + claimed_recording1 = FactoryGirl.create(:claimed_recording, user: user) + claimed_recording1.is_public = false + claimed_recording1.recording.band = band + claimed_recording1.recording.save! + claimed_recording1.save! + controller.current_user = user - get :index + get :index, { band: band.id } + json = JSON.parse(response.body, :symbolize_names => true) + json[:entries].length.should == 1 + end + + it "user viewing someone else's band" do + user.bands << band + user.save! + + claimed_recording1 = FactoryGirl.create(:claimed_recording, user: user) + claimed_recording1.is_public = false + claimed_recording1.recording.band = band + claimed_recording1.recording.save! + claimed_recording1.save! + + controller.current_user = user2 + + get :index, { band: band.id } json = JSON.parse(response.body, :symbolize_names => true) json[:entries].length.should == 0 end From cda7ef8ce9ce51e1ef9ce23fe1481d569d9aa759 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 20 Feb 2014 08:02:50 +0000 Subject: [PATCH 08/28] * revert back spec_helper --- web/spec/spec_helper.rb | 55 +++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/web/spec/spec_helper.rb b/web/spec/spec_helper.rb index 24192489b..40d775465 100644 --- a/web/spec/spec_helper.rb +++ b/web/spec/spec_helper.rb @@ -1,6 +1,6 @@ require 'simplecov' require 'rubygems' -#require 'spork' +require 'spork' require 'omniauth' #uncomment the following line to use spork with the debugger #require 'spork/ext/ruby-debug' @@ -33,23 +33,39 @@ ActionMailer::Base.delivery_method = :test RecordedTrack.observers.disable :all # only a few tests want this observer active -#Spork.prefork do +Spork.prefork do # Loading more in this block will cause your tests to run faster. However, # if you change any configuration or code from libraries loaded here, you'll # need to restart spork for it take effect. # This file is copied to spec/ when you run 'rails generate rspec:install' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' - #require 'rspec/autorun' + require 'rspec/autorun' require 'capybara' require 'capybara/rspec' require 'capybara-screenshot/rspec' require 'capybara/poltergeist' + Capybara.register_driver :poltergeist do |app| + driver = Capybara::Poltergeist::Driver.new(app, { debug: false, phantomjs_logger: File.open('log/phantomjs.out', 'w') }) + end + Capybara.javascript_driver = :poltergeist + Capybara.default_wait_time = 10 - - + if defined?(TEST_CONNECT_STATES) && TEST_CONNECT_STATES + TEST_CONNECT_STATE_JS_CONSOLE_IO = File.open(TEST_CONNECT_STATE_JS_CONSOLE, 'w') + Capybara.register_driver :poltergeist do |app| + Capybara::Poltergeist::Driver.new(app, { phantomjs_logger: TEST_CONNECT_STATE_JS_CONSOLE_IO }) + end + Capybara.javascript_driver = :poltergeist + end + Capybara.configure do |config| + config.match = :one + config.exact_options = true + config.ignore_hidden_elements = true + config.visible_text_only = true + end # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. @@ -58,25 +74,6 @@ RecordedTrack.observers.disable :all # only a few tests want this observer activ ActiveRecord::Base.logger = Logger.new(STDOUT) if defined?(ActiveRecord::Base) RSpec.configure do |config| - Capybara.register_driver :poltergeist do |app| - driver = Capybara::Poltergeist::Driver.new(app, { debug: false, phantomjs_logger: File.open('log/phantomjs.out', 'w') }) - end - Capybara.javascript_driver = :poltergeist - Capybara.default_wait_time = 10 - - Capybara.configure do |config| - config.match = :one - config.exact_options = true - config.ignore_hidden_elements = true - config.visible_text_only = true - config.run_server = false - end - - Capybara.server do |app, port| - raise "gaaag" - require 'rack/handler/puma' - Rack::Handler::Puma.run(app, :Port => port) - end # ## Mock Framework # # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: @@ -139,8 +136,8 @@ RecordedTrack.observers.disable :all # only a few tests want this observer activ # dump response.body if an example fails if example.metadata[:type] == :controller && example.exception - puts "'#{determine_test_name(example.metadata)}' controller test failed." - puts "response.status = #{response.status}, response.body = " + response.body + puts "'#{determine_test_name(example.metadata)}' controller test failed." + puts "response.status = #{response.status}, response.body = " + response.body end end @@ -152,12 +149,12 @@ RecordedTrack.observers.disable :all # only a few tests want this observer activ wipe_s3_test_bucket end end -#end +end -#Spork.each_run do +Spork.each_run do # This code will be run each time you run your specs. -#end +end From e8e224dbaa0eafc90f28173d67c33231c72458ca Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 20 Feb 2014 08:38:36 -0500 Subject: [PATCH 09/28] VRFS-1189 music session playback --- web/app/views/music_sessions/show.html.erb | 41 +++++++++++++++++++--- web/app/views/recordings/show.html.erb | 9 ++--- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/web/app/views/music_sessions/show.html.erb b/web/app/views/music_sessions/show.html.erb index 74ae13253..4b997877e 100644 --- a/web/app/views/music_sessions/show.html.erb +++ b/web/app/views/music_sessions/show.html.erb @@ -52,10 +52,13 @@
- <%= image_tag "content/icon_playbutton.png", {:width => 20, :height => 20, :alt => ""} %> + <%= image_tag "content/icon_playbutton.png", {:id => "imgPlayPause", :width => 20, :height => 20, :alt => ""} %> <% if @music_session.session_removed_at.blank? %>
SESSION IN PROGRESS
-
1:23
+
+ <% else %>
LIVE SESSION ENDED
<% end %> @@ -99,8 +102,38 @@ <% content_for :extra_js do %> <% end %> diff --git a/web/app/views/recordings/show.html.erb b/web/app/views/recordings/show.html.erb index 1eef34c11..ceb08a75f 100644 --- a/web/app/views/recordings/show.html.erb +++ b/web/app/views/recordings/show.html.erb @@ -51,7 +51,7 @@
<%= @claimed_recording.description %>

- <%= image_tag "content/icon_playbutton.png", {:id => "imgPlayPause", :width => 20, :height => 20, :alt => ""} %> + <%= image_tag "content/icon_playbutton.png", {:id => "imgPlayPause", :width => 20, :height => 20, :alt => ""} %>
0:00
@@ -102,6 +102,10 @@ <% content_for :extra_js do %>