Merge branch 'develop' into VRFS-2282
This commit is contained in:
commit
95b26e9c00
|
|
@ -220,3 +220,4 @@ add_active_feed.sql
|
|||
connection_network_testing.sql
|
||||
video_sources.sql
|
||||
recorded_videos.sql
|
||||
emails_from_update2.sql
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE email_batches ALTER from_email SET DEFAULT 'JamKazam <noreply@jamkazam.com>';
|
||||
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
<tr>
|
||||
<td align="left"><h1 style="font-size:22px;font-weight:normal;margin-top:0px"><font color="#F34E1C" face="Arial, Helvetica, sans-serif"><%= yield(:title) %></font></h1>
|
||||
<p><font size="3" color="#AAAAAA" face="Arial, Helvetica, sans-serif"><%= @batch_body ? @batch_body.html_safe : yield %></font></p>
|
||||
<p><font size="3" color=<%= @batch_body ? "#FFFFFF" : "#AAAAAA" %> face="Arial, Helvetica, sans-serif"><%= @batch_body ? @batch_body.html_safe : yield %></font></p>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -689,11 +689,12 @@ module JamRuby
|
|||
|
||||
feed = Feed.find_by_music_session_id(self.id)
|
||||
|
||||
# this should never be hit since the feed entry is created when the music_session record is created
|
||||
if feed.nil?
|
||||
feed = Feed.new
|
||||
feed.music_session_id = self.id
|
||||
end
|
||||
|
||||
|
||||
feed.active = true
|
||||
feed.save
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,8 @@
|
|||
var EVENTS = context.JK.EVENTS;
|
||||
var ui = new context.JK.UIHelper(JK.app);
|
||||
var userId = null;
|
||||
var currentQuery = null;
|
||||
var currentPage = 0;
|
||||
var LIMIT = 20;
|
||||
var currentFeedPage = 0;
|
||||
var feedBatchSize = 10;
|
||||
var $next = null;
|
||||
var $screen = null;
|
||||
var $scroller = null;
|
||||
|
|
@ -21,16 +20,16 @@
|
|||
var $refresh = null;
|
||||
var $sortFeedBy = null;
|
||||
var $includeDate = null;
|
||||
var $includeType = null;
|
||||
var next = null;
|
||||
var $includeType = null;
|
||||
var didLoadAllFeeds = false, isLoading = false;
|
||||
|
||||
function defaultQuery() {
|
||||
var query = { limit:LIMIT, page:currentPage};
|
||||
var query = { limit: feedBatchSize };
|
||||
|
||||
if(next) {
|
||||
query.since = next;
|
||||
}
|
||||
|
||||
if(userId) {
|
||||
query.user = userId;
|
||||
}
|
||||
|
|
@ -39,7 +38,7 @@
|
|||
}
|
||||
|
||||
function buildQuery() {
|
||||
currentQuery = defaultQuery();
|
||||
var currentQuery = defaultQuery();
|
||||
|
||||
// specify search criteria based on form
|
||||
currentQuery.sort = $sortFeedBy.val();
|
||||
|
|
@ -51,7 +50,7 @@
|
|||
|
||||
|
||||
function clearResults() {
|
||||
currentPage = 0;
|
||||
currentFeedPage = 0;
|
||||
$content.empty(); // TODO: do we need to delete audio elements?
|
||||
$noMoreFeeds.hide();
|
||||
next = null;
|
||||
|
|
@ -59,29 +58,23 @@
|
|||
|
||||
function handleFeedResponse(response) {
|
||||
next = response.next;
|
||||
|
||||
renderFeeds(response);
|
||||
|
||||
if(response.next == null) {
|
||||
didLoadAllFeeds = true;
|
||||
|
||||
// if we less results than asked for, end searching
|
||||
$scroller.infinitescroll('pause');
|
||||
logger.debug("end of feeds")
|
||||
|
||||
if(currentPage == 0 && response.entries.length == 0) {
|
||||
if(currentFeedPage == 0 && response.entries.length == 0) {
|
||||
$content.append("<div class='no-feed-msg'>This user has no history.</div>") ;
|
||||
}
|
||||
|
||||
if(currentPage > 0) {
|
||||
if(currentFeedPage > 0) {
|
||||
$noMoreFeeds.show();
|
||||
// there are bugs with infinitescroll not removing the 'loading'.
|
||||
// it's most noticeable at the end of the list, so whack all such entries
|
||||
$('.infinite-scroll-loader').remove();
|
||||
}
|
||||
}
|
||||
else {
|
||||
currentPage++;
|
||||
buildQuery();
|
||||
registerInfiniteScroll();
|
||||
} else {
|
||||
currentFeedPage++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -90,44 +83,33 @@
|
|||
}
|
||||
|
||||
function refresh() {
|
||||
|
||||
clearResults();
|
||||
populate();
|
||||
}
|
||||
|
||||
currentQuery = buildQuery();
|
||||
rest.getFeeds(currentQuery)
|
||||
function setLoading(yn) {
|
||||
isLoading = yn;
|
||||
if (yn) {
|
||||
$('#loading-feeds').show();
|
||||
} else {
|
||||
$('#loading-feeds').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function populate() {
|
||||
if (isLoading || didLoadAllFeeds) return;
|
||||
setLoading(true);
|
||||
rest.getFeeds(buildQuery())
|
||||
.done(function(response) {
|
||||
handleFeedResponse(response);
|
||||
setLoading(false);
|
||||
})
|
||||
.fail(function(jqXHR) {
|
||||
setLoading(false);
|
||||
app.notifyServerError(jqXHR, 'Feed Unavailable')
|
||||
})
|
||||
}
|
||||
|
||||
function registerInfiniteScroll() {
|
||||
|
||||
$scroller.infinitescroll({
|
||||
behavior: 'local',
|
||||
navSelector: '#feedScreen .btn-next-pager',
|
||||
nextSelector: '#feedScreen .btn-next-pager',
|
||||
binder: $scroller,
|
||||
dataType: 'json',
|
||||
appendCallback: false,
|
||||
prefill: false,
|
||||
bufferPx:100,
|
||||
loading: {
|
||||
msg: $('<div class="infinite-scroll-loader">Loading ...</div>'),
|
||||
img: '/assets/shared/spinner.gif'
|
||||
},
|
||||
path: function(page) {
|
||||
return '/api/feeds?' + $.param(buildQuery());
|
||||
}
|
||||
},function(json, opts) {
|
||||
handleFeedResponse(json);
|
||||
});
|
||||
$scroller.infinitescroll('resume');
|
||||
}
|
||||
|
||||
|
||||
function toggleSessionDetails() {
|
||||
var $detailsLink = $(this);
|
||||
var $feedItem = $detailsLink.closest('.feed-entry');
|
||||
|
|
@ -549,6 +531,18 @@
|
|||
$sortFeedBy.on('change', search);
|
||||
$includeDate.on('change', search);
|
||||
$includeType.on('change', search);
|
||||
|
||||
$('#feed-scroller').scroll(function() {
|
||||
var wintop = $('#feed-scroller').scrollTop();
|
||||
var winheight = $('#feed-scroller').height();
|
||||
var docheight = $('#feed-entry-list').height();
|
||||
var scrollTrigger = 0.90;
|
||||
// console.log("feed scroll: wintop="+wintop+" docheight="+docheight+" winheight="+winheight+" ratio="+(wintop / (docheight - winheight)));
|
||||
if ((wintop / (docheight - winheight)) > scrollTrigger) {
|
||||
populate();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function initialize(_$parent, _$scroller, _$content, _$noMorefeeds, _$refresh, _$sortFeedBy, _$includeDate, _$includeType, defaults) {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ glue :music_session do
|
|||
|
||||
child(:active_music_session => :active_music_session) do
|
||||
# only show mount info if fan_access is public. Eventually we'll also need to show this in other scenarios, like if invited
|
||||
child({:mount => :mount}, :if => lambda { |music_session| music_session.fan_access}) {
|
||||
child({:mount => :mount}, :if => lambda { |music_session| music_session.fan_access }) {
|
||||
attributes :id, :name, :sourced, :listeners, :bitrate, :subtype, :url
|
||||
node(:mime_type) { |mount| mount.resolve_string(:mime_type) }
|
||||
node(:bitrate) { |mount| mount.resolve_string(:bitrate) }
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@
|
|||
= form_tag('', {:id => 'find-session-form', :class => 'inner-content'}) do
|
||||
= render(:partial => "web_filter", :locals => {:search_type => Search::PARAM_FEED})
|
||||
.filter-body
|
||||
.content-body-scroller
|
||||
.content-body-scroller#feed-scroller
|
||||
.profile-wrapper
|
||||
.feed-content
|
||||
%a{href: "/api/feeds?page=1", class: "btn-next-pager"}= 'Next'
|
||||
%div{id: 'end-of-feeds-list', class: 'end-of-list'}= 'No more feed entries'
|
||||
.feed-content#feed-entry-list
|
||||
#end-of-feeds-list.end-of-list= 'No more feed entries'
|
||||
#loading-feeds.infinite-scroll-loader{:style => 'padding:5px'}= 'Loading ...'
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
/ session status
|
||||
%a.left.play-button{href:'#'}
|
||||
= image_tag 'content/icon_playbutton.png', width:20, height:20, class:'play-icon'
|
||||
- if feed_item.has_mount?
|
||||
- if feed_item.has_mount? && feed_item.fan_access
|
||||
%audio{preload: 'none'}
|
||||
%source{src: feed_item.active_music_session.mount.url, type: feed_item.active_music_session.mount.resolve_string(:mime_type)}
|
||||
%span.session-status
|
||||
|
|
|
|||
|
|
@ -26,9 +26,11 @@
|
|||
%a.left.play-button{href:'#'}
|
||||
= image_tag 'content/icon_playbutton.png', width:20, height:20, class:'play-icon'
|
||||
= "{% if(data.feed_item['has_mount?']) { %}"
|
||||
= "{% if(data.feed_item.fan_access) { %}"
|
||||
%audio{preload: 'none'}
|
||||
%source{src: '{{data.feed_item.active_music_session.mount.url}}', type: '{{data.feed_item.active_music_session.mount.mime_type}}'}
|
||||
= '{% } %}'
|
||||
= '{% } %}'
|
||||
%span.session-status
|
||||
= '{{data.feed_item.helpers.status}}'
|
||||
/ current playback time
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
|
|||
before(:each) do
|
||||
MusicSession.delete_all
|
||||
Recording.delete_all
|
||||
IcecastMount.delete_all
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -21,7 +22,6 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
|
|||
|
||||
fast_signin user, "/client#/feed"
|
||||
find('#feedScreen')
|
||||
|
||||
find(".feed-entry.music-session-history-entry[data-music-session='#{ams.id}']")
|
||||
end
|
||||
end
|
||||
|
|
@ -73,7 +73,6 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
|
|||
find('div.comment-text', text: comment)
|
||||
find('#dialog-close-button', '[layout-id="comment-dialog"]').trigger(:click)
|
||||
|
||||
find('[layout-id="feed"] .btn-refresh-entries').trigger(:click)
|
||||
find('span.comments').should have_content('1')
|
||||
|
||||
# Likes
|
||||
|
|
@ -105,6 +104,19 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
|
|||
# it "should render play widget" do
|
||||
# end
|
||||
|
||||
it "should allow switch from fan_access=true to fan_access=false" do
|
||||
ams = FactoryGirl.create(:active_music_session)
|
||||
FactoryGirl.create(:icecast_mount, music_session_id: ams.id)
|
||||
|
||||
ms = ams.music_session
|
||||
ms.fan_access = false
|
||||
ms.save!
|
||||
|
||||
fast_signin user, "/client#/feed"
|
||||
find('#feedScreen')
|
||||
find(".feed-entry.music-session-history-entry[data-music-session='#{ams.id}']")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "recordings" do
|
||||
|
|
@ -159,7 +171,6 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
|
|||
find('div.comment-text', text: comment)
|
||||
find('#dialog-close-button', '[layout-id="comment-dialog"]').trigger(:click)
|
||||
|
||||
find('[layout-id="feed"] .btn-refresh-entries').trigger(:click)
|
||||
find('span.comments').should have_content('1')
|
||||
|
||||
# Likes
|
||||
|
|
@ -192,4 +203,4 @@ describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
|
|||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue