Merge branch 'develop' into feature/jamtracks_enhancements
This commit is contained in:
commit
1f84f5c130
|
|
@ -317,3 +317,4 @@ purchasable_gift_cards.sql
|
||||||
versionable_jamtracks.sql
|
versionable_jamtracks.sql
|
||||||
session_controller.sql
|
session_controller.sql
|
||||||
jam_tracks_bpm.sql
|
jam_tracks_bpm.sql
|
||||||
|
jam_track_sessions.sql
|
||||||
|
|
@ -15,7 +15,6 @@ CREATE TABLE admin_users (
|
||||||
updated_at timestamp without time zone NOT NULL
|
updated_at timestamp without time zone NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
ALTER TABLE public.admin_users OWNER TO postgres;
|
|
||||||
CREATE SEQUENCE admin_users_id_seq
|
CREATE SEQUENCE admin_users_id_seq
|
||||||
START WITH 1
|
START WITH 1
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
|
|
@ -23,7 +22,6 @@ CREATE SEQUENCE admin_users_id_seq
|
||||||
NO MAXVALUE
|
NO MAXVALUE
|
||||||
CACHE 1;
|
CACHE 1;
|
||||||
|
|
||||||
ALTER TABLE public.admin_users_id_seq OWNER TO postgres;
|
|
||||||
ALTER SEQUENCE admin_users_id_seq OWNED BY admin_users.id;
|
ALTER SEQUENCE admin_users_id_seq OWNED BY admin_users.id;
|
||||||
SELECT pg_catalog.setval('admin_users_id_seq', 2, true);
|
SELECT pg_catalog.setval('admin_users_id_seq', 2, true);
|
||||||
ALTER TABLE ONLY admin_users ALTER COLUMN id SET DEFAULT nextval('admin_users_id_seq'::regclass);
|
ALTER TABLE ONLY admin_users ALTER COLUMN id SET DEFAULT nextval('admin_users_id_seq'::regclass);
|
||||||
|
|
@ -45,7 +43,6 @@ CREATE TABLE active_admin_comments (
|
||||||
updated_at timestamp without time zone NOT NULL,
|
updated_at timestamp without time zone NOT NULL,
|
||||||
namespace character varying(255)
|
namespace character varying(255)
|
||||||
);
|
);
|
||||||
ALTER TABLE public.active_admin_comments OWNER TO postgres;
|
|
||||||
CREATE SEQUENCE active_admin_comments_id_seq
|
CREATE SEQUENCE active_admin_comments_id_seq
|
||||||
START WITH 1
|
START WITH 1
|
||||||
INCREMENT BY 1
|
INCREMENT BY 1
|
||||||
|
|
@ -53,7 +50,6 @@ CREATE SEQUENCE active_admin_comments_id_seq
|
||||||
NO MAXVALUE
|
NO MAXVALUE
|
||||||
CACHE 1;
|
CACHE 1;
|
||||||
|
|
||||||
ALTER TABLE public.active_admin_comments_id_seq OWNER TO postgres;
|
|
||||||
ALTER SEQUENCE active_admin_comments_id_seq OWNED BY active_admin_comments.id;
|
ALTER SEQUENCE active_admin_comments_id_seq OWNED BY active_admin_comments.id;
|
||||||
SELECT pg_catalog.setval('active_admin_comments_id_seq', 1, false);
|
SELECT pg_catalog.setval('active_admin_comments_id_seq', 1, false);
|
||||||
ALTER TABLE ONLY active_admin_comments ALTER COLUMN id SET DEFAULT nextval('active_admin_comments_id_seq'::regclass);
|
ALTER TABLE ONLY active_admin_comments ALTER COLUMN id SET DEFAULT nextval('active_admin_comments_id_seq'::regclass);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
CREATE TABLE jam_track_sessions (
|
||||||
|
id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||||
|
jam_track_id VARCHAR(64) NOT NULL REFERENCES jam_tracks(id) ON DELETE CASCADE,
|
||||||
|
session_type VARCHAR(10) NOT NULL,
|
||||||
|
music_session_id VARCHAR(64) REFERENCES music_sessions(id) ON DELETE SET NULL,
|
||||||
|
user_id VARCHAR(64) NOT NULL REFERENCES users(id),
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
|
@ -256,6 +256,7 @@ require "jam_ruby/models/jam_track_search"
|
||||||
require "jam_ruby/models/gift_card"
|
require "jam_ruby/models/gift_card"
|
||||||
require "jam_ruby/models/gift_card_purchase"
|
require "jam_ruby/models/gift_card_purchase"
|
||||||
require "jam_ruby/models/gift_card_type"
|
require "jam_ruby/models/gift_card_type"
|
||||||
|
require "jam_ruby/models/jam_track_session"
|
||||||
|
|
||||||
include Jampb
|
include Jampb
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,14 @@ module JamRuby
|
||||||
subject: options[:subject])
|
subject: options[:subject])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def crash_alert(options)
|
||||||
|
mail(to: APP_CONFIG.email_crashes_alias,
|
||||||
|
from: APP_CONFIG.email_generic_from,
|
||||||
|
body: options[:body],
|
||||||
|
content_type: "text/plain",
|
||||||
|
subject: options[:subject])
|
||||||
|
end
|
||||||
|
|
||||||
def social(options)
|
def social(options)
|
||||||
mail(to: APP_CONFIG.email_social_alias,
|
mail(to: APP_CONFIG.email_social_alias,
|
||||||
from: APP_CONFIG.email_generic_from,
|
from: APP_CONFIG.email_generic_from,
|
||||||
|
|
|
||||||
|
|
@ -774,6 +774,8 @@ module JamRuby
|
||||||
self.opening_jam_track = true
|
self.opening_jam_track = true
|
||||||
self.save
|
self.save
|
||||||
self.opening_jam_track = false
|
self.opening_jam_track = false
|
||||||
|
|
||||||
|
JamTrackSession.create_session(jam_track, user, self.music_session) if jam_track && user
|
||||||
#self.tick_track_changes
|
#self.tick_track_changes
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,8 @@ module JamRuby
|
||||||
# VRFS-2916 jam_tracks.id is varchar: ADD
|
# VRFS-2916 jam_tracks.id is varchar: ADD
|
||||||
has_many :plays, :class_name => "JamRuby::PlayablePlay", :as => :playable, :dependent => :destroy
|
has_many :plays, :class_name => "JamRuby::PlayablePlay", :as => :playable, :dependent => :destroy
|
||||||
|
|
||||||
|
has_many :jam_track_session, :class_name => "JamRuby::JamTrackSession"
|
||||||
|
|
||||||
# when we know what JamTrack this refund is related to, these are associated
|
# when we know what JamTrack this refund is related to, these are associated
|
||||||
belongs_to :recurly_transactions, class_name: 'JamRuby::RecurlyTransactionWebHook'
|
belongs_to :recurly_transactions, class_name: 'JamRuby::RecurlyTransactionWebHook'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
module JamRuby
|
||||||
|
class JamTrackSession < ActiveRecord::Base
|
||||||
|
|
||||||
|
BROWSER = 'browser'
|
||||||
|
SESSION = 'session'
|
||||||
|
TYPES = [BROWSER, SESSION]
|
||||||
|
|
||||||
|
@@log = Logging.logger[JamTrackSession]
|
||||||
|
|
||||||
|
belongs_to :music_session, class_name: 'JamRuby::MusicSession'
|
||||||
|
belongs_to :user, class_name: 'JamRuby::User'
|
||||||
|
belongs_to :jam_track, class_name: 'JamRuby::JamTrack'
|
||||||
|
|
||||||
|
def self.create_session(jam_track, user, music_session)
|
||||||
|
create(jam_track, user, SESSION, music_session)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.create_browser(jam_track, user)
|
||||||
|
create(jam_track, user, BROWSER, nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def self.create(jam_track, user, type, music_session)
|
||||||
|
jam_track_session = JamTrackSession.new
|
||||||
|
jam_track_session.jam_track = jam_track
|
||||||
|
jam_track_session.user = user
|
||||||
|
jam_track_session.session_type = type
|
||||||
|
jam_track_session.music_session = music_session
|
||||||
|
jam_track_session.save
|
||||||
|
jam_track_session
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -53,6 +53,7 @@ module JamRuby
|
||||||
has_many :invited_fans, :through => :fan_invitations, :class_name => "JamRuby::User", :foreign_key => "receiver_id", :source => :receiver
|
has_many :invited_fans, :through => :fan_invitations, :class_name => "JamRuby::User", :foreign_key => "receiver_id", :source => :receiver
|
||||||
has_many :rsvp_slots, :class_name => "JamRuby::RsvpSlot", :foreign_key => "music_session_id", :dependent => :destroy
|
has_many :rsvp_slots, :class_name => "JamRuby::RsvpSlot", :foreign_key => "music_session_id", :dependent => :destroy
|
||||||
has_many :music_notations, :class_name => "JamRuby::MusicNotation", :foreign_key => "music_session_id"
|
has_many :music_notations, :class_name => "JamRuby::MusicNotation", :foreign_key => "music_session_id"
|
||||||
|
has_many :jam_track_session, :class_name => "JamRuby::JamTrackSession"
|
||||||
|
|
||||||
validates :genre, :presence => true
|
validates :genre, :presence => true
|
||||||
validates :description, :presence => true, :no_profanity => true
|
validates :description, :presence => true, :no_profanity => true
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,8 @@ module JamRuby
|
||||||
|
|
||||||
|
|
||||||
def self.ios_purchase(current_user, jam_track, receipt)
|
def self.ios_purchase(current_user, jam_track, receipt)
|
||||||
|
current_user.redeem_free_credit
|
||||||
|
|
||||||
jam_track_right = JamRuby::JamTrackRight.find_or_create_by_user_id_and_jam_track_id(current_user.id, jam_track.id) do |jam_track_right|
|
jam_track_right = JamRuby::JamTrackRight.find_or_create_by_user_id_and_jam_track_id(current_user.id, jam_track.id) do |jam_track_right|
|
||||||
jam_track_right.redeemed = false
|
jam_track_right.redeemed = false
|
||||||
jam_track_right.version = jam_track.version
|
jam_track_right.version = jam_track.version
|
||||||
|
|
@ -336,15 +338,8 @@ module JamRuby
|
||||||
# first, mark the free has_redeemable_jamtrack field if that's still true
|
# first, mark the free has_redeemable_jamtrack field if that's still true
|
||||||
# and if still they have more free things, then redeem the giftable_jamtracks
|
# and if still they have more free things, then redeem the giftable_jamtracks
|
||||||
if shopping_cart.free?
|
if shopping_cart.free?
|
||||||
if user.has_redeemable_jamtrack
|
current_user.redeem_free_credit
|
||||||
User.where(id: current_user.id).update_all(has_redeemable_jamtrack: false)
|
|
||||||
current_user.has_redeemable_jamtrack = false
|
|
||||||
else
|
|
||||||
User.where(id: current_user.id).update_all(gifted_jamtracks: current_user.gifted_jamtracks - 1)
|
|
||||||
current_user.gifted_jamtracks = current_user.gifted_jamtracks - 1
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
# this can't go in the block above, as it's here to fix bad subscription UUIDs in an update path
|
# this can't go in the block above, as it's here to fix bad subscription UUIDs in an update path
|
||||||
if jam_track_right.recurly_adjustment_uuid != recurly_adjustment_uuid
|
if jam_track_right.recurly_adjustment_uuid != recurly_adjustment_uuid
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,8 @@ module JamRuby
|
||||||
has_one :musician_search, :class_name => 'JamRuby::MusicianSearch'
|
has_one :musician_search, :class_name => 'JamRuby::MusicianSearch'
|
||||||
has_one :band_search, :class_name => 'JamRuby::BandSearch'
|
has_one :band_search, :class_name => 'JamRuby::BandSearch'
|
||||||
|
|
||||||
|
has_many :jam_track_session, :class_name => "JamRuby::JamTrackSession"
|
||||||
|
|
||||||
before_save :default_anonymous_names
|
before_save :default_anonymous_names
|
||||||
before_save :create_remember_token, :if => :should_validate_password?
|
before_save :create_remember_token, :if => :should_validate_password?
|
||||||
before_save :stringify_avatar_info , :if => :updating_avatar
|
before_save :stringify_avatar_info , :if => :updating_avatar
|
||||||
|
|
@ -1740,6 +1742,22 @@ module JamRuby
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def redeem_free_credit
|
||||||
|
yn = false
|
||||||
|
if self.has_redeemable_jamtrack
|
||||||
|
User.where(id: self.id).update_all(has_redeemable_jamtrack: false)
|
||||||
|
self.has_redeemable_jamtrack = false
|
||||||
|
yn = true
|
||||||
|
|
||||||
|
elsif 0 < self.gifted_jamtracks
|
||||||
|
User.where(id: self.id).update_all(gifted_jamtracks: self.gifted_jamtracks - 1)
|
||||||
|
self.gifted_jamtracks = self.gifted_jamtracks - 1
|
||||||
|
yn = true
|
||||||
|
end
|
||||||
|
yn
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def create_remember_token
|
def create_remember_token
|
||||||
self.remember_token = SecureRandom.urlsafe_base64
|
self.remember_token = SecureRandom.urlsafe_base64
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ def app_config
|
||||||
'alerts@jamkazam.com'
|
'alerts@jamkazam.com'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def email_crashes_alias
|
||||||
|
'clientcrash@jamkazam.com'
|
||||||
|
end
|
||||||
|
|
||||||
def email_recurly_notice
|
def email_recurly_notice
|
||||||
'recurly-alerts@jamkazam.com'
|
'recurly-alerts@jamkazam.com'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -626,6 +626,12 @@ ApiUsersController < ApiController
|
||||||
|
|
||||||
logger.debug("crash_dump can read from url #{read_url}")
|
logger.debug("crash_dump can read from url #{read_url}")
|
||||||
|
|
||||||
|
body = "Client crash for user #{current_user.email} (#{current_user.name})\n"
|
||||||
|
body << "Client type: #{@dump.client_type}"
|
||||||
|
body << "Client version: #{@dump.client_version}"
|
||||||
|
body << "Download at: #{read_url}\n"
|
||||||
|
body << "User admin url: #{current_user.admin_url}"
|
||||||
|
AdminMailer.crash_alert(subject: "Crash for #{@dump.client_type} #{current_user.email} (#{current_user.name})", body:body)
|
||||||
redirect_to write_url, status: 307
|
redirect_to write_url, status: 307
|
||||||
else
|
else
|
||||||
# we should store it here to aid in development, but we don't have to until someone wants the feature
|
# we should store it here to aid in development, but we don't have to until someone wants the feature
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,11 @@ class PopupsController < ApplicationController
|
||||||
@jamtrack_id = params[:jam_track_id]
|
@jamtrack_id = params[:jam_track_id]
|
||||||
@websocket = true
|
@websocket = true
|
||||||
gon.jamtrack_id = @jamtrack_id
|
gon.jamtrack_id = @jamtrack_id
|
||||||
|
|
||||||
|
jam_track = JamTrack.find_by_id(@jamtrack_id)
|
||||||
|
|
||||||
|
JamTrackSession.create_browser(jam_track, current_user) if jam_track && current_user
|
||||||
|
|
||||||
render :layout => "minimal"
|
render :layout => "minimal"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,7 @@ if defined?(Bundler)
|
||||||
config.num_packaging_nodes = 2
|
config.num_packaging_nodes = 2
|
||||||
|
|
||||||
config.email_social_alias = 'social@jamkazam.com'
|
config.email_social_alias = 'social@jamkazam.com'
|
||||||
|
config.email_crashes_alias = 'clientcrash@jamkazam.com'
|
||||||
config.email_alerts_alias = 'alerts@jamkazam.com' # should be used for 'oh no' server down/service down sorts of emails
|
config.email_alerts_alias = 'alerts@jamkazam.com' # should be used for 'oh no' server down/service down sorts of emails
|
||||||
config.email_generic_from = 'nobody@jamkazam.com'
|
config.email_generic_from = 'nobody@jamkazam.com'
|
||||||
config.email_recurly_notice = 'recurly-alerts@jamkazam.com'
|
config.email_recurly_notice = 'recurly-alerts@jamkazam.com'
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ SampleApp::Application.configure do
|
||||||
config.video_available= ENV['VIDEO_AVAILABILITY'] || "full"
|
config.video_available= ENV['VIDEO_AVAILABILITY'] || "full"
|
||||||
config.email_generic_from = 'nobody-dev@jamkazam.com'
|
config.email_generic_from = 'nobody-dev@jamkazam.com'
|
||||||
config.email_alerts_alias = ENV['ALERT_EMAIL'] || 'alerts-dev@jamkazam.com'
|
config.email_alerts_alias = ENV['ALERT_EMAIL'] || 'alerts-dev@jamkazam.com'
|
||||||
|
config.email_crashes_alias = ENV['ALERT_EMAIL'] || 'clientcrash@jamkazam.com'
|
||||||
config.email_social_alias = ENV['ALERT_EMAIL'] || 'social-dev@jamkazam.com'
|
config.email_social_alias = ENV['ALERT_EMAIL'] || 'social-dev@jamkazam.com'
|
||||||
config.guard_against_fraud = true
|
config.guard_against_fraud = true
|
||||||
config.guard_against_browser_fraud = false
|
config.guard_against_browser_fraud = false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue