VRFS-5691 - fix both the jamtrack flow and the inability to sign out - take 2
This commit is contained in:
parent
4eac68b645
commit
eed3d51f4b
|
|
@ -500,9 +500,7 @@ export const getJamTrackPublic = options => {
|
|||
export const getJamTrackBySlug = options => {
|
||||
const { slug } = options;
|
||||
return new Promise((resolve, reject) => {
|
||||
apiFetch(`/jamtracks/${slug}`, {
|
||||
baseUrl: process.env.REACT_APP_CLIENT_BASE_URL
|
||||
})
|
||||
apiFetch(`/jamtracks/public/${slug}`)
|
||||
.then(response => resolve(response))
|
||||
.catch(error => reject(error));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
class ApiJamTracksController < ApiController
|
||||
|
||||
# have to be signed in currently to see this screen
|
||||
before_filter :api_signed_in_user, :except => [:index, :autocomplete, :show_with_artist_info, :artist_index]
|
||||
before_filter :api_signed_in_user, :except => [:index, :autocomplete, :show_with_artist_info, :artist_index, :public_show]
|
||||
before_filter :api_any_user, :only => [:index, :autocomplete, :show_with_artist_info, :artist_index]
|
||||
before_filter :lookup_jam_track_right, :only => [:download, :enqueue, :show_jam_track_right, :mark_active, :download_stem]
|
||||
before_filter :ip_blacklist, :only => [:download_stem, :download]
|
||||
|
|
@ -23,6 +23,11 @@ class ApiJamTracksController < ApiController
|
|||
@jam_track = JamTrack.find_by_plan_code!(params[:plan_code])
|
||||
end
|
||||
|
||||
def public_show
|
||||
@jam_track = JamTrack.find_by!(slug: params[:slug])
|
||||
render "api_jam_tracks/show_for_client", :layout => nil
|
||||
end
|
||||
|
||||
def index
|
||||
data = JamTrack.index(params, any_user)
|
||||
@jam_tracks, @next, @count = data[0], data[1], data[2]
|
||||
|
|
|
|||
|
|
@ -10,10 +10,6 @@ node :jmep do |jam_track|
|
|||
jam_track.jmep_json ? jam_track.jmep_json : nil
|
||||
end
|
||||
|
||||
node :can_download do |item|
|
||||
!!item.right_for_user(current_user, ShoppingCart::JAMTRACK_FULL)
|
||||
end
|
||||
|
||||
child(:jam_track_tracks => :tracks) {
|
||||
|
||||
attributes :id, :part, :instrument, :track_type, :position
|
||||
|
|
@ -27,22 +23,28 @@ child(:jam_track_tracks => :tracks) {
|
|||
end
|
||||
}
|
||||
|
||||
node do |jam_track|
|
||||
right = jam_track.right_for_user(current_user)
|
||||
if right
|
||||
{
|
||||
jam_track_right_id: right.id,
|
||||
purchased_at: right.created_at.to_i,
|
||||
last_mixdown_id: right.last_mixdown_id,
|
||||
last_stem_id: right.last_stem_id
|
||||
}
|
||||
if current_user
|
||||
node do |jam_track|
|
||||
right = jam_track.right_for_user(current_user)
|
||||
if right
|
||||
{
|
||||
jam_track_right_id: right.id,
|
||||
purchased_at: right.created_at.to_i,
|
||||
last_mixdown_id: right.last_mixdown_id,
|
||||
last_stem_id: right.last_stem_id
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
node :mixdowns do |jam_track|
|
||||
items = []
|
||||
jam_track.mixdowns_for_user(current_user).each do |mixdown|
|
||||
items << partial("api_jam_track_mixdowns/show", :object => mixdown)
|
||||
node :mixdowns do |jam_track|
|
||||
items = []
|
||||
jam_track.mixdowns_for_user(current_user).each do |mixdown|
|
||||
items << partial("api_jam_track_mixdowns/show", :object => mixdown)
|
||||
end
|
||||
items
|
||||
end
|
||||
|
||||
node :can_download do |item|
|
||||
!!item.right_for_user(current_user, ShoppingCart::JAMTRACK_FULL)
|
||||
end
|
||||
items
|
||||
end
|
||||
|
|
|
|||
|
|
@ -328,6 +328,7 @@ Rails.application.routes.draw do
|
|||
match '/jamtracks/purchased' => 'api_jam_tracks#purchased', :via => :get, :as => 'api_jam_tracks_purchased'
|
||||
match '/jamtracks/artists' => 'api_jam_tracks#artist_index', :via => :get, :as => 'api_jam_tracks_list_artists'
|
||||
match '/jamtracks/:id' => 'api_jam_tracks#show', :via => :get, :as => 'api_jam_tracks_show'
|
||||
match '/jamtracks/public/:slug' => 'api_jam_tracks#public_show', :via => :get, :as => 'api_jam_tracks_public_show'
|
||||
match '/jamtracks/band/:plan_code' => 'api_jam_tracks#show_with_artist_info', :via => :get, :as => 'api_jam_tracks_show_with_artist_info'
|
||||
match '/jamtracks' => 'api_jam_tracks#index', :via => :get, :as => 'api_jam_tracks_list'
|
||||
match '/jamtracks/download/:id' => 'api_jam_tracks#download', :via => :get, :as => 'api_jam_tracks_download'
|
||||
|
|
|
|||
Loading…
Reference in New Issue