* VRFS-3446 - bug fix for no genre specified on join of session; also fix search bar in jamtrack dialog
This commit is contained in:
parent
3b6d1febdb
commit
29104ff09b
|
|
@ -49,11 +49,13 @@ context.JK.AccountJamTracks = class AccountJamTracks
|
|||
#context.location="client#/createSession"
|
||||
jamRow = $(e.target).parents("tr")
|
||||
@createSession(jamRow.data(), true, jamRow.data('jamTrack'))
|
||||
return false;
|
||||
|
||||
groupSession:(e) =>
|
||||
#context.location="client#/createSession"
|
||||
jamRow = $(e.target).parents("tr")
|
||||
@createSession(jamRow.data(), false, jamRow.data('jamTrack'))
|
||||
return false;
|
||||
|
||||
createSession:(sessionData, solo, jamTrack) =>
|
||||
tracks = context.JK.TrackHelpers.getUserTracks(context.jamClient)
|
||||
|
|
@ -70,8 +72,8 @@ context.JK.AccountJamTracks = class AccountJamTracks
|
|||
data.musician_access = !solo
|
||||
data.fan_access = false
|
||||
data.fan_chat = false
|
||||
data.genre = [sessionData.genre]
|
||||
data.genres = [sessionData.genre]
|
||||
data.genre = $.map(sessionData.jamTrack.genres, (genre) -> genre.id)
|
||||
data.genres = $.map(sessionData.jamTrack.genres, (genre)-> genre.id)
|
||||
# data.genres = context.JK.GenreSelectorHelper.getSelectedGenres('#create-session-genre')
|
||||
# data.musician_access = if $('#musician-access option:selected').val() == 'true' then true else false
|
||||
# data.approval_required = if $('input[name=\'musician-access-option\']:checked').val() == 'true' then true else false
|
||||
|
|
|
|||
|
|
@ -19,21 +19,22 @@
|
|||
var searchQuery = null;
|
||||
var cookieName = 'jamtrack_session_search'
|
||||
|
||||
// called by react autocomplote component
|
||||
function search(searchType, searchData) {
|
||||
window.JamTrackSearchInput = searchData;
|
||||
searchQuery = {searchType: searchType, searchData: searchData}
|
||||
$.cookie(cookieName, JSON.stringify(searchQuery))
|
||||
doSearch();
|
||||
doSearch(searchQuery);
|
||||
}
|
||||
|
||||
function userSearch(e) {
|
||||
e.preventDefault();
|
||||
searchQuery = {searchType: 'user-input', searchData: window.JamTrackSearchInput}
|
||||
$.cookie(cookieName, JSON.stringify(searchQuery))
|
||||
doSearch();
|
||||
doSearch(searchQuery);
|
||||
}
|
||||
|
||||
function doSearch() {
|
||||
function doSearch(query) {
|
||||
emptyList();
|
||||
resetPagination();
|
||||
|
||||
|
|
@ -42,22 +43,30 @@
|
|||
var showSearch = (user.purchased_jamtracks_count > perPage)
|
||||
|
||||
var $autocomplete = $dialog.find('[data-react-class="JamTrackAutoComplete"]')
|
||||
|
||||
if (showSearch) {
|
||||
$autocomplete.show()
|
||||
$searchBtn.show()
|
||||
|
||||
searchQuery = $.cookie(cookieName)
|
||||
if (!searchQuery) {
|
||||
searchQuery = {searchType: 'user-input', searchData: ''}
|
||||
// if no query specified, look in a cookie for last query
|
||||
if (!query) {
|
||||
query = $.cookie(cookieName)
|
||||
|
||||
// and parse that cookie if defined
|
||||
if (query) {
|
||||
try {
|
||||
query = JSON.parse(query)
|
||||
}
|
||||
catch (e) {
|
||||
query = {searchType: 'user-input', searchData: ''}
|
||||
logger.error("unable to parse search query: " + e)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
searchQuery = JSON.parse(searchQuery)
|
||||
}
|
||||
catch (e) {
|
||||
searchQuery = {searchType: 'user-input', searchData: ''}
|
||||
logger.error("unable to parse search query: " + e)
|
||||
}
|
||||
|
||||
// if still no query (after checking cookie and what was specified in function, then default to anything
|
||||
if(!query){
|
||||
query = {searchType: 'user-input', searchData: ''}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -197,7 +206,7 @@
|
|||
|
||||
this.initialize = initialize;
|
||||
this.isShowing = function isShowing() { return showing; }
|
||||
this.search = search;
|
||||
this.search = search; // called by react
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -566,7 +566,7 @@ NotificationActions = @NotificationActions
|
|||
return unless @ensureConnected()
|
||||
|
||||
# just make double sure a previous session state is cleared out
|
||||
@sessionEnded()
|
||||
@sessionEnded(true)
|
||||
|
||||
# update the session data to be empty
|
||||
@updateCurrentSession(null)
|
||||
|
|
@ -1019,7 +1019,7 @@ NotificationActions = @NotificationActions
|
|||
selfOpenedJamTracks: () ->
|
||||
@currentSession && (@currentSession.jam_track_initiator_id == context.JK.currentUserId)
|
||||
|
||||
sessionEnded: () ->
|
||||
sessionEnded: (onJoin) ->
|
||||
# cleanup
|
||||
|
||||
context.JK.JamServer.unregisterMessageCallback(context.JK.MessageType.SESSION_JOIN, @trackChanges);
|
||||
|
|
@ -1053,7 +1053,7 @@ NotificationActions = @NotificationActions
|
|||
@controlsLockedForJamTrackRecording = false
|
||||
@openBackingTrack = null
|
||||
@downloadingJamTrack = false
|
||||
@sessionUtils.setAutoOpenJamTrack(null)
|
||||
@sessionUtils.setAutoOpenJamTrack(null) unless onJoin
|
||||
|
||||
JamTrackActions.close()
|
||||
NotificationActions.sessionEnded()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
};
|
||||
|
||||
sessionUtils.setAutoOpenJamTrack = function(jamTrack) {
|
||||
logger.debug("setting auto-load jamtrack")
|
||||
logger.debug("setting auto-load jamtrack", jamTrack)
|
||||
autoOpenJamTrack = jamTrack;
|
||||
}
|
||||
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
sessionUtils.grabAutoOpenJamTrack = function() {
|
||||
var jamTrack = autoOpenJamTrack;
|
||||
autoOpenJamTrack = null;
|
||||
logger.debug("grabbing auto-load jamtrack", jamTrack)
|
||||
return jamTrack;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ object @jam_track
|
|||
|
||||
attributes :id, :name, :description, :initial_play_silence, :original_artist, :version
|
||||
|
||||
node :genres do |item|
|
||||
item.genres.select(:description).map(&:description)
|
||||
end
|
||||
child(:genres) {
|
||||
attributes :id, :description
|
||||
}
|
||||
|
||||
node :jmep do |jam_track|
|
||||
jam_track.jmep_json ? JSON.parse(jam_track.jmep_json) : nil
|
||||
|
|
|
|||
Loading…
Reference in New Issue