* treat risky users differently
This commit is contained in:
parent
3a95b22762
commit
427bcd6e56
|
|
@ -24,8 +24,10 @@ if true # /iPhone|iPad|iPod|android/i.test(navigator.userAgent)
|
|||
AppActions = reactContext.AppActions
|
||||
JamTrackPlayerActions = reactContext.JamTrackPlayerActions
|
||||
JamTrackPlayerStore = reactContext.JamTrackPlayerStore
|
||||
UserStore = reactContext.UserStore
|
||||
|
||||
mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged'))
|
||||
mixins.push(Reflux.listenTo(UserStore, 'onUserChanged'))
|
||||
|
||||
|
||||
@PopupJamTrackPlayer = React.createClass({
|
||||
|
|
@ -42,6 +44,9 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
#logger.debug("PopupMediaControls: jamtrack changed", changes)
|
||||
@setState({jamTrackState: changes})
|
||||
|
||||
onUserChanged: (changes) ->
|
||||
@setState({user: changes.user})
|
||||
|
||||
showMetronome: (e) ->
|
||||
e.preventDefault()
|
||||
|
||||
|
|
@ -52,6 +57,7 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
state.jamTrackState = JamTrackPlayerStore.getState()
|
||||
state.showCustomMixes = true
|
||||
state.showMyMixes = true
|
||||
state.user = UserStore.getState().user
|
||||
return state
|
||||
|
||||
close: () ->
|
||||
|
|
@ -457,8 +463,18 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
alert("This mix is not yet ready to download.")
|
||||
e.preventDefault()
|
||||
|
||||
verificationCheck: () ->
|
||||
|
||||
if @state.user?.email_needs_verification
|
||||
alert("Check your email and click the verification link. Refresh this page when done, and try again.")
|
||||
|
||||
return @state.user?.email_needs_verification
|
||||
|
||||
downloadMixdownReady: (mixdown, e) ->
|
||||
|
||||
if @verificationCheck()
|
||||
e.preventDefault()
|
||||
return
|
||||
|
||||
if mixdown.myPackage?.signing_state == 'SIGNED'
|
||||
if /iPhone|iPad|iPod/i.test(navigator.userAgent)
|
||||
|
|
@ -476,8 +492,11 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
window.location.protocol + '//' + window.location.host + "/api/mixdowns/#{mixdown.id}/download.mp3?file_type=mp3&sample_rate=48&download=1"
|
||||
|
||||
activateStem: (e) ->
|
||||
|
||||
e.preventDefault()
|
||||
|
||||
return if @verificationCheck()
|
||||
|
||||
$select = $(this.getDOMNode()).find('.active-stem-select')
|
||||
|
||||
selectedTrackId = $select.val()
|
||||
|
|
@ -499,6 +518,10 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
|
||||
downloadStem: (e) ->
|
||||
|
||||
if @verificationCheck()
|
||||
e.preventDefault()
|
||||
return
|
||||
|
||||
$select = $(this.getDOMNode()).find('.active-stem-select')
|
||||
|
||||
selectedTrackId = $select.val()
|
||||
|
|
@ -550,6 +573,10 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
|
||||
jamTrackDownload: (jamTrack, e) ->
|
||||
|
||||
if @verificationCheck()
|
||||
e.preventDefault()
|
||||
return
|
||||
|
||||
if /iPhone|iPad|iPod/i.test(navigator.userAgent)
|
||||
# fall through
|
||||
|
||||
|
|
@ -590,7 +617,6 @@ mixins.push(Reflux.listenTo(JamTrackPlayerStore, 'onJamTrackPlayerStoreChanged')
|
|||
if confirm("Delete this custom mix?")
|
||||
JamTrackPlayerActions.deleteMixdown(mixdown)
|
||||
|
||||
|
||||
mixdownError: (mixdown) ->
|
||||
|
||||
myPackage = mixdown.myPackage
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@ if accessOpener
|
|||
JamTrackStore = window.opener.JamTrackStore
|
||||
MixerStore = window.opener.MixerStore
|
||||
SessionStore = window.opener.SessionStore
|
||||
UserStore = window.opener.UserStore
|
||||
|
||||
mixins.push(Reflux.listenTo(MixerStore, 'onMixersChanged'))
|
||||
mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
||||
mixins.push(Reflux.listenTo(UserStore, 'onUserChanged'))
|
||||
|
||||
@PopupMediaControls = React.createClass({
|
||||
|
||||
|
|
@ -69,6 +71,9 @@ mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
|||
logger.debug("PopupMediaControls: jamtrack changed", changes)
|
||||
@setState({jamTrackState: changes})
|
||||
|
||||
onUserChanged: (changes) ->
|
||||
@setState({user: changes.user})
|
||||
|
||||
showMetronome: (e) ->
|
||||
e.preventDefault()
|
||||
|
||||
|
|
@ -80,6 +85,7 @@ mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
|||
|
||||
state = @updateFromMixerHelper(MixerStore.mixers, MixerStore.session)
|
||||
state.jamTrackState = JamTrackStore.getState()
|
||||
state.user = UserStore.getState().user
|
||||
return state
|
||||
else
|
||||
|
||||
|
|
@ -482,15 +488,25 @@ mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
|||
|
||||
JamTrackActions.activateNoMixdown(jamtrack)
|
||||
|
||||
verificationCheck: () ->
|
||||
if @state.user?.email_needs_verification
|
||||
alert("Check your email and click the verification link. Close and re-open this JamTrack, and try again.")
|
||||
|
||||
return @state.user?.email_needs_verification
|
||||
|
||||
jamTrackDownload: (jamTrack, e) ->
|
||||
e.preventDefault()
|
||||
|
||||
return if @verificationCheck()
|
||||
|
||||
AppActions.openExternalUrl(window.location.protocol + '//' + window.location.host + "/api/jamtracks/#{jamTrack.id}/stems/master/download.mp3?file_type=mp3&download=1")
|
||||
|
||||
stemChanged:() ->
|
||||
stemDownload: (e) ->
|
||||
e.preventDefault()
|
||||
|
||||
return if @verificationCheck()
|
||||
|
||||
$select = $(this.getDOMNode()).find('.active-stem-select')
|
||||
|
||||
selectedTrackId = $select.val()
|
||||
|
|
@ -532,6 +548,8 @@ mixins.push(Reflux.listenTo(JamTrackStore, 'onJamTrackChanged'))
|
|||
downloadMixdownReady: (mixdown, e) ->
|
||||
e.preventDefault()
|
||||
|
||||
return if @verificationCheck()
|
||||
|
||||
# find the mp3 package for browser state check
|
||||
for mixdown_package in mixdown.packages
|
||||
if mixdown_package.file_type == 'mp3'
|
||||
|
|
|
|||
|
|
@ -28,5 +28,8 @@ logger = context.JK.logger
|
|||
|
||||
changed:() ->
|
||||
@trigger({user: @user})
|
||||
|
||||
getState:() ->
|
||||
{user: @user}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,11 @@ class ApiJamTrackMixdownsController < ApiController
|
|||
end
|
||||
|
||||
def download
|
||||
if current_user.email_needs_verification
|
||||
render :json => { :message => "verify email" }, :status => 403
|
||||
return
|
||||
end
|
||||
|
||||
if @jam_track_right.valid?
|
||||
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -152,6 +152,12 @@ class ApiJamTracksController < ApiController
|
|||
end
|
||||
|
||||
def download_stem
|
||||
|
||||
if current_user.email_needs_verification
|
||||
render :json => { :message => "verify email" }, :status => 403
|
||||
return
|
||||
end
|
||||
|
||||
if @jam_track_right.valid?
|
||||
|
||||
if params[:stem_id] == 'master'
|
||||
|
|
@ -174,6 +180,11 @@ class ApiJamTracksController < ApiController
|
|||
end
|
||||
|
||||
def download
|
||||
if current_user.email_needs_verification
|
||||
render :json => { :message => "verify email" }, :status => 403
|
||||
return
|
||||
end
|
||||
|
||||
if @jam_track_right.valid?
|
||||
|
||||
all_fingerprint = params[:all_fp]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
object @user
|
||||
|
||||
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :follower_count, :following_count,
|
||||
:recording_count, :session_count, :biography, :favorite_count, :audio_latency, :upcoming_session_count, :age, :website, :skill_level, :reuse_card
|
||||
:recording_count, :session_count, :biography, :favorite_count, :audio_latency, :upcoming_session_count, :age, :website, :skill_level, :reuse_card, :email_needs_verification
|
||||
|
||||
if @user.musician?
|
||||
node :location do @user.location end
|
||||
|
|
|
|||
Loading…
Reference in New Issue