Merge branch 'develop' into feature/backing_tracks

This commit is contained in:
Steven Miers 2015-01-26 12:11:57 -06:00
commit 6f8113b374
9 changed files with 37 additions and 18 deletions

View File

@ -427,6 +427,7 @@ module JamRuby
# returns one user history per user, with instruments all crammed together, and with total duration
def unique_user_histories
# only get the active users if the session is in progress
user_filter = "music_sessions_user_history.session_removed_at is null" if self.session_removed_at.nil?
MusicSessionUserHistory

View File

@ -42,7 +42,7 @@ module JamRuby
# used for persisted notifications
def formatted_msg
# target_user, band, session, recording, invitation, join_request = nil
source_user, band = nil
source_user, band, session = nil
unless self.source_user_id.nil?
source_user = User.find(self.source_user_id)
@ -53,7 +53,12 @@ module JamRuby
end
unless self.session_id.nil?
session = MusicSession.find(self.session_id)
session = MusicSession.find_by_id(self.session_id)
# remove all notifications related to this session if it's not found
if session.nil?
Notification.delete_all "(session_id = '#{session_id}')"
end
end
self.class.format_msg(self.description, {:user => source_user, :band => band, :session => session})

View File

@ -1,12 +1,12 @@
module JamRuby
class CleanupFacebookSignup
extend Resque::Plugins::JamLonelyJob
@queue = :scheduled_cleanup_facebook_signup
@@log = Logging.logger[CleanupFacebookSignup]
def self.perform
@@log.debug("waking up")

View File

@ -535,8 +535,10 @@
var $box = $(box)
$mountState = $box.find('.listen-broadcast-state')
updateMountInfo(mountInfo)
updateMountDetails(mountInfo);
if(mountInfo) {
updateMountInfo(mountInfo)
updateMountDetails(mountInfo);
}
}
function updateMountInfo(mount) {

View File

@ -207,19 +207,24 @@
isLoading = true;
// retrieve pending notifications for this user
rest.getNotifications(buildParams())
.done(function(response) {
updateNotificationList(response);
isLoading = false;
})
.fail(function() {
isLoading = false;
app.ajaxError();
})
.done(function(response) {
updateNotificationList(response);
isLoading = false;
})
.fail(function() {
isLoading = false;
app.ajaxError();
})
}
function updateNotificationList(response) {
$.each(response, function(index, val) {
// this means the session no longer exists
if (response.fan_access == null && response.musician_access == null) {
return;
}
if(val.description == context.JK.MessageType.TEXT_MESSAGE) {
val.formatted_msg = textMessageDialog.formatTextMessage(val.message.substring(0, 200), val.source_user_id, val.source_user.name, val.message.length > 200).html();
}

View File

@ -72,5 +72,6 @@ Server.new.run(:port => config["port"] + (jam_instance-1 ) * 2,
:influxdb_password => config['influxdb_password'],
:influxdb_hosts => config['influxdb_hosts'],
:influxdb_port => config['influxdb_port'],
:allow_dynamic_registration => config['allow_dynamic_registration'],
:cidr => config['cidr'],
:gateway_name => gateway_name)

View File

@ -10,6 +10,7 @@ Defaults: &defaults
influxdb_password: "root"
influxdb_hosts: ["localhost"]
influxdb_port: 8086
allow_dynamic_registration: true
development:
port: 6767

View File

@ -61,7 +61,7 @@ module JamWebsockets
@disconnected_count = 0
end
def start(connect_time_stale_client, connect_time_expire_client, connect_time_stale_browser, connect_time_expire_browser, options={:host => "localhost", :port => 5672, :max_connections_per_user => 10, :gateway => 'default'}, &block)
def start(connect_time_stale_client, connect_time_expire_client, connect_time_stale_browser, connect_time_expire_browser, options={:host => "localhost", :port => 5672, :max_connections_per_user => 10, :gateway => 'default', :allow_dynamic_registration => true}, &block)
@log.info "startup"
@ -73,6 +73,7 @@ module JamWebsockets
@connect_time_expire_browser = connect_time_expire_browser
@max_connections_per_user = options[:max_connections_per_user]
@gateway_name = options[:gateway]
@allow_dynamic_registration = options[:allow_dynamic_registration]
begin
@amqp_connection_manager = AmqpConnectionManager.new(true, 4, :host => options[:host], :port => options[:port])
@ -327,7 +328,9 @@ module JamWebsockets
if clients.length == 0
# if there are no more clients listening, then unsubscribe to the topic for this mount_id
@subscription_topic.unbind(@subscriptions_exchange, :routing_key => "subscription.#{type}.#{id}")
routing_key = "subscription.#{type}.#{id}"
@log.debug("unregister dynamic topic #{routing_key}")
@subscription_topic.unbind(@subscriptions_exchange, :routing_key => routing_key)
end
end
@ -808,7 +811,7 @@ module JamWebsockets
id = subscribe.id
type = subscribe.type
if id && id.length > 0 && type && type.length > 0
#register_subscription(client, type, id)
register_subscription(client, type, id) if @allow_dynamic_registration
else
@log.error("handle_subscribe: empty data #{subscribe}")
end
@ -818,7 +821,7 @@ module JamWebsockets
id = unsubscribe.id
type = unsubscribe.type
if id && id.length > 0 && type && type.length > 0
#unregister_subscription(client, type, id)
unregister_subscription(client, type, id) if @allow_dynamic_registration
else
@log.error("handle_subscribe: empty data #{unsubscribe}")
end

View File

@ -24,6 +24,7 @@ module JamWebsockets
gateway_name = options[:gateway_name]
rabbitmq_host = options[:rabbitmq_host]
rabbitmq_port = options[:rabbitmq_port].to_i
allow_dynamic_registration = options[:allow_dynamic_registration].nil? ? true : options[:allow_dynamic_registration]
Stats::init(options)
@ -39,7 +40,7 @@ module JamWebsockets
}
EventMachine.run do
@router.start(connect_time_stale_client, connect_time_expire_client, connect_time_stale_browser, connect_time_expire_browser, host: rabbitmq_host, port: rabbitmq_port, max_connections_per_user: max_connections_per_user, gateway: gateway_name) do
@router.start(connect_time_stale_client, connect_time_expire_client, connect_time_stale_browser, connect_time_expire_browser, host: rabbitmq_host, port: rabbitmq_port, max_connections_per_user: max_connections_per_user, gateway: gateway_name, allow_dynamic_registration: allow_dynamic_registration) do
start_connection_expiration
start_client_expiration
start_connection_flagger