* upgrade to Rails 4 as well as support JjamBlaster

This commit is contained in:
Seth Call 2016-07-17 10:16:27 -05:00
parent 61368ae20d
commit 510d157262
525 changed files with 4051 additions and 1830 deletions

View File

@ -14,42 +14,41 @@ else
ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] ||= "true"
end
gem 'rails', '~> 3.2.22'
gem 'rails', '> 4.2'
gem 'protected_attributes'
gem 'rails-observers'
gem 'bootstrap-sass', '2.0.4'
gem 'bcrypt-ruby', '3.0.1'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'sass-rails' #, '~> 3.2.3'
gem 'coffee-rails' #, '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
# this version is pinned due to this: https://github.com/gregbell/active_admin/issues/1939
gem 'coffee-script-source', '~> 1.4.0' # ADD THIS LINE, 1.5.0 doesn't compile ActiveAdmin JavaScript files
end
gem 'kickbox'
gem 'devise', '3.3.0'
gem 'will_paginate', '3.0.3'
gem 'uglifier' #, '>= 1.0.3'
gem 'net-ssh'
# this version is pinned due to this: https://github.com/gregbell/active_admin/issues/1939
gem 'coffee-script-source' #, '~> 1.4.0' # ADD THIS LINE, 1.5.0 doesn't compile ActiveAdmin JavaScript files
gem 'devise' #, '3.3.0'
gem 'will_paginate' #, '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'carrierwave', '0.9.0'
gem 'carrierwave' #, '0.9.0'
gem 'carrierwave_direct'
gem 'uuidtools', '2.1.2'
gem 'jquery-rails' # , '2.3.0' # pinned because jquery-ui-rails was split from jquery-rails, but activeadmin doesn't support this gem yet
gem 'jquery-ui-rails', '4.2.1'
gem 'rails3-jquery-autocomplete'
gem 'activeadmin' #, github: 'activeadmin', branch: '0-6-stable'
#gem 'activeadmin', github: 'activeadmin
gem 'jquery-ui-rails' #, '4.2.1'
gem 'jquery-rails'
gem 'rails-jquery-autocomplete' # This is the maintained version of rails3-jquery-autocomplete
gem 'activeadmin' , github: 'activeadmin', branch: 'master'
gem 'mime-types', '1.25'
gem 'meta_search'
gem 'fog'
#gem 'meta_search'
gem 'fog', "~> 1.32.0"
gem 'unf', '0.1.3' #optional fog dependency
gem 'country-select'
gem 'aasm', '3.0.16'
gem 'aasm' #, '3.0.16'
gem 'postgres-copy', '0.6.0'
gem 'aws-sdk', '~> 1'
gem 'bugsnag'
@ -62,21 +61,21 @@ gem 'resque-failed-job-mailer'
gem 'resque-lonely_job', '~> 1.0.0'
gem 'eventmachine', '1.0.4'
gem 'amqp', '0.9.8'
gem 'logging-rails', :require => 'logging/rails'
#gem 'logging-rails', :require => 'logging/rails'
gem 'pg_migrate'
gem 'ruby-protocol-buffers', '1.2.2'
gem 'sendgrid', '1.2.0'
gem 'geokit-rails'
gem 'postgres_ext', '1.0.0'
gem 'postgres_ext' #, '1.0.0'
gem 'resque_mailer'
gem 'rest-client'
gem 'iso-639'
gem 'rubyzip'
gem 'sanitize'
gem 'slim'
#gem 'influxdb'
gem 'cause' # needed by influxdb
gem 'influxdb-rails', '0.1.10'
#gem 'influxdb', '0.1.8'
#gem 'influxdb-rails', '0.1.10'
gem 'influxdb-rails'
gem 'recurly'
gem 'sendgrid_toolkit', '>= 1.1.1'
gem 'stripe'
@ -111,8 +110,8 @@ group :development, :test do
gem 'jasmine', '1.3.1'
gem 'execjs', '1.4.0'
#gem 'therubyracer' #, '0.11.0beta8'
gem 'factory_girl_rails', '4.1.0'
gem 'database_cleaner', '0.7.0'
gem 'factory_girl_rails' # , '4.1.0'
gem 'database_cleaner' #, '0.7.0'
gem 'launchy'
gem 'faker', '1.3.0'
gem 'puma'

View File

@ -16,7 +16,7 @@ ActiveAdmin.register JamRuby::AffiliatePartner, :as => 'Affiliates' do
index do
# default_actions # use this for all view/edit/delete links
# actions # use this for all view/edit/delete links
column 'User' do |oo| link_to(oo.partner_user.name, admin_user_path(oo.partner_user.id), {:title => oo.partner_user.name}) end
column 'Name' do |oo| oo.partner_name end
@ -29,7 +29,7 @@ ActiveAdmin.register JamRuby::AffiliatePartner, :as => 'Affiliates' do
link_to('Mark Paid', mark_paid_admin_affiliate_path(oo.id), :confirm => "Mark this affiliate as PAID?") if oo.unpaid
end
default_actions
actions
end

View File

@ -56,7 +56,7 @@ ActiveAdmin.register JamRuby::Connection, :as => 'Connection' do
end
index do
default_actions
actions
column :user_id do |c|
c.user ? c.user.name : ''
end

View File

@ -57,7 +57,7 @@ ActiveAdmin.register JamRuby::EmailBatch, :as => 'Batch Emails' do
link_to("Clone", batch_clone_admin_batch_email_path(bb.id))
end
default_actions
actions
end
show :title => 'Batch Email' do |obj|

View File

@ -42,12 +42,11 @@ ActiveAdmin.register_page "Fake Purchaser" do
end
content do
semantic_form_for JamTrackRight.new, :url => admin_fake_purchaser_bulk_jamtrack_purchase_path, :builder => ActiveAdmin::FormBuilder do |f|
f.inputs "Admin User to Fake JamTrack Purchases" do
f.input :user, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path, :input_html => { :id_element => "#jam_trak_right_user_id" }, hint: 'All JamTracks in the system will be \'bought\' for this user. No Recurly interaction occurs with this feature.'
active_admin_form_for JamTrackRight.new, :url => admin_fake_purchaser_bulk_jamtrack_purchase_path, :builder => ActiveAdmin::FormBuilder do |f|
inputs "Admin User to Fake JamTrack Purchases" do
input :user, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path, :input_html => { :id_element => "#jam_trak_right_user_id" }, hint: 'All JamTracks in the system will be \'bought\' for this user. No Recurly interaction occurs with this feature.'
end
f.actions
actions
end
end
end

View File

@ -10,7 +10,7 @@ ActiveAdmin.register JamRuby::FraudAlert, :as => 'Fraud Alerts' do
scope.joins('INNER JOIN "machine_fingerprints" ON "machine_fingerprints"."id" = "fraud_alerts"."machine_fingerprint_id" LEFT OUTER JOIN "fingerprint_whitelists" ON "fingerprint_whitelists"."fingerprint" = "machine_fingerprints"."fingerprint"').where('fingerprint_whitelists IS NULL')}
index do
default_actions
actions
column :machine_fingerprint
column :user

View File

@ -220,7 +220,7 @@ ActiveAdmin.register_page "Bootstrap" do
para "You need to create at least one server template, and one mount template. Click one of the top-left buttons based on your platform"
elsif IcecastMountTemplate.count == 0
semantic_form_for IcecastMountTemplate.new, :url => admin_bootstrap_create_mount_template_path, :builder => ActiveAdmin::FormBuilder do |f|
active_admin_form_for IcecastMountTemplate.new, :url => admin_bootstrap_create_mount_template_path, :builder => ActiveAdmin::FormBuilder do |f|
f.inputs "New Mount Template" do
f.input :hostname, :label => "jam-web public hostname:port (such that icecast can reach it)"
f.input :default_mime_type, :as => :select, :collection => ["ogg", "mp3"]
@ -228,7 +228,7 @@ ActiveAdmin.register_page "Bootstrap" do
f.actions
end
else
semantic_form_for IcecastServer.new, :url => admin_bootstrap_create_server_path, :builder => ActiveAdmin::FormBuilder do |f|
active_admin_form_for IcecastServer.new, :url => admin_bootstrap_create_server_path, :builder => ActiveAdmin::FormBuilder do |f|
f.inputs "New Icecast Server" do
f.input :hostname, :hint => "Just the icecast hostname; no port"
f.input :template, :hint => "This is the template associated with the server. Not as useful for the 1st server, but subsequent servers can use this same template, and share config"

View File

@ -17,7 +17,7 @@ ActiveAdmin.register JamRuby::ArtifactUpdate, :as => 'Artifacts' do
f.input :uri, :as => :file, :hint => "Upload the artifact from Jenkins"
end
f.buttons
f.actions
end

View File

@ -62,7 +62,7 @@ ActiveAdmin.register JamRuby::User, :as => 'Users' do
column :session_settings
column :can_invite
# default_actions # use this for all view/edit/delete links
# actions # use this for all view/edit/delete links
column "Actions" do |user|
links = ''.html_safe
links << link_to("View", resource_path(user), :class => "member_link view_link")

View File

@ -11,7 +11,7 @@ ActiveAdmin.register_page "Harry Fox Request" do
content do
semantic_form_for JamTrackHfaRequest.new, :url => admin_harry_fox_request_create_request_path, :builder => ActiveAdmin::FormBuilder do |f|
active_admin_form_for JamTrackHfaRequest.new, :url => admin_harry_fox_request_create_request_path, :builder => ActiveAdmin::FormBuilder do |f|
f.inputs "New Harry Fox Licensing Request" do
f.input :name, :hint => "Some sort of name to help us remember what this request was for"
end

View File

@ -18,7 +18,7 @@ ActiveAdmin.register JamRuby::JamTrackRight, :as => 'JamTrackRights' do
filter :jam_track
index do
default_actions
actions
#column "Order" do |right|
#link_to("Place", order_admin_jam_track_right_path(right)) + " | " +

View File

@ -21,7 +21,7 @@ ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
index do
# default_actions # use this for all view/edit/delete links
# actions # use this for all view/edit/delete links
column "Actions" do |jam_track|
links = ''.html_safe
clz = "member_link view_link show_tracks"
@ -35,7 +35,7 @@ ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
column :name
column :onboarding_exceptions do |jam_track|
if jam_track.onboarding_exceptions
exceptions = JSON.parse(jam_track.onboarding_exceptions)
exceptions = jam_track.onboarding_exceptions
exceptions.keys.join(',')
else
''
@ -55,6 +55,7 @@ ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
column :licensor_royalty_amount
column :id
=begin
column :jam_track_tracks do |jam_track|
table_for jam_track.jam_track_tracks.order('position ASC') do
column :id
@ -77,6 +78,8 @@ ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
end
end
end
=end
end

View File

@ -18,7 +18,7 @@ ActiveAdmin.register JamRuby::PromoBuzz, :as => 'Buzz' do
column 'State' do |pp| pp.aasm_state end
column 'Position' do |pp| pp.position end
column 'Updated' do |pp| pp.updated_at end
default_actions
actions
end
show do

View File

@ -15,7 +15,7 @@ ActiveAdmin.register JamRuby::PromoLatest, :as => 'Latest' do
column 'State' do |pp| pp.aasm_state end
column 'Position' do |pp| pp.position end
column 'Updated' do |pp| pp.updated_at end
default_actions
actions
end
show do

View File

@ -21,7 +21,7 @@ ActiveAdmin.register JamRuby::RecurlyTransactionWebHook, :as => 'RecurlyHooks'
index do
default_actions
actions
column :transaction_type
column :transaction_at

View File

@ -15,7 +15,7 @@ ActiveAdmin.register_page "Test Jobs" do
content do
semantic_form_for LongRunning.new, :url => admin_test_jobs_long_running_path, :builder => ActiveAdmin::FormBuilder do |f|
active_admin_form_for LongRunning.new, :url => admin_test_jobs_long_running_path, :builder => ActiveAdmin::FormBuilder do |f|
f.inputs "Queue a long running job" do
f.input :time
end

View File

@ -8,7 +8,8 @@
// require jquery.ui.dialog
// require jquery.ui.autocomplete
//= require cocoon
//= require active_admin/application
//= require autocomplete-rails
//= require active_admin/base
//= require jquery-ui/autocomplete
// //= require autocomplete-rails
//= require base
//= require_tree .

View File

@ -8,7 +8,7 @@
// $sidebar-width: 242px;
/*
*= require jquery.ui.all
*= require jquery-ui
*= require custom
*/
// Active Admin's got SASS!

View File

@ -9,6 +9,6 @@
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require jquery.ui.all
*= require jquery-ui
*= require_tree .
*/

View File

@ -14,7 +14,7 @@ class ArtifactsController < ApplicationController
ArtifactUpdate.transaction do
# VRFS-1071: Postpone client update notification until installer is available for download
ArtifactUpdate.connection.execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED')
@artifact = ArtifactUpdate.find_or_create_by_product_and_environment(product, environment)
@artifact = ArtifactUpdate.find_or_create_by({product: product, environement: environment})
@artifact.version = version
@artifact.uri = file

View File

@ -35,7 +35,7 @@ class Cohort < ActiveRecord::Base
}
attr_accessible :all_time, :monthly_start
serialize :data_set, JSON
#serialize :data_set, JSON
before_create do
self.data_set ||= {}

View File

@ -9,7 +9,7 @@ ActiveRecord::Base.establish_connection(YAML::load(File.open('config/database.ym
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
Bundler.require(*Rails.groups)
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
@ -22,6 +22,7 @@ Band = JamRuby::Band
module JamAdmin
class Application < Rails::Application
config.eager_load = false
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

View File

@ -28,9 +28,6 @@ JamAdmin::Application.configure do
# Raise exception on mass assignment protection for Active Record models
config.active_record.mass_assignment_sanitizer = :strict
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.5
# Do not compress assets
config.assets.compress = false

View File

@ -1,6 +1,8 @@
JamAdmin::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
config.eager_load = true
# Code is not reloaded between requests
config.cache_classes = true
@ -9,7 +11,7 @@ JamAdmin::Application.configure do
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
config.serve_static_files = false
# Compress JavaScripts and CSS
config.assets.compress = true
@ -61,10 +63,6 @@ JamAdmin::Application.configure do
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
# config.active_record.auto_explain_threshold_in_seconds = 0.5
# Set the logging destination(s)
config.log_to = %w[file]

View File

@ -8,7 +8,7 @@ JamAdmin::Application.configure do
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.serve_static_files = true
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil

View File

@ -167,7 +167,7 @@ ActiveAdmin.setup do |config|
config.view_factory.footer = Footer
config.register_javascript 'autocomplete-rails.js'
config.register_stylesheet 'jquery.ui.theme.css'
config.register_stylesheet 'jquery-ui/theme'
config.authorization_adapter = "AdminAuthorization"

View File

@ -85,7 +85,7 @@ FactoryGirl.define do
end
factory :music_session_user_history, :class => JamRuby::MusicSessionUserHistory do
ignore do
transient do
history nil
user nil
end
@ -162,7 +162,7 @@ FactoryGirl.define do
association :creator, factory: :user
ignore do
transient do
name "My Music Session"
description "Come Music Session"
fan_chat true
@ -194,7 +194,7 @@ FactoryGirl.define do
end
factory :latency_tester, :class => JamRuby::LatencyTester do
ignore do
transient do
connection nil
make_connection true
end

View File

@ -37,7 +37,7 @@ Capybara.register_driver :poltergeist do |app|
driver = Capybara::Poltergeist::Driver.new(app, { debug: false, phantomjs_logger: File.open('log/phantomjs.out', 'w') })
end
Capybara.javascript_driver = :poltergeist
Capybara.default_wait_time = 10
Capybara.default_max_wait_time = 10
RSpec.configure do |config|
# ## Mock Framework

View File

@ -362,3 +362,4 @@ jamclass_report.sql
jamblasters_network.sql
immediate_recordings.sql
nullable_user_id_jamblaster.sql
rails4_migration.sql

View File

@ -0,0 +1 @@
ALTER TABLE music_sessions ALTER COLUMN session_removed_at DROP DEFAULT;

View File

@ -16,10 +16,17 @@ else
end
gem 'pg', '0.17.1', :platform => [:mri, :mswin, :mingw]
gem 'jdbc_postgres', :platform => [:jruby]
#gem 'jdbc_postgres', :platform => [:jruby]
gem 'activerecord', '> 4.2'
gem 'railties', '> 4.2'
gem 'actionmailer', '> 4.2'
gem 'rails-observers', '0.1.2'
gem 'protected_attributes' # needed to support attr_accessible
gem 'activerecord', '3.2.22'
gem "activerecord-import", "~> 0.4.1"
gem 'uuidtools', '2.1.2'
gem 'bcrypt-ruby', '3.0.1'
gem 'ruby-protocol-buffers', '1.2.2'
@ -27,11 +34,10 @@ gem 'eventmachine', '1.0.4'
gem 'amqp', '1.0.2'
gem 'kickbox'
gem 'will_paginate'
gem 'actionmailer', '3.2.22'
gem 'sendgrid', '1.2.0'
gem 'aws-sdk', '~> 1'
gem 'carrierwave', '0.9.0'
gem 'aasm', '3.0.16'
gem 'aasm'
gem 'devise', '3.3.0' # 3.4.0 causes: uninitialized constant ActionController::Metal (NameError)
gem 'postgres-copy'
gem 'geokit'
@ -60,10 +66,10 @@ gem 'email_validator'
group :test do
gem 'simplecov', '~> 0.7.1'
gem 'simplecov-rcov'
gem 'factory_girl', '4.1.0'
gem 'factory_girl', '4.5.0'
gem "rspec", "2.11"
gem 'spork', '0.9.0'
gem 'database_cleaner', '1.3.0'
gem 'database_cleaner', '1.4.1'
gem 'faker', '1.3.0'
gem 'resque_spec' #, :path => "/home/jam/src/resque_spec/"
gem 'timecop'

View File

@ -1,5 +1,10 @@
require "pg"
require "active_record"
require "rails/railtie"
require "protected_attributes"
require "rails-observers"
require "rails/observers/active_model"
require "rails/observers/activerecord/active_record"
require "carrierwave"
require "carrierwave/orm/activerecord"
require "jampb"
@ -25,6 +30,7 @@ require 'stripe'
require 'zip-codes'
require 'email_validator'
ActiveRecord::Base.raise_in_transactional_callbacks = true
require "jam_ruby/lib/timezone"
require "jam_ruby/constants/limits"
require "jam_ruby/constants/notification_types"
@ -224,7 +230,7 @@ require "jam_ruby/models/jam_track_hfa_request"
require "jam_ruby/models/jam_track_hfa_request_id"
require "jam_ruby/models/jam_track_track"
require "jam_ruby/models/jam_track_right"
require "jam_ruby/models/jam_track_tap_in"
#require "jam_ruby/models/jam_track_tap_in" # consider deletion
require "jam_ruby/models/jam_track_file"
require "jam_ruby/models/jam_track_mixdown"
require "jam_ruby/models/jam_track_mixdown_package"

View File

@ -35,6 +35,7 @@ module JamRuby
def save_jam_track_right_jkz(jam_track_right, sample_rate=48)
jam_track = jam_track_right.jam_track
jam_track.reload
py_root = APP_CONFIG.jamtracks_dir
step = 0
Dir.mktmpdir do |tmp_dir|

View File

@ -1,4 +1,12 @@
#
#
#
#
# shouldn't be used in Rails 4
#
#
#
#
# This needs to be outside the module to work.
class JsonValidator < ActiveModel::EachValidator
# implement the method called during validation

View File

@ -32,7 +32,7 @@ module JamRuby
def upload_sign(filename, content_md5, part_number, upload_id)
hdt = http_date_time
str_to_sign = "PUT\n#{content_md5}\n#{content_type}\n#{hdt}\n/#{@aws_bucket}/#{filename}?partNumber=#{part_number}&uploadId=#{upload_id}"
signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), @aws_secret, str_to_sign)).chomp
signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha1'), @aws_secret, str_to_sign)).chomp
{ :datetime => hdt,
:md5 => content_md5,
:url => "https://s3.amazonaws.com/#{@aws_bucket}/#{filename}?partNumber=#{part_number}&uploadId=#{upload_id}",

View File

@ -833,7 +833,7 @@ module JamRuby
def self.stats
stats = {}
result = ActiveMusicSession.select('count(distinct(id)) AS total, count(distinct(jam_track_initiator_id)) as jam_track_count, count(distinct(backing_track_initiator_id)) as backing_track_count, count(distinct(metronome_initiator_id)) as metronome_count, count(distinct(claimed_recording_initiator_id)) as recording_count').first
result = ActiveMusicSession.select('count(distinct(id)) AS total, count(distinct(jam_track_initiator_id)) as jam_track_count, count(distinct(backing_track_initiator_id)) as backing_track_count, count(distinct(metronome_initiator_id)) as metronome_count, count(distinct(claimed_recording_initiator_id)) as recording_count')[0]
stats['count'] = result['total'].to_i
stats['jam_track_count'] = result['jam_track_count'].to_i

View File

@ -45,7 +45,7 @@ class JamRuby::AffiliatePartner < ActiveRecord::Base
#validates :partner_code, format: { with: PARTNER_CODE_REGEX }, :allow_blank => true
validates :entity_type, inclusion: {in: ENTITY_TYPES, message: "invalid entity type"}
serialize :address, JSON
#serialize :address, JSON
before_save do |record|
record.address ||= ADDRESS_SCHEMA.clone

View File

@ -4,7 +4,7 @@ module JamRuby
self.table_name = "backing_tracks"
self.primary_key = 'id'
default_scope order('created_at ASC')
default_scope { order('created_at ASC') }
belongs_to :connection, :class_name => "JamRuby::Connection", :inverse_of => :tracks, :foreign_key => 'connection_id'
validates :connection, presence: true

View File

@ -110,8 +110,8 @@ module JamRuby
.order('created_at DESC')
.limit(10)
recordings.concat(msh)
recordings.sort! {|a,b| b.created_at <=> a.created_at}.first(5)
result = recordings.concat(msh)
result.sort! {|a,b| b.created_at <=> a.created_at}.first(5)
end
def location
@ -182,7 +182,7 @@ module JamRuby
band = id.blank? ? Band.new : Band.find(id)
# ensure user updating Band details is a Band member
unless band.new_record? || band.users.exists?(user)
unless band.new_record? || band.users.exists?(user.id)
raise JamPermissionError, ValidationMessages::USER_NOT_BAND_MEMBER_VALIDATION_ERROR
end

View File

@ -4,7 +4,7 @@ module JamRuby
cattr_accessor :jschema, :search_meta
attr_accessor :user_counters
serialize :data_blob, JSON
#serialize :data_blob, JSON
KEY_BAND_SEARCH_TYPE = 'band_search_type'
KEY_BAND_TYPE = 'band_type'
@ -251,6 +251,7 @@ module JamRuby
end
def _process_results_page(_results)
@results = _results
if user
@user_counters = @results.inject({}) { |hh,val| hh[val.id] = {}; hh }

View File

@ -7,7 +7,7 @@ module JamRuby
self.table_name = 'chat_messages'
self.primary_key = 'id'
default_scope order('created_at DESC')
default_scope { order('created_at DESC') }
attr_accessor :ignore_message_checks

View File

@ -33,7 +33,7 @@ module JamRuby
def user_belongs_to_recording
if user && recording && !recording.users.exists?(user)
if user && recording && !recording.users.exists?(user.id)
errors.add(:user, ValidationMessages::NOT_PART_OF_RECORDING)
end
end

View File

@ -4,6 +4,8 @@ module JamRuby
class Connection < ActiveRecord::Base
include HtmlSanitize
include AASM
# client_types
TYPE_CLIENT = 'client'
TYPE_BROWSER = 'browser'
@ -116,13 +118,13 @@ module JamRuby
if music_session.musician_access
if music_session.approval_required
if !(music_session.music_session.creator == user || music_session.creator == user || music_session.invited_musicians.exists?(user))
if !(music_session.music_session.creator == user || music_session.creator == user || music_session.invited_musicians.exists?(user.id))
errors.add(:approval_required, ValidationMessages::INVITE_REQUIRED)
return false
end
end
else
if !(music_session.music_session.creator == user || music_session.creator == user || music_session.invited_musicians.exists?(user))
if !(music_session.music_session.creator == user || music_session.creator == user || music_session.invited_musicians.exists?(user.id))
errors.add(:musician_access, ValidationMessages::INVITE_REQUIRED)
return false
end
@ -176,7 +178,7 @@ module JamRuby
def join_the_session(music_session, as_musician, tracks, user, audio_latency, videos=nil)
self.music_session_id = music_session.id
self.as_musician = as_musician
self.as_musician = as_musician == true # this is deliberate; otherwise we create a warning in one our tests that passes 'blarg' (rails warning about casting strings to false)
self.joining_session = true
self.joined_session_at = Time.now
associate_tracks(tracks) unless tracks.nil?
@ -244,7 +246,7 @@ module JamRuby
stats[result['client_type']] = result['client_type_count'].to_i
end
result = Connection.select('count(id) AS total, count(CASE WHEN scoring_timeout > NOW() THEN 1 ELSE null END) AS scoring_timeout_count, count(music_session_id) AS in_session, count(as_musician) AS musicians, count(CASE WHEN udp_reachable THEN 1 ELSE null END) AS udp_reachable_count, count(CASE WHEN is_network_testing THEN 1 ELSE null END) AS is_network_testing_count').first
result = Connection.select('count(id) AS total, count(CASE WHEN scoring_timeout > NOW() THEN 1 ELSE null END) AS scoring_timeout_count, count(music_session_id) AS in_session, count(as_musician) AS musicians, count(CASE WHEN udp_reachable THEN 1 ELSE null END) AS udp_reachable_count, count(CASE WHEN is_network_testing THEN 1 ELSE null END) AS is_network_testing_count')[0]
stats['count'] = result['total'].to_i
stats['scoring_timeout'] = result['scoring_timeout_count'].to_i

View File

@ -35,7 +35,7 @@ module JamRuby
csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false})
csv.each do |row|
vals = vals+sep+"(#{ActiveRecord::Base.quote_value(row[0])}, #{ActiveRecord::Base.quote_value(row[1])})"
vals = vals+sep+"(#{ActiveRecord::Base.quote_value(row[0], nil)}, #{ActiveRecord::Base.quote_value(row[1], nil)})"
sep = ','
i += 1

View File

@ -95,7 +95,7 @@ module JamRuby
AdminMailer.alerts({
subject:"Account IP Access Violation. USER: #{user.email}",
body:body
}).deliver
}).deliver_now
end
end
@ -119,7 +119,7 @@ module JamRuby
AdminMailer.alerts({
subject:"Single IP Access Violation. IP:#{remote_ip}",
body:body
}).deliver
}).deliver_now
# and now shut them down
if Rails.application.config.ban_jamtrack_downloaders

View File

@ -7,7 +7,7 @@ module JamRuby
attr_accessible :from_email, :subject, :test_emails, :body
attr_accessible :lock_version, :opt_in_count, :sent_count, :started_at, :completed_at
default_scope :order => 'created_at DESC'
default_scope { order('created_at DESC') }
VAR_FIRST_NAME = '@FIRSTNAME'
VAR_LAST_NAME = '@LASTNAME'
@ -88,7 +88,7 @@ FOO
if 'test' == Rails.env
BatchMailer.send_batch_email(self.id, bset.user_id).deliver!
else
BatchMailer.send_batch_email(self.id, bset.user_id).deliver
BatchMailer.send_batch_email(self.id, bset.user_id).deliver_now
end
end
end
@ -122,7 +122,7 @@ FOO
if 'test' == Rails.env
BatchMailer.send_batch_email_test(self.id).deliver!
else
BatchMailer.send_batch_email_test(self.id).deliver
BatchMailer.send_batch_email_test(self.id).deliver_now
end
end

View File

@ -118,7 +118,7 @@ SQL
self.fetch_recipients do |user, new_musicians|
self.opt_in_count += 1
bset = EmailBatchSet.new_musician_set(self, user, new_musicians)
UserMailer.new_musicians(user, new_musicians).deliver
UserMailer.new_musicians(user, new_musicians).deliver_now
end
self.sent_count = self.opt_in_count
self.save

View File

@ -214,7 +214,7 @@ SQL
self.fetch_recipients(trigger_idx) do |users|
users.each do |uu|
self.email_batch_sets << (bset = self.make_set(uu, trigger_idx))
ProgressMailer.send_reminder(bset).deliver
ProgressMailer.send_reminder(bset).deliver_now
sent += 1
end
end

View File

@ -137,7 +137,7 @@ module JamRuby
self.fetch_recipients do |receiver, sessions_and_latency|
self.opt_in_count += 1
bset = EmailBatchSet.scheduled_session_set(self, receiver, sessions_and_latency)
UserMailer.scheduled_session_daily(receiver, sessions_and_latency).deliver
UserMailer.scheduled_session_daily(receiver, sessions_and_latency).deliver_now
end
self.test_emails = _count_recipients.inspect

View File

@ -8,11 +8,11 @@ module JamRuby
validates :email, uniqueness: true
def self.banned(user)
EmailBlacklist.count(:conditions => "email = '#{user.email.downcase}'") >= 1
EmailBlacklist.where("email = '#{user.email.downcase}'").count >= 1
end
def self.listed(user)
EmailBlacklist.count(:conditions => "email= '#{user.id}'") == 1
EmailBlacklist.where("email = '#{user.id}'").count == 1
end
def self.admin_url

View File

@ -4,7 +4,7 @@ module JamRuby
observe JamRuby::Feedback
def after_validation(feedback)
CorpMailer.feedback(feedback).deliver unless feedback.errors.any?
CorpMailer.feedback(feedback).deliver_now unless feedback.errors.any?
end
end
end

View File

@ -73,7 +73,7 @@ module JamRuby
[locid, countrycode, region, city, postalcode, latitude, longitude, metrocode, areacode])
end
def self.i(s)
def self.what(s)
return 'NULL' if s.nil? or s.blank?
return s.to_i
end
@ -175,7 +175,8 @@ module JamRuby
metrocode = row[7]
areacode = row[8]
vals = vals+sep+"(#{locid}, '#{countrycode}', '#{region}', #{quote_value(city)}, '#{postalcode}', #{latitude}, #{longitude}, #{i(metrocode)}, '#{areacode}')"
quoted_city = quote_value(city, nil)
vals = vals+sep+"(#{locid}, '#{countrycode}', '#{region}', #{quoted_city}, '#{postalcode}', #{latitude}, #{longitude}, #{what(metrocode)}, '#{areacode}')"
sep = ','
i += 1

View File

@ -16,8 +16,8 @@ module JamRuby
after_save :poke_config
def poke_config
IcecastServer.update(servers, config_changed: 1)
templates.each { |template| IcecastServer.update(template.servers, config_changed: 1) }
servers.update_all(config_changed: 1)
templates.each { |template| template.servers.update_all(config_changed: 1) }
end
def to_s

View File

@ -13,8 +13,8 @@ module JamRuby
after_save :poke_config
def poke_config
IcecastServer.update(servers, config_changed: 1)
templates.each { |template| IcecastServer.update(template.servers, config_changed: 1) }
servers.update_all(config_changed: 1)
templates.each { |template| template.servers.update_all(config_changed: 1) }
end
def to_s

View File

@ -19,8 +19,8 @@ module JamRuby
after_save :poke_config
def poke_config
IcecastServer.update(servers, config_changed: 1)
templates.each { |template| IcecastServer.update(template.servers, config_changed: 1) }
servers.update_all(config_changed: 1)
templates.each { |template| template.servers.update_all(config_changed: 1) }
end
def to_s

View File

@ -16,8 +16,8 @@ module JamRuby
after_save :poke_config
def poke_config
IcecastServer.update(servers, config_changed: 1)
templates.each { |template| IcecastServer.update(template.servers, config_changed: 1) }
servers.update_all(config_changed: 1)
templates.each { |template| template.servers.update_all(config_changed: 1) }
end
def to_s

View File

@ -16,8 +16,8 @@ module JamRuby
after_save :poke_config
def poke_config
IcecastServer.update(servers, config_changed: 1)
templates.each { |template| IcecastServer.update(template.servers, config_changed: 1) }
servers.update_all(config_changed: 1)
templates.each { |template| template.servers.update_all(config_changed: 1) }
end
def to_s

View File

@ -7,7 +7,7 @@ module JamRuby
has_many :servers, :class_name => "JamRuby::IcecastServer", :inverse_of => :master_relay, :foreign_key => "master_relay_id"
has_many :templates, :class_name => "JamRuby::IcecastTemplate", :inverse_of => :master_relay, :foreign_key => "master_relay_id"
validates :master_server, presence: true, length: {minimum: 1}
validates :master_server, length: {minimum: 1}
validates :master_server_port, presence: true, numericality: {only_integer: true}, length: {in: 1..65535}
validates :master_update_interval, presence: true, numericality: {only_integer: true}, length: {in: 1..1200}
validates :master_username, presence: true, length: {minimum: 5}
@ -18,8 +18,8 @@ module JamRuby
after_save :poke_config
def poke_config
IcecastServer.update(servers, config_changed: 1)
templates.each { |template| IcecastServer.update(template.servers, config_changed: 1) }
servers.update_all(config_changed: 1)
templates.each { |template| template.servers.update_all(config_changed: 1) }
end
def to_s

View File

@ -18,7 +18,7 @@ module JamRuby
belongs_to :server, class_name: "JamRuby::IcecastServer", inverse_of: :mounts, foreign_key: 'icecast_server_id'
belongs_to :mount_template, class_name: "JamRuby::IcecastMountTemplate", inverse_of: :mounts, foreign_key: 'icecast_mount_template_id'
has_many :source_changes, class_name: "JamRuby::IcecastSourceChange", inverse_of: :mount, foreign_key: 'icecast_mount_id', order: 'created_at DESC'
has_many :source_changes, -> { order('created_at DESC') }, class_name: "JamRuby::IcecastSourceChange", inverse_of: :mount, foreign_key: 'icecast_mount_id'
validates :name, presence: true, uniqueness: true
validates :source_username, length: {minimum: 5}, if: lambda {|m| m.source_username.present?}

View File

@ -36,7 +36,7 @@ module JamRuby
end
def poke_config
IcecastServer.update(servers, config_changed: 1)
servers.update_all(config_changed: 1)
end
def sanitize_active_admin

View File

@ -16,8 +16,8 @@ module JamRuby
before_destroy :poke_config
def poke_config
IcecastServer.update(servers, config_changed: 1)
templates.each { |template| IcecastServer.update(template.servers, config_changed: 1) }
servers.update_all(config_changed: 1)
templates.each { |template| template.servers.update_all(config_changed: 1) }
end
def to_s

View File

@ -17,7 +17,7 @@ module JamRuby
after_save :poke_config
def poke_config
IcecastServer.update(servers, :config_changed => true)
servers.update_all(:config_changed => 1)
end
def to_s

View File

@ -12,8 +12,8 @@ module JamRuby
after_save :poke_config
def poke_config
IcecastServer.update(servers, config_changed: 1)
templates.each { |template| IcecastServer.update(template.servers, config_changed: 1) }
servers.update_all(config_changed: 1)
templates.each { |template| template.servers.update_all(config_changed: 1) }
end
def to_s

View File

@ -13,8 +13,8 @@ module JamRuby
validates :source_direction, inclusion: {:in => [true, false]}
validates :success, inclusion: {:in => [true, false]}
validates :reason, length: {minimum: 0, maximum:255}
validates :detail, length: {minimum: 0, maximum:10000}
validates :reason, length: {minimum: 0, maximum:255}, allow_nil: true
validates :detail, length: {minimum: 0, maximum:10000}, allow_nil: true
validates :user, presence:true, :if => :is_client_change?
validates :client_id, presence: true, :if => :is_client_change?
validates :mount, presence:true

View File

@ -37,7 +37,7 @@ module JamRuby
before_destroy :poke_config
def poke_config
IcecastServer.update(servers, config_changed: 1)
servers.update_all(config_changed: 1)
end
def sanitize_active_admin

View File

@ -15,7 +15,7 @@ module JamRuby
before_destroy :poke_config
def poke_config
IcecastServer.update(template.servers, config_changed: 1) if template
template.servers.update_all(config_changed: 1) if template
end
end
end

View File

@ -31,14 +31,12 @@ module JamRuby
errors.add(:join_request, JOIN_REQUEST_IS_NOT_FOR_RECEIVER_AND_MUSIC_SESSION )
elsif join_request.nil?
# we only check for friendship requirement if this was not in response to a join_request
if !receiver.friends.exists?(sender) && (music_session.is_lesson? && receiver != music_session.lesson_session.teacher)
if !receiver.friends.exists?(sender)
if !receiver.friends.exists?(sender.id) && (music_session.is_lesson? && receiver != music_session.lesson_session.teacher)
if !receiver.friends.exists?(sender.id)
errors.add(:receiver, FRIENDSHIP_REQUIRED_VALIDATION_ERROR)
elsif (music_session.is_lesson? && receiver != music_session.lesson_session.teacher)
errors.add(:receiver, INVITATION_NOT_TEACHER_VALIDATION_ERROR)
end
end
end

View File

@ -5,9 +5,9 @@ module JamRuby
def after_create(invited_user)
if invited_user.sender.nil?
InvitedUserMailer.welcome_betauser(invited_user).deliver
InvitedUserMailer.welcome_betauser(invited_user).deliver_now
else
InvitedUserMailer.friend_invitation(invited_user).deliver
InvitedUserMailer.friend_invitation(invited_user).deliver_now
end if invited_user.email.present?
end
end

View File

@ -8,11 +8,11 @@ module JamRuby
validates :remote_ip, presence: true, uniqueness: true
def self.banned(remote_ip)
IpBlacklist.count(:conditions => "remote_ip = '#{remote_ip}' AND remote_ip not in (select remote_ip from ip_whitelists where remote_ip = '#{remote_ip}')") == 1
IpBlacklist.where("remote_ip = '#{remote_ip}' AND remote_ip not in (select remote_ip from ip_whitelists where remote_ip = '#{remote_ip}')").count == 1
end
def self.listed(remote_ip)
IpBlacklist.where(:conditions => "remote_ip = '#{remote_ip}'") == 1
IpBlacklist.where("remote_ip = '#{remote_ip}'").count == 1
end
def self.admin_url

View File

@ -8,7 +8,7 @@ module JamRuby
validates :remote_ip, presence:true, uniqueness:true
def self.listed(remote_ip)
IpWhitelist.count(:conditions => "remote_ip = '#{remote_ip}'") == 1
IpWhitelist.where("remote_ip = '#{remote_ip}'").count == 1
end
def self.admin_url

View File

@ -115,7 +115,7 @@ module JamRuby
endip = ip_address_to_int(strip_quotes(row[1]))
company = row[2]
vals = vals+sep+"(#{beginip}, #{endip}, #{quote_value(company)})"
vals = vals+sep+"(#{beginip}, #{endip}, #{quote_value(company, nil)})"
sep = ','
i += 1

View File

@ -31,7 +31,7 @@ module JamRuby
validates :songwriter, length: {maximum: 1000}
validates :publisher, length: {maximum: 1000}
validates :sales_region, inclusion: {in: [nil] + SALES_REGION}
validates_format_of :price, with: /^\d+\.*\d{0,2}$/
validates_format_of :price, with: /\A\d+\.*\d{0,2}\z/
validates :version, presence: true
validates :pro_ascap, inclusion: {in: [true, false]}
validates :pro_bmi, inclusion: {in: [true, false]}
@ -48,16 +48,16 @@ module JamRuby
validates :album_title, length: {maximum: 200}
validates :slug, uniqueness: true
validates_format_of :reproduction_royalty_amount, with: /^\d+\.*\d{0,4}$/, :allow_blank => true
validates_format_of :licensor_royalty_amount, with: /^\d+\.*\d{0,4}$/, :allow_blank => true
validates_format_of :reproduction_royalty_amount, with: /\A\d+\.*\d{0,4}\z/, :allow_blank => true
validates_format_of :licensor_royalty_amount, with: /\A\d+\.*\d{0,4}\z/, :allow_blank => true
belongs_to :licensor , class_name: 'JamRuby::JamTrackLicensor', foreign_key: 'licensor_id', :inverse_of => :jam_tracks
has_many :genres_jam_tracks, :class_name => "JamRuby::GenreJamTrack", :foreign_key => "jam_track_id", inverse_of: :jam_track
has_many :genres, :through => :genres_jam_tracks, :class_name => "JamRuby::Genre", :source => :genre
has_many :jam_track_tracks, :class_name => "JamRuby::JamTrackTrack", order: 'track_type ASC, position ASC, part ASC, instrument_id ASC'
has_many :jam_track_tap_ins, :class_name => "JamRuby::JamTrackTapIn", order: 'offset_time ASC'
has_many :jam_track_tracks, -> { order('track_type ASC, position ASC, part ASC, instrument_id ASC' )},:class_name => "JamRuby::JamTrackTrack"
has_many :jam_track_tap_ins, -> { order('offset_time ASC')}, :class_name => "JamRuby::JamTrackTapIn"
has_many :jam_track_files, :class_name => "JamRuby::JamTrackFile"
has_many :jam_track_rights, :class_name => "JamRuby::JamTrackRight" #, inverse_of: 'jam_track', :foreign_key => "jam_track_id" # '
@ -155,7 +155,7 @@ module JamRuby
if exceptions.keys.length == 0
self.update_column(:onboarding_exceptions, nil)
else
self.update_column(:onboarding_exceptions, exceptions.to_json)
self.update_column(:onboarding_exceptions, exceptions)
end
true
@ -472,7 +472,7 @@ module JamRuby
def has_count_in?
has_count_in = false
if jmep_json
jmep = JSON.parse(jmep_json)
jmep = jmep_json
if jmep["Events"]
events = jmep["Events"]

View File

@ -11,7 +11,7 @@ module JamRuby
# look through all jam_track requests, and find the highest one that is associated with an approved harry fox requests
def self.find_max()
max = JamTrackHfaRequestId.select('coalesce(max(request_id), 0) as max').joins('INNER JOIN jam_track_hfa_requests ON jam_track_hfa_requests.id = jam_track_hfa_request_id').where('received_at IS NOT NULL').first()['max']
max = JamTrackHfaRequestId.select('coalesce(max(request_id), 0) as max').joins('INNER JOIN jam_track_hfa_requests ON jam_track_hfa_requests.id = jam_track_hfa_request_id').where('received_at IS NOT NULL')[0]['max']
max.to_i
end

View File

@ -7,7 +7,7 @@ module JamRuby
belongs_to :user, class_name: "JamRuby::User" # the owner, or purchaser of the jam_track
belongs_to :jam_track, class_name: "JamRuby::JamTrack"
has_many :jam_track_mixdown_packages, class_name: "JamRuby::JamTrackMixdownPackage", order: 'created_at DESC'
has_many :jam_track_mixdown_packages, -> { order('created_at desc') }, class_name: "JamRuby::JamTrackMixdownPackage"#, order: 'created_at DESC'
has_one :jam_track_right, class_name: 'JamRuby::JamTrackRight', foreign_key: 'last_mixdown_id', inverse_of: :last_mixdown
validates :name, presence: true, length: {maximum: 100}
@ -49,7 +49,8 @@ module JamRuby
# the user has to specify at least at least one tweak to volume, speed, pitch, pan. otherwise there is nothing to do
parsed = JSON.parse(self.settings)
#parsed = JSON.parse(self.settings)
parsed = self.settings
specified_track_count = parsed["tracks"] ? parsed["tracks"].length : 0
tweaked = false

View File

@ -40,7 +40,9 @@ module JamRuby
def self.estimated_queue_time
jam_track_signing_count = JamTrackRight.where(queued: true).count
mixdowns = JamTrackMixdownPackage.unscoped.select('count(CASE WHEN queued THEN 1 ELSE NULL END) as queue_count, count(CASE WHEN speed_pitched THEN 1 ELSE NULL END) as speed_pitch_count').where(queued: true).first
#mixdowns = JamTrackMixdownPackage.unscoped.select('count(CASE WHEN queued THEN 1 ELSE NULL END) as queue_count, count(CASE WHEN speed_pitched THEN 1 ELSE NULL END) as speed_pitch_count').where(queued: true).limit(1)
mixdowns = ActiveRecord::Base.connection.execute("select count(CASE WHEN queued THEN 1 ELSE NULL END) as queue_count, count(CASE WHEN speed_pitched THEN 1 ELSE NULL END) as speed_pitch_count FROM jam_track_mixdown_packages WHERE queued = true")[0]
total_mixdowns = mixdowns['queue_count'].to_i
slow_mixdowns = mixdowns['speed_pitch_count'].to_i
fast_mixdowns = total_mixdowns - slow_mixdowns

View File

@ -295,7 +295,7 @@ module JamRuby
@@log.debug("ignoring 'all' hash found in whitelist")
else
# can we find a jam track that belongs to someone else with the same fingerprint
conflict = MachineFingerprint.select('count(id) as count').where('user_id != ?', current_user.id).where(fingerprint: all_fingerprint).where(remote_ip: remote_ip).where('created_at > ?', APP_CONFIG.expire_fingerprint_days.days.ago).first
conflict = MachineFingerprint.select('count(id) as count').where('user_id != ?', current_user.id).where(fingerprint: all_fingerprint).where(remote_ip: remote_ip).where('created_at > ?', APP_CONFIG.expire_fingerprint_days.days.ago)[0]
conflict_count = conflict['count'].to_i
if conflict_count >= APP_CONFIG.found_conflict_count
@ -307,7 +307,7 @@ module JamRuby
AdminMailer.alerts(subject: "'All' fingerprint collision by #{current_user.name}",
body: "Current User: #{current_user.admin_url}\n\n Fraud Alert: #{fraud_admin_url}").deliver
body: "Current User: #{current_user.admin_url}\n\n Fraud Alert: #{fraud_admin_url}").deliver_now
# try to record the other fingerprint
mf = MachineFingerprint.create(running_fingerprint, current_user, MachineFingerprint::TAKEN_ON_FRAUD_CONFLICT, MachineFingerprint::PRINT_TYPE_ACTIVE, remote_ip, running_fingerprint_extra, self)
@ -331,7 +331,7 @@ module JamRuby
@@log.debug("ignoring 'running' hash found in whitelist")
else
conflict = MachineFingerprint.select('count(id) as count').where('user_id != ?', current_user.id).where(fingerprint: running_fingerprint).where(remote_ip: remote_ip).where('created_at > ?', APP_CONFIG.expire_fingerprint_days.days.ago).first
conflict = MachineFingerprint.select('count(id) as count').where('user_id != ?', current_user.id).where(fingerprint: running_fingerprint).where(remote_ip: remote_ip).where('created_at > ?', APP_CONFIG.expire_fingerprint_days.days.ago)[0]
conflict_count = conflict['count'].to_i
if conflict_count >= APP_CONFIG.found_conflict_count
mf = MachineFingerprint.create(running_fingerprint, current_user, MachineFingerprint::TAKEN_ON_FRAUD_CONFLICT, MachineFingerprint::PRINT_TYPE_ACTIVE, remote_ip, running_fingerprint_extra, self)
@ -340,7 +340,7 @@ module JamRuby
fraud = FraudAlert.create(mf, current_user) if mf.valid?
fraud_admin_url = fraud.admin_url if fraud
AdminMailer.alerts(subject: "'Running' fingerprint collision by #{current_user.name}",
body: "Current User: #{current_user.admin_url}\n\nFraud Alert: #{fraud_admin_url}").deliver\
body: "Current User: #{current_user.admin_url}\n\nFraud Alert: #{fraud_admin_url}").deliver_now
# try to record the other fingerprint
mf = MachineFingerprint.create(all_fingerprint, current_user, MachineFingerprint::TAKEN_ON_FRAUD_CONFLICT, MachineFingerprint::PRINT_TYPE_ALL, remote_ip, all_fingerprint_extra, self)
@ -376,7 +376,7 @@ module JamRuby
def self.stats
stats = {}
result = JamTrackRight.select('count(id) as total, count(CASE WHEN signing_44 THEN 1 ELSE NULL END) + count(CASE WHEN signing_48 THEN 1 ELSE NULL END) as signing_count, count(CASE WHEN redeemed THEN 1 ELSE NULL END) as redeem_count, count(last_downloaded_at) as redeemed_and_dl_count').where(is_test_purchase: false).first
result = JamTrackRight.select('count(id) as total, count(CASE WHEN signing_44 THEN 1 ELSE NULL END) + count(CASE WHEN signing_48 THEN 1 ELSE NULL END) as signing_count, count(CASE WHEN redeemed THEN 1 ELSE NULL END) as redeem_count, count(last_downloaded_at) as redeemed_and_dl_count').where(is_test_purchase: false)[0]
stats['count'] = result['total'].to_i
stats['signing_count'] = result['signing_count'].to_i

View File

@ -40,7 +40,7 @@ module JamRuby
# only the creator of the join request can do a get
# or a member of the music_session that the join_request is designated for
def self.show(id, user)
return JoinRequest.find(id, :conditions => ["user_id = ? OR music_session_id IN (select music_session_id from connections WHERE user_id = ?)", user.id, user.id])
return JoinRequest.where(["user_id = ? OR music_session_id IN (select music_session_id from connections WHERE user_id = ?)", user.id, user.id]).find(id)
end
end
end

View File

@ -2,7 +2,7 @@ module JamRuby
class JsonStore < ActiveRecord::Base
self.table_name = 'json_stores'
serialize :data_blob, JSON
#serialize :data_blob, JSON
before_create do
self.data_blob ||= {}

View File

@ -449,8 +449,8 @@ module JamRuby
end
def send_notices
UserMailer.student_lesson_request(self).deliver
UserMailer.teacher_lesson_request(self).deliver
UserMailer.student_lesson_request(self).deliver_now
UserMailer.teacher_lesson_request(self).deliver_now
Notification.send_lesson_message('requested', lesson_sessions[0], false) # TODO: this isn't quite an 'accept'
self.sent_notices = true
self.sent_notices_at = Time.now
@ -616,18 +616,18 @@ module JamRuby
# just tell both people it's cancelled, to act as confirmation
Notification.send_lesson_message('canceled', next_lesson, false)
Notification.send_lesson_message('canceled', next_lesson, true)
UserMailer.student_lesson_booking_canceled(self, message).deliver
UserMailer.teacher_lesson_booking_canceled(self, message).deliver
UserMailer.student_lesson_booking_canceled(self, message).deliver_now
UserMailer.teacher_lesson_booking_canceled(self, message).deliver_now
purpose = "Lesson Canceled"
else
if canceler == student
# if it's the first time acceptance student canceling, we call it a 'cancel'
Notification.send_lesson_message('canceled', next_lesson, false)
UserMailer.teacher_lesson_booking_canceled(self, message).deliver
UserMailer.teacher_lesson_booking_canceled(self, message).deliver_now
purpose = "Lesson Canceled"
else
# if it's the first time acceptance teacher, it was declined
UserMailer.student_lesson_booking_declined(self, message).deliver
UserMailer.student_lesson_booking_declined(self, message).deliver_now
Notification.send_lesson_message('declined', next_lesson, true)
purpose = "Lesson Declined"
end

View File

@ -74,11 +74,11 @@ module JamRuby
def do_send_notices
if is_lesson?
UserMailer.student_lesson_normal_done(lesson_session).deliver
UserMailer.teacher_lesson_normal_done(lesson_session).deliver
UserMailer.student_lesson_normal_done(lesson_session).deliver_now
UserMailer.teacher_lesson_normal_done(lesson_session).deliver_now
else
UserMailer.student_lesson_monthly_charged(lesson_package_purchase).deliver
UserMailer.teacher_lesson_monthly_charged(lesson_package_purchase).deliver
UserMailer.student_lesson_monthly_charged(lesson_package_purchase).deliver_now
UserMailer.teacher_lesson_monthly_charged(lesson_package_purchase).deliver_now
end
end

View File

@ -262,8 +262,8 @@ module JamRuby
end
def send_starting_notice
UserMailer.lesson_starting_soon_student(self).deliver!
UserMailer.lesson_starting_soon_teacher(self).deliver!
UserMailer.lesson_starting_soon_student(self).deliver_now
UserMailer.lesson_starting_soon_teacher(self).deliver_now
self.sent_starting_notice = true
self.save(validate: false)
@ -374,7 +374,7 @@ module JamRuby
if !sent_notices
# not in spec; just poke user and tell them we saw it was successfully completed
UserMailer.monthly_recurring_done(self).deliver
UserMailer.monthly_recurring_done(self).deliver_now
self.sent_notices = true
self.sent_notices_at = Time.now
@ -390,7 +390,7 @@ module JamRuby
if !sent_notices
if !school_on_school?
# bad session; just poke user
UserMailer.monthly_recurring_no_bill(self).deliver
UserMailer.monthly_recurring_no_bill(self).deliver_now
end
self.sent_notices = true
@ -401,11 +401,10 @@ module JamRuby
end
else
puts "STUDENT NO BILL SENT #{self.id}"
if !sent_notices
if !school_on_school?
# bad session; just poke user
UserMailer.student_lesson_normal_no_bill(self).deliver
UserMailer.student_lesson_normal_no_bill(self).deliver_now
end
self.sent_notices = true
@ -426,8 +425,8 @@ module JamRuby
if !sent_notices
if !school_on_school?
puts "STUDENT NO BILL SENT #{success}"
UserMailer.student_lesson_normal_no_bill(self).deliver
UserMailer.teacher_lesson_normal_no_bill(self).deliver
UserMailer.student_lesson_normal_no_bill(self).deliver_now
UserMailer.teacher_lesson_normal_no_bill(self).deliver_now
end
self.sent_notices = true
@ -455,9 +454,9 @@ module JamRuby
def send_counter(countered_lesson, countered_slot)
if !lesson_booking.errors.any?
if countered_slot.is_teacher_created?
UserMailer.student_lesson_counter(countered_lesson, countered_slot).deliver
UserMailer.student_lesson_counter(countered_lesson, countered_slot).deliver_now
else
UserMailer.teacher_lesson_counter(countered_lesson, countered_slot).deliver
UserMailer.teacher_lesson_counter(countered_lesson, countered_slot).deliver_now
end
end
self.countering = false
@ -490,7 +489,7 @@ module JamRuby
end
def analysis_json
@parsed_analysis || analysis ? JSON.parse(analysis) : nil
@parsed_analysis || analysis
end
def validate_creating
@ -725,6 +724,7 @@ module JamRuby
message = params[:message]
slot = params[:slot]
accepter = params[:accepter]
raise "LessonBookingSlot" if slot.is_a?(LessonBookingSlot)
self.slot = slot = LessonBookingSlot.find(slot)
self.slot.accept_message = message
self.slot.save!
@ -744,8 +744,8 @@ module JamRuby
response = lesson_booking
raise ActiveRecord::Rollback
end
UserMailer.student_lesson_accepted(self, message, slot).deliver
UserMailer.teacher_lesson_accepted(self, message, slot).deliver
UserMailer.student_lesson_accepted(self, message, slot).deliver_now
UserMailer.teacher_lesson_accepted(self, message, slot).deliver_now
message = '' if message.nil?
msg = ChatMessage.create(teacher, nil, message, ChatMessage::CHANNEL_LESSON, nil, student, self, "Lesson Approved")
Notification.send_jamclass_invitation_teacher(music_session, teacher)
@ -770,8 +770,8 @@ module JamRuby
message = '' if message.nil?
msg = ChatMessage.create(slot.proposer, nil, message, ChatMessage::CHANNEL_LESSON, nil, slot.recipient, self, "All Lesson Times Updated")
Notification.send_lesson_message('accept', self, true) # TODO: this isn't quite an 'accept'
UserMailer.student_lesson_update_all(self, message, slot).deliver
UserMailer.teacher_lesson_update_all(self, message, slot).deliver
UserMailer.student_lesson_update_all(self, message, slot).deliver_now
UserMailer.teacher_lesson_update_all(self, message, slot).deliver_now
else
# nothing to do with the original booking (since we are not changing all times), so we update just ourself
time = update_next_available_time # XXX: week offset as 0? This *could* still be in the past. But the user is approving it. So do we just trust them and get out of their way?
@ -783,8 +783,8 @@ module JamRuby
end
message = '' if message.nil?
msg = ChatMessage.create(slot.proposer, nil, message, ChatMessage::CHANNEL_LESSON, nil, slot.recipient, self, "Lesson Updated Time Approved")
UserMailer.student_lesson_accepted(self, message, slot).deliver
UserMailer.teacher_lesson_accepted(self, message, slot).deliver
UserMailer.student_lesson_accepted(self, message, slot).deliver_now
UserMailer.teacher_lesson_accepted(self, message, slot).deliver_now
end
else
@@log.error("unable to accept slot #{slot.id} for lesson #{self.id} #{errors.inspect}")
@ -820,9 +820,11 @@ module JamRuby
self.counter_slot = slot
#end
if self.save
puts "SAVING OK"
#if update_all && !lesson_booking.counter(self, proposer, slot)
if !lesson_booking.counter(self, proposer, slot)
response = lesson_booking
puts "ROLLBACK"
raise ActiveRecord::Rollback
end
else
@ -923,8 +925,8 @@ module JamRuby
msg = ChatMessage.create(canceler, nil, message, ChatMessage::CHANNEL_LESSON, nil, other, self, "Lesson Canceled")
Notification.send_lesson_message('canceled', self, false)
Notification.send_lesson_message('canceled', self, true)
UserMailer.student_lesson_canceled(self, message).deliver
UserMailer.teacher_lesson_canceled(self, message).deliver
UserMailer.student_lesson_canceled(self, message).deliver_now
UserMailer.teacher_lesson_canceled(self, message).deliver_now
end
end

View File

@ -56,7 +56,7 @@ module JamRuby
#dmacode = row[8]
#areacode = row[9]
vals = vals+sep+"(#{quote_value(country)},#{quote_value(region)},#{quote_value(city)},#{lat},#{lng},#{ip_start},#{ip_end})"
vals = vals+sep+"(#{quote_value(country, nil)},#{quote_value(region, nil)},#{quote_value(city, nil)},#{lat},#{lng},#{ip_start},#{ip_end})"
sep = ','
i += 1

View File

@ -57,7 +57,7 @@ module JamRuby
country = row[2]
isp = row[3]
vals = vals+sep+"(#{ip_bottom}, #{ip_top}, '#{country}', #{quote_value(isp)})"
vals = vals+sep+"(#{ip_bottom}, #{ip_top}, '#{country}', #{quote_value(isp, nil)})"
sep = ','
i += 1

View File

@ -144,7 +144,7 @@ module JamRuby
was_jamtrack_played = false
if recording.timeline
recording_timeline_data = JSON.parse(recording.timeline)
recording_timeline_data = recording.timeline
# did the jam track play at all?
jam_track_isplaying = recording_timeline_data["jam_track_isplaying"]
@ -232,7 +232,7 @@ module JamRuby
level = 1.0 # default value - means no effect
if recorded_jam_track_track.timeline
timeline_data = JSON.parse(recorded_jam_track_track.timeline)
timeline_data = recorded_jam_track_track.timeline
# always take the 1st entry for now
first = timeline_data[0]

View File

@ -122,7 +122,7 @@ module JamRuby
new_session.session_controller = self.session_controller
# copy rsvp_slots, rsvp_requests, and rsvp_requests_rsvp_slots
RsvpSlot.find_each(:conditions => "music_session_id = '#{self.id}'") do |slot|
RsvpSlot.where("music_session_id = '#{self.id}'").find_each do |slot|
new_slot = RsvpSlot.new
new_slot.instrument_id = slot.instrument_id
new_slot.proficiency_level = slot.proficiency_level
@ -170,7 +170,7 @@ module JamRuby
end
# copy music_notations
MusicNotation.find_each(:conditions => "music_session_id = '#{self.id}'") do |notation|
MusicNotation.where("music_session_id = '#{self.id}'").find_each do |notation|
new_notation = MusicNotation.new
new_notation.user_id = notation.user_id
new_notation.music_session = new_session
@ -240,14 +240,14 @@ module JamRuby
if self.musician_access
if self.approval_required
return self.invited_musicians.exists?(user) || self.approved_rsvps.include?(user)
return self.invited_musicians.exists?(user.id) || self.approved_rsvps.include?(user)
else
return true
end
else
# the creator can always join, and the invited users can join
return self.creator == user || self.invited_musicians.exists?(user) || self.approved_rsvps.include?(user)
return self.creator == user || self.invited_musicians.exists?(user.id) || self.approved_rsvps.include?(user)
end
else
# it's a fan, and the only way a fan can join is if fan_access is true
@ -259,7 +259,7 @@ module JamRuby
if self.musician_access || self.fan_access
true
else
self.creator == user || self.invited_musicians.exists?(user)
self.creator == user || self.invited_musicians.exists?(user.id)
end
end
@ -528,7 +528,7 @@ module JamRuby
# which means are currently in the music_session, or, rsvp'ed, or creator
def part_of_session? user
# XXX check RSVP'ed
user == self.creator || (active_music_session ? active_music_session.users.exists?(user) : false)
user == self.creator || (active_music_session ? active_music_session.users.exists?(user.id) : false)
end
def is_over?
@ -644,7 +644,7 @@ module JamRuby
# retrieve users that have invitations but have not submitted an RSVP request for this session
def pending_invitations
User.find_by_sql(%Q{select distinct u.id, u.email, u.photo_url, u.first_name, u.last_name
User.find_by_sql(%Q{select distinct u.id, u.email, u.photo_url, u.first_name, u.last_name, u.online
from users u
inner join invitations i on u.id = i.receiver_id
left join rsvp_requests rr on rr.user_id = i.receiver_id
@ -876,6 +876,7 @@ SQL
timezone = ActiveSupport::TimeZone.new(tz_identifier)
rescue Exception => e
@@log.error("unable to find timezone=#{tz_identifier}, e=#{e}")
puts "unable to find timezone=#{tz_identifier}, e=#{e}"
end
if timezone
@ -945,13 +946,7 @@ SQL
duration = scheduled_duration
# you can put seconds into the scheduled_duration field, but once stored, it comes back out as a string
if scheduled_duration.class == String
begin
bits = scheduled_duration.split(':')
duration = bits[0].to_i.hours + bits[1].to_i.minutes + bits[2].to_i.seconds
rescue Exception => e
duration = 1.hours
@@log.error("unable to parse duration #{scheduled_duration}")
end
duration = scheduled_duration.to_i.seconds
end
duration
end

View File

@ -7,7 +7,7 @@ module JamRuby
self.primary_key = 'id'
default_scope order('created_at DESC')
default_scope { order('created_at DESC') }
belongs_to(:music_session,
:class_name => "JamRuby::MusicSession",

View File

@ -5,7 +5,7 @@ module JamRuby
self.primary_key = 'id'
default_scope order('user_id ASC')
default_scope { order('user_id ASC') }
attr_accessible :max_concurrent_connections, :session_removed_at, :rating
validates_inclusion_of :rating, :in => -1..1, :allow_nil => true
@ -140,7 +140,7 @@ module JamRuby
MIN_SESSION_DURATION_RATING = 60
def should_rate_session?
(2 <= music_session.unique_users.all.count &&
(2 <= music_session.unique_users.length &&
MIN_SESSION_DURATION_RATING < (Time.now - music_session.created_at).seconds) ||
Rails.env.development?
end

View File

@ -6,7 +6,7 @@ module JamRuby
self.primary_key = 'id'
# ensure most proficient, highest priority
default_scope order('proficiency_level DESC, priority ASC')
default_scope { order('proficiency_level DESC, priority ASC') }
# proficiency is 1 = Beginner, 2 = Intermediate, 3 = Expert

View File

@ -6,7 +6,7 @@ module JamRuby
self.primary_key = 'id'
default_scope order('created_at DESC')
default_scope { order('created_at DESC') }
belongs_to :target_user, :class_name => "JamRuby::User", :foreign_key => "target_user_id"
belongs_to :source_user, :class_name => "JamRuby::User", :foreign_key => "source_user_id"
@ -335,7 +335,7 @@ module JamRuby
@@mq_router.publish_to_user(friend_id, msg)
else
begin
UserMailer.friend_request(friend, notification_msg, friend_request_id).deliver
UserMailer.friend_request(friend, notification_msg, friend_request_id).deliver_now
rescue => e
@@log.error("Unable to send FRIEND_REQUEST email to offline user #{friend.email} #{e}")
end
@ -355,7 +355,7 @@ module JamRuby
notification_msg = format_msg(notification.description, {:user => friend})
if user.online
if user.online?
msg = @@message_factory.friend_request_accepted(
user.id,
friend.photo_url,
@ -368,7 +368,7 @@ module JamRuby
else
begin
UserMailer.friend_request_accepted(user, notification_msg).deliver
UserMailer.friend_request_accepted(user, notification_msg).deliver_now
rescue => e
@@log.error("Unable to send FRIEND_REQUEST_ACCEPTED email to offline user #{user.email} #{e}")
end
@ -386,7 +386,7 @@ module JamRuby
notification_msg = format_msg(notification.description, {:user => follower})
if follower.id != user.id
if user.online
if user.online?
msg = @@message_factory.new_user_follower(
user.id,
follower.photo_url,
@ -399,7 +399,7 @@ module JamRuby
else
begin
UserMailer.new_user_follower(user, notification_msg).deliver
UserMailer.new_user_follower(user, notification_msg).deliver_now
rescue => e
@@log.error("Unable to send NEW_USER_FOLLOWER email to offline user #{user.email} #{e}")
end
@ -466,7 +466,7 @@ module JamRuby
# this protects against sending the notification to a band member who decides to follow the band
if follower.id != bm.user.id
if bm.user.online
if bm.user.online?
msg = @@message_factory.new_band_follower(
bm.user_id,
@ -480,7 +480,7 @@ module JamRuby
else
begin
UserMailer.new_band_follower(bm.user, notification_msg).deliver
UserMailer.new_band_follower(bm.user, notification_msg).deliver_now
rescue => e
@@log.error("Unable to send NEW_BAND_FOLLOWER email to offline user #{bm.user.email} #{e}")
end
@ -500,7 +500,7 @@ module JamRuby
notification_msg = format_msg(NotificationTypes::SESSION_INVITATION, {:user => sender})
if receiver.online
if receiver.online?
msg = @@message_factory.session_invitation(
receiver.id,
session_id,
@ -513,7 +513,7 @@ module JamRuby
else
begin
UserMailer.session_invitation(receiver, notification_msg).deliver
UserMailer.session_invitation(receiver, notification_msg).deliver_now
rescue => e
@@log.error("Unable to send SESSION_INVITATION email to user #{receiver.email} #{e}")
end
@ -696,7 +696,7 @@ module JamRuby
notification.session_id = music_session.id
notification.save
if ff.online
if ff.online?
msg = @@message_factory.musician_session_join(
ff.id,
music_session.id,
@ -714,7 +714,7 @@ module JamRuby
else
# if APP_CONFIG.send_join_session_email_notifications
# begin
# UserMailer.musician_session_join(ff, notification_msg, music_session.id).deliver
# UserMailer.musician_session_join(ff, notification_msg, music_session.id).deliver_now
# rescue => e
# @@log.error("Unable to send MUSICIAN_SESSION_JOIN email to user #{ff.email} #{e}")
# end
@ -742,8 +742,6 @@ module JamRuby
#notification.message = notification_msg
notification.save
if target_user.online
msg = @@message_factory.scheduled_jamclass_invitation(
target_user.id,
@ -761,7 +759,7 @@ module JamRuby
end
begin
#UserMailer.teacher_scheduled_jamclass_invitation(music_session.lesson_session.teacher, notification_msg, music_session).deliver
#UserMailer.teacher_scheduled_jamclass_invitation(music_session.lesson_session.teacher, notification_msg, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_JAMCLASS_INVITATION email to user #{music_session.lesson_session.teacher.email} #{e}")
end
@ -801,7 +799,7 @@ module JamRuby
end
begin
#UserMailer.student_scheduled_jamclass_invitation(student, notification_msg, music_session).deliver
#UserMailer.student_scheduled_jamclass_invitation(student, notification_msg, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_JAMCLASS_INVITATION email to user #{student.email} #{e}")
end
@ -841,7 +839,7 @@ module JamRuby
end
begin
UserMailer.scheduled_session_invitation(target_user, notification_msg, music_session).deliver
UserMailer.scheduled_session_invitation(target_user, notification_msg, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_SESSION_INVITATION email to user #{target_user.email} #{e}")
end
@ -867,7 +865,8 @@ module JamRuby
notification_msg = format_msg(notification.description, {:user => source_user, :session => music_session})
if target_user.online
if target_user.online?
puts "ONLINE"
msg = @@message_factory.scheduled_session_rsvp(
target_user.id,
music_session.id,
@ -885,7 +884,7 @@ module JamRuby
end
begin
UserMailer.scheduled_session_rsvp(target_user, notification_msg, music_session).deliver
UserMailer.scheduled_session_rsvp(target_user, notification_msg, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_SESSION_RSVP email to user #{target_user.email} #{e}")
end
@ -911,7 +910,7 @@ module JamRuby
notification_msg = format_msg(notification.description, {:session => music_session})
if target_user.online
if target_user.online?
msg = @@message_factory.scheduled_session_rsvp_approved(
target_user.id,
music_session.id,
@ -926,7 +925,7 @@ module JamRuby
end
begin
UserMailer.scheduled_session_rsvp_approved(target_user, notification_msg, music_session).deliver
UserMailer.scheduled_session_rsvp_approved(target_user, notification_msg, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_SESSION_RSVP_APPROVED email to user #{target_user.email} #{e}")
end
@ -948,7 +947,7 @@ module JamRuby
notification_msg = format_msg(notification.description, {:session => music_session})
if target_user.online
if target_user.online?
msg = @@message_factory.scheduled_session_rsvp_cancelled(
target_user.id,
music_session.id,
@ -963,7 +962,7 @@ module JamRuby
end
begin
UserMailer.scheduled_session_rsvp_cancelled(target_user, notification_msg, music_session).deliver
UserMailer.scheduled_session_rsvp_cancelled(target_user, notification_msg, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_SESSION_RSVP_CANCELLED email to user #{target_user.email} #{e}")
end
@ -985,7 +984,7 @@ module JamRuby
notification_msg = format_msg(notification.description, {:session => music_session})
if target_user.online
if target_user.online?
msg = @@message_factory.scheduled_session_rsvp_cancelled_org(
target_user.id,
music_session.id,
@ -1000,7 +999,7 @@ module JamRuby
end
begin
UserMailer.scheduled_session_rsvp_cancelled_org(target_user, notification_msg, music_session).deliver
UserMailer.scheduled_session_rsvp_cancelled_org(target_user, notification_msg, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_SESSION_RSVP_CANCELLED_ORG email to user #{target_user.email} #{e}")
end
@ -1028,7 +1027,7 @@ module JamRuby
notification_msg = format_msg(notification.description, {:session => music_session})
if target_user.online
if target_user.online?
msg = @@message_factory.scheduled_session_cancelled(
target_user.id,
music_session.id,
@ -1043,7 +1042,7 @@ module JamRuby
end
begin
UserMailer.scheduled_session_cancelled(target_user, notification_msg, music_session).deliver
UserMailer.scheduled_session_cancelled(target_user, notification_msg, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_SESSION_CANCELLED email to user #{target_user.email} #{e}")
end
@ -1073,7 +1072,7 @@ module JamRuby
notification_msg = format_msg(notification.description, {:session => music_session})
if target_user.online
if target_user.online?
msg = @@message_factory.scheduled_session_rescheduled(
target_user.id,
music_session.id,
@ -1088,7 +1087,7 @@ module JamRuby
end
begin
UserMailer.scheduled_session_rescheduled(target_user, notification_msg, music_session).deliver
UserMailer.scheduled_session_rescheduled(target_user, notification_msg, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_SESSION_RESCHEDULED email to offline user #{target_user.email} #{e}")
end
@ -1117,7 +1116,7 @@ module JamRuby
def send_session_reminder_day(music_session)
send_session_reminder(music_session, NotificationTypes::SCHEDULED_SESSION_REMINDER_DAY) do |music_session, target_user, notification|
begin
UserMailer.scheduled_session_reminder_day(target_user, music_session).deliver
UserMailer.scheduled_session_reminder_day(target_user, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_SESSION_REMINDER_DAY email to user #{target_user.email} #{e}")
end
@ -1127,7 +1126,7 @@ module JamRuby
def send_session_reminder_upcoming(music_session)
send_session_reminder(music_session, NotificationTypes::SCHEDULED_SESSION_REMINDER_UPCOMING) do |music_session, target_user, notification|
begin
UserMailer.scheduled_session_reminder_upcoming(target_user, music_session).deliver
UserMailer.scheduled_session_reminder_upcoming(target_user, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_SESSION_REMINDER_UPCOMING email to user #{target_user.email} #{e}")
end
@ -1136,7 +1135,7 @@ module JamRuby
def send_session_reminder_imminent(music_session)
send_session_reminder(music_session, NotificationTypes::SCHEDULED_SESSION_REMINDER_IMMINENT) do |music_session, target_user, notification|
if target_user.online
if target_user.online?
msg = @@message_factory.scheduled_session_reminder(
target_user.id,
music_session.id,
@ -1196,7 +1195,7 @@ module JamRuby
notification_msg = format_msg(notification.description, {:session => music_session})
if target_user.online
if target_user.online?
msg = @@message_factory.scheduled_session_comment(
target_user.id,
music_session.id,
@ -1213,7 +1212,7 @@ module JamRuby
end
begin
UserMailer.scheduled_session_comment(target_user, source_user, notification_msg, comment, music_session).deliver
UserMailer.scheduled_session_comment(target_user, source_user, notification_msg, comment, music_session).deliver_now
rescue => e
@@log.error("Unable to send SCHEDULED_SESSION_COMMENT email to user #{target_user.email} #{e}")
end
@ -1241,7 +1240,7 @@ module JamRuby
notification.session_id = music_session.id
notification.save
if follower.online
if follower.online?
msg = @@message_factory.band_session_join(
follower.id,
music_session.id,
@ -1258,7 +1257,7 @@ module JamRuby
else
if music_session.fan_access && APP_CONFIG.send_join_session_email_notifications
begin
UserMailer.band_session_join(follower, notification_msg, music_session.id).deliver
UserMailer.band_session_join(follower, notification_msg, music_session.id).deliver_now
rescue => e
@@log.error("Unable to send BAND_SESSION_JOIN email to user #{follower.email} #{e}")
end
@ -1290,7 +1289,7 @@ module JamRuby
notification.recording_id = recording.id
notification.save
if ff.online
if ff.online?
msg = @@message_factory.musician_recording_saved(
ff.id,
recording.id,
@ -1303,7 +1302,7 @@ module JamRuby
@@mq_router.publish_to_user(ff.id, notification_msg)
else
begin
UserMailer.musician_recording_saved(ff, notification_msg).deliver
UserMailer.musician_recording_saved(ff, notification_msg).deliver_now
rescue => e
@@log.error("Unable to send MUSICIAN_RECORDING_SAVED email to user #{ff.email} #{e}")
end
@ -1325,7 +1324,7 @@ module JamRuby
notification.recording_id = recording.id
notification.save
if follower.online
if follower.online?
msg = @@message_factory.band_recording_saved(
follower.id,
recording.id,
@ -1338,7 +1337,7 @@ module JamRuby
@@mq_router.publish_to_user(follower.id, notification_msg)
else
begin
UserMailer.band_recording_saved(follower, notification_msg).deliver
UserMailer.band_recording_saved(follower, notification_msg).deliver_now
rescue => e
@@log.error("Unable to send BAND_RECORDING_SAVED email to user #{follower.email} #{e}")
end
@ -1528,7 +1527,7 @@ module JamRuby
notification.source_user_id = sender.id
notification.target_user_id = receiver.id if receiver
if notification.save
if receiver.online
if receiver.online?
clip_at = 200
msg_is_clipped = message.length > clip_at
truncated_msg = message[0..clip_at - 1]
@ -1546,7 +1545,7 @@ module JamRuby
else
begin
UserMailer.text_message(receiver, sender.id, sender.name, sender.resolved_photo_url, message).deliver
UserMailer.text_message(receiver, sender.id, sender.name, sender.resolved_photo_url, message).deliver_now
rescue => e
@@log.error("Unable to send TEXT_MESSAGE email to user #{receiver.email} #{e}")
end
@ -1568,7 +1567,7 @@ module JamRuby
notification_msg = format_msg(notification.description, {:band => band})
if receiver.online
if receiver.online?
msg = @@message_factory.band_invitation(
receiver.id,
band_invitation.id,
@ -1583,7 +1582,7 @@ module JamRuby
else
begin
UserMailer.band_invitation(receiver, notification_msg).deliver
UserMailer.band_invitation(receiver, notification_msg).deliver_now
rescue => e
@@log.error("Unable to send BAND_INVITATION email to offline user #{receiver.email} #{e}")
end
@ -1601,7 +1600,7 @@ module JamRuby
notification_msg = format_msg(notification.description, {:user => sender, :band => band})
if receiver.online
if receiver.online?
msg = @@message_factory.band_invitation_accepted(
receiver.id,
band_invitation.id,
@ -1614,7 +1613,7 @@ module JamRuby
else
begin
UserMailer.band_invitation_accepted(receiver, notification_msg).deliver
UserMailer.band_invitation_accepted(receiver, notification_msg).deliver_now
rescue => e
@@log.error("Unable to send BAND_INVITATION_ACCEPTED email to offline user #{receiver.email} #{e}")
end

View File

@ -1,7 +1,7 @@
class JamRuby::Promotional < ActiveRecord::Base
self.table_name = :promotionals
default_scope :order => 'aasm_state ASC, position ASC, updated_at DESC'
default_scope { order('aasm_state ASC, position ASC, updated_at DESC') }
attr_accessible :position, :aasm_state

View File

@ -124,7 +124,7 @@ module JamRuby
def increment_part_failures(part_failure_before_error)
self.part_failures = part_failure_before_error + 1
QuickMix.update_all("part_failures = #{self.part_failures}", "id = '#{self.id}'")
QuickMix.update_all({"part_failures" => self.part_failures, "id" => self.id})
end
def self.create(recording, user)

View File

@ -162,7 +162,7 @@ module JamRuby
def increment_part_failures(part_failure_before_error)
self.part_failures = part_failure_before_error + 1
RecordedBackingTrack.update_all("part_failures = #{self.part_failures}", "id = '#{self.id}'")
RecordedBackingTrack.update_all({"part_failures" => self.part_failures, "id" => self.id })
end
def stored_filename

View File

@ -10,7 +10,7 @@ module JamRuby
# this is so I can easily determine when to render a new user cell in the UI when
# rendering tracks (namely on recording/session hover bubbles and landing pages)
default_scope order('user_id ASC')
default_scope { order('user_id ASC') }
attr_accessor :marking_complete
attr_writer :is_skip_mount_uploader
@ -224,7 +224,7 @@ module JamRuby
def increment_part_failures(part_failure_before_error)
self.part_failures = part_failure_before_error + 1
RecordedTrack.update_all("part_failures = #{self.part_failures}", "id = '#{self.id}'")
RecordedTrack.update_all({"part_failures" => self.part_failures, "id" => self.id})
end
def filename

View File

@ -6,6 +6,7 @@ module JamRuby
def before_validation(recorded_track)
# if we see that a part was just uploaded entirely, validate that we can find the part that was just uploaded
if recorded_track.is_part_uploading_was && !recorded_track.is_part_uploading
begin

View File

@ -187,14 +187,14 @@ module JamRuby
end
def recorded_tracks_for_user(user)
unless self.users.exists?(user)
unless self.users.exists?(user.id)
raise JamPermissionError, "user was not in this session"
end
recorded_tracks.where(:user_id => user.id)
end
def recorded_backing_tracks_for_user(user)
unless self.users.exists?(user)
unless self.users.exists?(user.id)
raise JamPermissionError, "user was not in this session"
end
recorded_backing_tracks.where(:user_id => user.id)
@ -204,7 +204,7 @@ module JamRuby
def has_access?(user)
return false if user.nil?
users.exists?(user) || attached_with_lesson(user) #|| plays.where("player_id=?", user).count != 0
users.exists?(user.id) || attached_with_lesson(user) #|| plays.where("player_id=?", user).count != 0
end
def attached_with_lesson(user)
@ -316,7 +316,7 @@ module JamRuby
# Called when a user wants to "claim" a recording. To do this, the user must have been one of the tracks in the recording.
def claim(user, name, description, genre, is_public, upload_to_youtube=false)
upload_to_youtube = !!upload_to_youtube # Correct where nil is borking save
if !self.users.exists?(user)
if !self.users.exists?(user.id)
raise JamPermissionError, "user was not in this session"
end
@ -483,7 +483,7 @@ module JamRuby
:fully_uploaded,
:upload_failures,
:client_track_id,
Arel::Nodes::As.new('track', Arel.sql('item_type'))
Arel::Nodes::As.new(Arel::Nodes.build_quoted('track'), Arel.sql('item_type'))
]).reorder("")
# Select fields for video. Note that it must include
@ -497,7 +497,7 @@ module JamRuby
:fully_uploaded,
:upload_failures,
:client_video_source_id,
Arel::Nodes::As.new('video', Arel.sql('item_type'))
Arel::Nodes::As.new(Arel::Nodes.build_quoted('video'), Arel.sql('item_type'))
]).reorder("")
# Select fields for quick mix. Note that it must include
@ -510,8 +510,8 @@ module JamRuby
:ogg_url,
:fully_uploaded,
:upload_failures,
Arel::Nodes::As.new('', Arel.sql('quick_mix_track_id')),
Arel::Nodes::As.new('stream_mix', Arel.sql('item_type'))
Arel::Nodes::As.new(Arel::Nodes.build_quoted(''), Arel.sql('quick_mix_track_id')),
Arel::Nodes::As.new(Arel::Nodes.build_quoted('stream_mix'), Arel.sql('item_type'))
]).reorder("")
# Select fields for quick mix. Note that it must include
@ -525,7 +525,7 @@ module JamRuby
:fully_uploaded,
:upload_failures,
:client_track_id,
Arel::Nodes::As.new('backing_track', Arel.sql('item_type'))
Arel::Nodes::As.new(Arel::Nodes.build_quoted('backing_track'), Arel.sql('item_type'))
]).reorder("")
# Glue them together:
@ -759,11 +759,11 @@ module JamRuby
tracks = timeline["tracks"]
raise JamArgumentError, "tracks must be specified" unless tracks
Recording.where(id: self.id).update_all(timeline: global.to_json)
Recording.where(id: self.id).update_all(timeline: global)
jam_tracks = tracks.select {|track| track["type"] == "jam_track"}
jam_tracks.each do |client_jam_track|
RecordedJamTrackTrack.where(recording_id: id, jam_track_track_id: client_jam_track["id"]).update_all(timeline: client_jam_track["timeline"].to_json)
RecordedJamTrackTrack.where(recording_id: id, jam_track_track_id: client_jam_track["id"]).update_all(timeline: client_jam_track["timeline"])
end
end
@ -773,7 +773,7 @@ module JamRuby
private
def self.validate_user_is_band_member(user, band)
unless band.users.exists? user
unless band.users.exists? user.id
raise JamPermissionError, ValidationMessages::USER_NOT_BAND_MEMBER_VALIDATION_ERROR
end
end

View File

@ -7,7 +7,7 @@ module JamRuby
self.primary_key = 'id'
default_scope order('created_at DESC')
default_scope { order('created_at DESC') }
belongs_to :recording, :class_name => "JamRuby::Recording", :foreign_key => "recording_id"
belongs_to :user, :class_name => "JamRuby::User", :foreign_key => "creator_id"

View File

@ -99,13 +99,13 @@ module JamRuby
AdminMailer.recurly_alerts(transaction.user, {
subject: "ACTION REQUIRED: #{transaction.user.email} has refund on invoice",
body: "You will have to manually revoke any JamTrackRights in our database for the appropriate JamTracks"
}).deliver
}).deliver_now
else
AdminMailer.recurly_alerts(transaction.user, {
subject: "ACTION REQUIRED: #{transaction.user.email} has refund with no correlator to sales",
body: "You will have to manually revoke any JamTrackRights in our database for the appropriate JamTracks"
}).deliver
}).deliver_now
end

View File

@ -43,7 +43,7 @@ module JamRuby
csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false})
csv.each do |row|
vals = vals+sep+"(#{ActiveRecord::Base.quote_value(row[0])}, #{ActiveRecord::Base.quote_value(row[1])}, #{ActiveRecord::Base.quote_value(row[2])})"
vals = vals+sep+"(#{ActiveRecord::Base.quote_value(row[0], nil)}, #{ActiveRecord::Base.quote_value(row[1], nil)}, #{ActiveRecord::Base.quote_value(row[2], nil)})"
sep = ','
i += 1

View File

@ -9,7 +9,6 @@ module JamRuby
belongs_to :deleted_by_user, foreign_key: 'deleted_by_user_id', class_name: "JamRuby::User"
scope :available, -> { where("deleted_at iS NULL") }
scope :all, -> { select("*") }
validates :description, length: {maximum: 16000}, no_profanity: true, :allow_blank => true
validates :rating, presence: true, numericality: {only_integer: true, minimum: 1, maximum: 5}

View File

@ -7,7 +7,7 @@ module JamRuby
belongs_to :rsvp_request
belongs_to :rsvp_slot
validates :rsvp_request, presence: true
#validates :rsvp_request, presence: true
validates :rsvp_slot, presence: true
validates :chosen, :inclusion => {:in => [nil, true, false]}
end

Some files were not shown because too many files have changed in this diff Show More