* merged
This commit is contained in:
commit
adb37e06a6
|
|
@ -0,0 +1,13 @@
|
|||
AB,Alberta
|
||||
BC,British Columbia
|
||||
MB,Manitoba
|
||||
NB,New Brunswick
|
||||
NL,Newfoundland and Labrador
|
||||
NS,Nova Scotia
|
||||
NT,Northwest Territories
|
||||
NU,Nunavut
|
||||
ON,Ontario
|
||||
PE,Prince Edward Island
|
||||
QC,Quebec
|
||||
SK,Saskatchewan
|
||||
YT,Yukon
|
||||
|
|
|
@ -0,0 +1,254 @@
|
|||
A1,"Anonymous Proxy"
|
||||
A2,"Satellite Provider"
|
||||
O1,"Other Country"
|
||||
AD,"Andorra"
|
||||
AE,"United Arab Emirates"
|
||||
AF,"Afghanistan"
|
||||
AG,"Antigua and Barbuda"
|
||||
AI,"Anguilla"
|
||||
AL,"Albania"
|
||||
AM,"Armenia"
|
||||
AO,"Angola"
|
||||
AP,"Asia/Pacific Region"
|
||||
AQ,"Antarctica"
|
||||
AR,"Argentina"
|
||||
AS,"American Samoa"
|
||||
AT,"Austria"
|
||||
AU,"Australia"
|
||||
AW,"Aruba"
|
||||
AX,"Aland Islands"
|
||||
AZ,"Azerbaijan"
|
||||
BA,"Bosnia and Herzegovina"
|
||||
BB,"Barbados"
|
||||
BD,"Bangladesh"
|
||||
BE,"Belgium"
|
||||
BF,"Burkina Faso"
|
||||
BG,"Bulgaria"
|
||||
BH,"Bahrain"
|
||||
BI,"Burundi"
|
||||
BJ,"Benin"
|
||||
BL,"Saint Bartelemey"
|
||||
BM,"Bermuda"
|
||||
BN,"Brunei Darussalam"
|
||||
BO,"Bolivia"
|
||||
BQ,"Bonaire, Saint Eustatius and Saba"
|
||||
BR,"Brazil"
|
||||
BS,"Bahamas"
|
||||
BT,"Bhutan"
|
||||
BV,"Bouvet Island"
|
||||
BW,"Botswana"
|
||||
BY,"Belarus"
|
||||
BZ,"Belize"
|
||||
CA,"Canada"
|
||||
CC,"Cocos (Keeling) Islands"
|
||||
CD,"Congo, The Democratic Republic of the"
|
||||
CF,"Central African Republic"
|
||||
CG,"Congo"
|
||||
CH,"Switzerland"
|
||||
CI,"Cote d'Ivoire"
|
||||
CK,"Cook Islands"
|
||||
CL,"Chile"
|
||||
CM,"Cameroon"
|
||||
CN,"China"
|
||||
CO,"Colombia"
|
||||
CR,"Costa Rica"
|
||||
CU,"Cuba"
|
||||
CV,"Cape Verde"
|
||||
CW,"Curacao"
|
||||
CX,"Christmas Island"
|
||||
CY,"Cyprus"
|
||||
CZ,"Czech Republic"
|
||||
DE,"Germany"
|
||||
DJ,"Djibouti"
|
||||
DK,"Denmark"
|
||||
DM,"Dominica"
|
||||
DO,"Dominican Republic"
|
||||
DZ,"Algeria"
|
||||
EC,"Ecuador"
|
||||
EE,"Estonia"
|
||||
EG,"Egypt"
|
||||
EH,"Western Sahara"
|
||||
ER,"Eritrea"
|
||||
ES,"Spain"
|
||||
ET,"Ethiopia"
|
||||
EU,"Europe"
|
||||
FI,"Finland"
|
||||
FJ,"Fiji"
|
||||
FK,"Falkland Islands (Malvinas)"
|
||||
FM,"Micronesia, Federated States of"
|
||||
FO,"Faroe Islands"
|
||||
FR,"France"
|
||||
GA,"Gabon"
|
||||
GB,"United Kingdom"
|
||||
GD,"Grenada"
|
||||
GE,"Georgia"
|
||||
GF,"French Guiana"
|
||||
GG,"Guernsey"
|
||||
GH,"Ghana"
|
||||
GI,"Gibraltar"
|
||||
GL,"Greenland"
|
||||
GM,"Gambia"
|
||||
GN,"Guinea"
|
||||
GP,"Guadeloupe"
|
||||
GQ,"Equatorial Guinea"
|
||||
GR,"Greece"
|
||||
GS,"South Georgia and the South Sandwich Islands"
|
||||
GT,"Guatemala"
|
||||
GU,"Guam"
|
||||
GW,"Guinea-Bissau"
|
||||
GY,"Guyana"
|
||||
HK,"Hong Kong"
|
||||
HM,"Heard Island and McDonald Islands"
|
||||
HN,"Honduras"
|
||||
HR,"Croatia"
|
||||
HT,"Haiti"
|
||||
HU,"Hungary"
|
||||
ID,"Indonesia"
|
||||
IE,"Ireland"
|
||||
IL,"Israel"
|
||||
IM,"Isle of Man"
|
||||
IN,"India"
|
||||
IO,"British Indian Ocean Territory"
|
||||
IQ,"Iraq"
|
||||
IR,"Iran, Islamic Republic of"
|
||||
IS,"Iceland"
|
||||
IT,"Italy"
|
||||
JE,"Jersey"
|
||||
JM,"Jamaica"
|
||||
JO,"Jordan"
|
||||
JP,"Japan"
|
||||
KE,"Kenya"
|
||||
KG,"Kyrgyzstan"
|
||||
KH,"Cambodia"
|
||||
KI,"Kiribati"
|
||||
KM,"Comoros"
|
||||
KN,"Saint Kitts and Nevis"
|
||||
KP,"Korea, Democratic People's Republic of"
|
||||
KR,"Korea, Republic of"
|
||||
KW,"Kuwait"
|
||||
KY,"Cayman Islands"
|
||||
KZ,"Kazakhstan"
|
||||
LA,"Lao People's Democratic Republic"
|
||||
LB,"Lebanon"
|
||||
LC,"Saint Lucia"
|
||||
LI,"Liechtenstein"
|
||||
LK,"Sri Lanka"
|
||||
LR,"Liberia"
|
||||
LS,"Lesotho"
|
||||
LT,"Lithuania"
|
||||
LU,"Luxembourg"
|
||||
LV,"Latvia"
|
||||
LY,"Libyan Arab Jamahiriya"
|
||||
MA,"Morocco"
|
||||
MC,"Monaco"
|
||||
MD,"Moldova, Republic of"
|
||||
ME,"Montenegro"
|
||||
MF,"Saint Martin"
|
||||
MG,"Madagascar"
|
||||
MH,"Marshall Islands"
|
||||
MK,"Macedonia"
|
||||
ML,"Mali"
|
||||
MM,"Myanmar"
|
||||
MN,"Mongolia"
|
||||
MO,"Macao"
|
||||
MP,"Northern Mariana Islands"
|
||||
MQ,"Martinique"
|
||||
MR,"Mauritania"
|
||||
MS,"Montserrat"
|
||||
MT,"Malta"
|
||||
MU,"Mauritius"
|
||||
MV,"Maldives"
|
||||
MW,"Malawi"
|
||||
MX,"Mexico"
|
||||
MY,"Malaysia"
|
||||
MZ,"Mozambique"
|
||||
NA,"Namibia"
|
||||
NC,"New Caledonia"
|
||||
NE,"Niger"
|
||||
NF,"Norfolk Island"
|
||||
NG,"Nigeria"
|
||||
NI,"Nicaragua"
|
||||
NL,"Netherlands"
|
||||
NO,"Norway"
|
||||
NP,"Nepal"
|
||||
NR,"Nauru"
|
||||
NU,"Niue"
|
||||
NZ,"New Zealand"
|
||||
OM,"Oman"
|
||||
PA,"Panama"
|
||||
PE,"Peru"
|
||||
PF,"French Polynesia"
|
||||
PG,"Papua New Guinea"
|
||||
PH,"Philippines"
|
||||
PK,"Pakistan"
|
||||
PL,"Poland"
|
||||
PM,"Saint Pierre and Miquelon"
|
||||
PN,"Pitcairn"
|
||||
PR,"Puerto Rico"
|
||||
PS,"Palestinian Territory"
|
||||
PT,"Portugal"
|
||||
PW,"Palau"
|
||||
PY,"Paraguay"
|
||||
QA,"Qatar"
|
||||
RE,"Reunion"
|
||||
RO,"Romania"
|
||||
RS,"Serbia"
|
||||
RU,"Russian Federation"
|
||||
RW,"Rwanda"
|
||||
SA,"Saudi Arabia"
|
||||
SB,"Solomon Islands"
|
||||
SC,"Seychelles"
|
||||
SD,"Sudan"
|
||||
SE,"Sweden"
|
||||
SG,"Singapore"
|
||||
SH,"Saint Helena"
|
||||
SI,"Slovenia"
|
||||
SJ,"Svalbard and Jan Mayen"
|
||||
SK,"Slovakia"
|
||||
SL,"Sierra Leone"
|
||||
SM,"San Marino"
|
||||
SN,"Senegal"
|
||||
SO,"Somalia"
|
||||
SR,"Suriname"
|
||||
SS,"South Sudan"
|
||||
ST,"Sao Tome and Principe"
|
||||
SV,"El Salvador"
|
||||
SX,"Sint Maarten"
|
||||
SY,"Syrian Arab Republic"
|
||||
SZ,"Swaziland"
|
||||
TC,"Turks and Caicos Islands"
|
||||
TD,"Chad"
|
||||
TF,"French Southern Territories"
|
||||
TG,"Togo"
|
||||
TH,"Thailand"
|
||||
TJ,"Tajikistan"
|
||||
TK,"Tokelau"
|
||||
TL,"Timor-Leste"
|
||||
TM,"Turkmenistan"
|
||||
TN,"Tunisia"
|
||||
TO,"Tonga"
|
||||
TR,"Turkey"
|
||||
TT,"Trinidad and Tobago"
|
||||
TV,"Tuvalu"
|
||||
TW,"Taiwan"
|
||||
TZ,"Tanzania, United Republic of"
|
||||
UA,"Ukraine"
|
||||
UG,"Uganda"
|
||||
UM,"United States Minor Outlying Islands"
|
||||
US,"United States"
|
||||
UY,"Uruguay"
|
||||
UZ,"Uzbekistan"
|
||||
VA,"Holy See (Vatican City State)"
|
||||
VC,"Saint Vincent and the Grenadines"
|
||||
VE,"Venezuela"
|
||||
VG,"Virgin Islands, British"
|
||||
VI,"Virgin Islands, U.S."
|
||||
VN,"Vietnam"
|
||||
VU,"Vanuatu"
|
||||
WF,"Wallis and Futuna"
|
||||
WS,"Samoa"
|
||||
YE,"Yemen"
|
||||
YT,"Mayotte"
|
||||
ZA,"South Africa"
|
||||
ZM,"Zambia"
|
||||
ZW,"Zimbabwe"
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
AA,Armed Forces America
|
||||
AE,Armed Forces
|
||||
AP,Armed Forces Pacific
|
||||
AK,Alaska
|
||||
AL,Alabama
|
||||
AR,Arkansas
|
||||
AZ,Arizona
|
||||
CA,California
|
||||
CO,Colorado
|
||||
CT,Connecticut
|
||||
DC,District of Columbia
|
||||
DE,Delaware
|
||||
FL,Florida
|
||||
GA,Georgia
|
||||
GU,Guam
|
||||
HI,Hawaii
|
||||
IA,Iowa
|
||||
ID,Idaho
|
||||
IL,Illinois
|
||||
IN,Indiana
|
||||
KS,Kansas
|
||||
KY,Kentucky
|
||||
LA,Louisiana
|
||||
MA,Massachusetts
|
||||
MD,Maryland
|
||||
ME,Maine
|
||||
MI,Michigan
|
||||
MN,Minnesota
|
||||
MO,Missouri
|
||||
MS,Mississippi
|
||||
MT,Montana
|
||||
NC,North Carolina
|
||||
ND,North Dakota
|
||||
NE,Nebraska
|
||||
NH,New Hampshire
|
||||
NJ,New Jersey
|
||||
NM,New Mexico
|
||||
NV,Nevada
|
||||
NY,New York
|
||||
OH,Ohio
|
||||
OK,Oklahoma
|
||||
OR,Oregon
|
||||
PA,Pennsylvania
|
||||
PR,Puerto Rico
|
||||
RI,Rhode Island
|
||||
SC,South Carolina
|
||||
SD,South Dakota
|
||||
TN,Tennessee
|
||||
TX,Texas
|
||||
UT,Utah
|
||||
VA,Virginia
|
||||
VI,Virgin Islands
|
||||
VT,Vermont
|
||||
WA,Washington
|
||||
WI,Wisconsin
|
||||
WV,West Virginia
|
||||
WY,Wyoming
|
||||
|
|
|
@ -307,9 +307,12 @@ message TracksChanged {
|
|||
message MusicianSessionJoin {
|
||||
optional string session_id = 1;
|
||||
optional string photo_url = 2;
|
||||
optional string msg = 3;
|
||||
optional string notification_id = 4;
|
||||
optional string created_at = 5;
|
||||
optional bool fan_access = 3;
|
||||
optional bool musician_access = 4;
|
||||
optional bool approval_required = 5;
|
||||
optional string msg = 6;
|
||||
optional string notification_id = 7;
|
||||
optional string created_at = 8;
|
||||
}
|
||||
|
||||
message MusicianRecordingSaved {
|
||||
|
|
@ -370,9 +373,12 @@ message BandInvitationAccepted {
|
|||
message BandSessionJoin {
|
||||
optional string session_id = 1;
|
||||
optional string photo_url = 2;
|
||||
optional string msg = 3;
|
||||
optional string notification_id = 4;
|
||||
optional string created_at = 5;
|
||||
optional bool fan_access = 3;
|
||||
optional bool musician_access = 4;
|
||||
optional bool approval_required = 5;
|
||||
optional string msg = 6;
|
||||
optional string notification_id = 7;
|
||||
optional string created_at = 8;
|
||||
}
|
||||
|
||||
// route_to: client:
|
||||
|
|
|
|||
|
|
@ -413,11 +413,13 @@ module JamRuby
|
|||
)
|
||||
end
|
||||
|
||||
|
||||
def musician_session_join(receiver_id, session_id, photo_url, msg, notification_id, created_at)
|
||||
def musician_session_join(receiver_id, session_id, photo_url, fan_access, musician_access, approval_required, msg, notification_id, created_at)
|
||||
musician_session_join = Jampb::MusicianSessionJoin.new(
|
||||
:session_id => session_id,
|
||||
:photo_url => photo_url,
|
||||
:fan_access => fan_access,
|
||||
:musician_access => musician_access,
|
||||
:approval_required => approval_required,
|
||||
:msg => msg,
|
||||
:notification_id => notification_id,
|
||||
:created_at => created_at
|
||||
|
|
@ -430,10 +432,13 @@ module JamRuby
|
|||
)
|
||||
end
|
||||
|
||||
def band_session_join(receiver_id, session_id, photo_url, msg, notification_id, created_at)
|
||||
def band_session_join(receiver_id, session_id, photo_url, fan_access, musician_access, approval_required, msg, notification_id, created_at)
|
||||
band_session_join = Jampb::BandSessionJoin.new(
|
||||
:session_id => session_id,
|
||||
:photo_url => photo_url,
|
||||
:fan_access => fan_access,
|
||||
:musician_access => musician_access,
|
||||
:approval_required => approval_required,
|
||||
:msg => msg,
|
||||
:notification_id => notification_id,
|
||||
:created_at => created_at
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ module JamRuby
|
|||
Notification.where(:target_user_id => user_id).limit(50)
|
||||
end
|
||||
|
||||
def created_date
|
||||
self.created_at.getutc.iso8601.to_s
|
||||
end
|
||||
|
||||
def photo_url
|
||||
unless self.source_user.nil?
|
||||
self.source_user.photo_url
|
||||
|
|
@ -224,7 +228,7 @@ module JamRuby
|
|||
user.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(friend_id, msg)
|
||||
|
|
@ -252,7 +256,7 @@ module JamRuby
|
|||
friend.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(user.id, msg)
|
||||
|
|
@ -279,7 +283,7 @@ module JamRuby
|
|||
follower.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(user.id, msg)
|
||||
|
|
@ -313,7 +317,7 @@ module JamRuby
|
|||
follower.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(bm.user_id, msg)
|
||||
|
|
@ -342,7 +346,7 @@ module JamRuby
|
|||
session_id,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(receiver.id, msg)
|
||||
|
|
@ -383,7 +387,7 @@ module JamRuby
|
|||
join_request.user.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(music_session.creator.id, msg)
|
||||
|
|
@ -406,7 +410,7 @@ module JamRuby
|
|||
music_session.creator.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(join_request.user.id, msg)
|
||||
|
|
@ -429,7 +433,7 @@ module JamRuby
|
|||
music_session.creator.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(join_request.user.id, msg)
|
||||
|
|
@ -489,34 +493,35 @@ module JamRuby
|
|||
notifications, online_ff, offline_ff = [], [], []
|
||||
notification_msg = format_msg(NotificationTypes::MUSICIAN_SESSION_JOIN, user)
|
||||
|
||||
friends_and_followers.each do |ff|
|
||||
if (ff.musician && music_session.musician_access) || (!ff.musician && music_session.fan_access)
|
||||
notification = Notification.new
|
||||
notification.description = NotificationTypes::MUSICIAN_SESSION_JOIN
|
||||
notification.source_user_id = user.id
|
||||
notification.target_user_id = ff.id
|
||||
notification.session_id = music_session.id
|
||||
notification.save
|
||||
friends_and_followers.each do |ff|
|
||||
notification = Notification.new
|
||||
notification.description = NotificationTypes::MUSICIAN_SESSION_JOIN
|
||||
notification.source_user_id = user.id
|
||||
notification.target_user_id = ff.id
|
||||
notification.session_id = music_session.id
|
||||
notification.save
|
||||
|
||||
if ff.online
|
||||
msg = @@message_factory.musician_session_join(
|
||||
ff.id,
|
||||
music_session.id,
|
||||
user.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
)
|
||||
if ff.online
|
||||
msg = @@message_factory.musician_session_join(
|
||||
ff.id,
|
||||
music_session.id,
|
||||
user.photo_url,
|
||||
music_session.fan_access,
|
||||
music_session.musician_access,
|
||||
music_session.approval_required,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(ff.id, msg)
|
||||
else
|
||||
offline_ff << ff
|
||||
end
|
||||
@@mq_router.publish_to_user(ff.id, msg)
|
||||
else
|
||||
offline_ff << ff
|
||||
end
|
||||
end
|
||||
|
||||
# send email notifications
|
||||
unless offline_ff.empty?
|
||||
if !offline_ff.empty? && music_session.fan_access
|
||||
begin
|
||||
UserMailer.musician_session_join(offline_ff.map! {|f| f.email}, notification_msg, music_session.id).deliver if APP_CONFIG.send_join_session_email_notifications
|
||||
rescue => e
|
||||
|
|
@ -529,40 +534,41 @@ module JamRuby
|
|||
def send_band_session_join(music_session, band)
|
||||
|
||||
# if the session is private, don't send any notifications
|
||||
if music_session.musician_access || music_session.fan_access
|
||||
if music_session.musician_access || music_session.fan_access
|
||||
|
||||
notifications, online_followers, offline_followers = [], [], []
|
||||
notification_msg = format_msg(NotificationTypes::BAND_SESSION_JOIN, nil, band)
|
||||
|
||||
band.followers.each do |bf|
|
||||
follower = bf.user
|
||||
if (follower.musician && music_session.musician_access) || (!follower.musician && music_session.fan_access)
|
||||
notification = Notification.new
|
||||
notification.band_id = band.id
|
||||
notification.description = NotificationTypes::BAND_SESSION_JOIN
|
||||
notification.target_user_id = follower.id
|
||||
notification.session_id = music_session.id
|
||||
notification.save
|
||||
notification = Notification.new
|
||||
notification.band_id = band.id
|
||||
notification.description = NotificationTypes::BAND_SESSION_JOIN
|
||||
notification.target_user_id = follower.id
|
||||
notification.session_id = music_session.id
|
||||
notification.save
|
||||
|
||||
if follower.online
|
||||
msg = @@message_factory.band_session_join(
|
||||
follower.id,
|
||||
music_session.id,
|
||||
band.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
)
|
||||
if follower.online
|
||||
msg = @@message_factory.band_session_join(
|
||||
follower.id,
|
||||
music_session.id,
|
||||
band.photo_url,
|
||||
music_session.fan_access,
|
||||
music_session.musician_access,
|
||||
music_session.approval_required,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(follower.id, msg)
|
||||
else
|
||||
offline_followers << follower
|
||||
end
|
||||
@@mq_router.publish_to_user(follower.id, msg)
|
||||
else
|
||||
offline_followers << follower
|
||||
end
|
||||
end
|
||||
|
||||
# send email notifications
|
||||
unless offline_followers.empty?
|
||||
if !offline_ff.empty? && music_session.fan_access
|
||||
UserMailer.band_session_join(offline_followers.map! {|f| f.email}, notification_msg, music_session.id).deliver if APP_CONFIG.send_join_session_email_notifications
|
||||
end
|
||||
end
|
||||
|
|
@ -598,7 +604,7 @@ module JamRuby
|
|||
user.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(ff.id, notification_msg)
|
||||
|
|
@ -633,7 +639,7 @@ module JamRuby
|
|||
band.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(of.id, notification_msg)
|
||||
|
|
@ -696,7 +702,13 @@ module JamRuby
|
|||
|
||||
notification_msg = format_msg(notification.description, nil, recording.band)
|
||||
|
||||
msg = @@message_factory.recording_master_mix_complete(claimed_recording.user_id, recording.id, notification.band_id, notification_msg, notification.id, notification.created_at.to_s)
|
||||
msg = @@message_factory.recording_master_mix_complete(
|
||||
claimed_recording.user_id,
|
||||
recording.id,
|
||||
notification.band_id,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_date)
|
||||
|
||||
@@mq_router.publish_to_user(claimed_recording.user_id, msg)
|
||||
end
|
||||
|
|
@ -722,7 +734,7 @@ module JamRuby
|
|||
sender.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
|
||||
@@mq_router.publish_to_user(receiver.id, msg)
|
||||
|
|
@ -750,7 +762,7 @@ module JamRuby
|
|||
sender.photo_url,
|
||||
notification_msg,
|
||||
notification.id,
|
||||
notification.created_at.to_s
|
||||
notification.created_date
|
||||
)
|
||||
@@mq_router.publish_to_user(receiver.id, msg)
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@
|
|||
sessionId: val.sessionId,
|
||||
avatar_url: context.JK.resolveAvatarUrl(val.photo_url),
|
||||
text: val.formatted_msg,
|
||||
date: context.JK.formatDateTime(val.created_at)
|
||||
date: $.timeago(val.created_at)
|
||||
});
|
||||
|
||||
$('#sidebar-notification-list').append(notificationHtml);
|
||||
|
|
@ -169,7 +169,7 @@
|
|||
var $action_btn = $notification.find($btnNotificationAction);
|
||||
$action_btn.text('ACCEPT');
|
||||
$action_btn.click(function() {
|
||||
acceptFriendRequest({ "friend_request_id": payload.friend_request_id, "notification_id": payload.notification_id });
|
||||
acceptFriendRequest(payload);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +185,7 @@
|
|||
var $action_btn = $notification.find($btnNotificationAction);
|
||||
$action_btn.text('JOIN');
|
||||
$action_btn.click(function() {
|
||||
openTerms({ "session_id": payload.session_id, "notification_id": payload.notification_id });
|
||||
openTerms(payload);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -193,7 +193,7 @@
|
|||
var $action_btn = $notification.find($btnNotificationAction);
|
||||
$action_btn.text('APPROVE');
|
||||
$action_btn.click(function() {
|
||||
approveJoinRequest({ "join_request_id": payload.join_request_id, "notification_id": payload.notification_id });
|
||||
approveJoinRequest(payload);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -201,7 +201,7 @@
|
|||
var $action_btn = $notification.find($btnNotificationAction);
|
||||
$action_btn.text('JOIN');
|
||||
$action_btn.click(function() {
|
||||
openTerms({ "session_id": payload.session_id, "notification_id": payload.notification_id });
|
||||
openTerms(payload);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -210,12 +210,33 @@
|
|||
}
|
||||
|
||||
else if (type === context.JK.MessageType.MUSICIAN_SESSION_JOIN || type === context.JK.MessageType.BAND_SESSION_JOIN) {
|
||||
|
||||
var actionText = '';
|
||||
var callback;
|
||||
if (context.JK.currentUserMusician) {
|
||||
// user is MUSICIAN; musician_access = TRUE
|
||||
if (payload.musician_access) {
|
||||
actionText = "JOIN";
|
||||
callback = joinSession;
|
||||
}
|
||||
// user is MUSICIAN; fan_access = TRUE
|
||||
else if (payload.fan_access) {
|
||||
actionText = "LISTEN";
|
||||
callback = listenToSession;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// user is FAN; fan_access = TRUE
|
||||
if (payload.fan_access) {
|
||||
actionText = "LISTEN";
|
||||
callback = listenToSession;
|
||||
}
|
||||
}
|
||||
|
||||
var $action_btn = $notification.find($btnNotificationAction);
|
||||
$action_btn.text('LISTEN');
|
||||
$action_btn.attr('href', '/sessions/' + payload.session_id);
|
||||
$action_btn.attr('rel', 'external');
|
||||
$action_btn.text(actionText);
|
||||
$action_btn.click(function() {
|
||||
listenToSession({ "session_id": payload.session_id, "notification_id": payload.notification_id });
|
||||
callback(payload);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +244,7 @@
|
|||
var $action_btn = $notification.find($btnNotificationAction);
|
||||
$action_btn.text('LISTEN');
|
||||
$action_btn.click(function() {
|
||||
listenToRecording({ "recording_id": payload.recording_id, "notification_id": payload.notification_id });
|
||||
listenToRecording(payload);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -236,7 +257,7 @@
|
|||
var $action_btn = $notification.find($btnNotificationAction);
|
||||
$action_btn.text('ACCEPT');
|
||||
$action_btn.click(function() {
|
||||
acceptBandInvitation({ "band_invitation_id": payload.band_invitation_id, "band_id": payload.band_id, "notification_id": payload.notification_id });
|
||||
acceptBandInvitation(payload);
|
||||
});
|
||||
}
|
||||
else if (type === context.JK.MessageType.BAND_INVITATION_ACCEPTED) {
|
||||
|
|
@ -342,7 +363,7 @@
|
|||
sessionId: payload.session_id,
|
||||
avatar_url: context.JK.resolveAvatarUrl(payload.photo_url),
|
||||
text: sidebarText,
|
||||
date: context.JK.formatDateTime(payload.created_at)
|
||||
date: $.timeago(payload.created_at)
|
||||
});
|
||||
|
||||
$('#sidebar-notification-list').prepend(notificationHtml);
|
||||
|
|
@ -606,7 +627,6 @@
|
|||
|
||||
// remove all notifications for this session
|
||||
function deleteSessionNotifications(sessionId) {
|
||||
console.log("sessionId=%o", sessionId);
|
||||
$('li[session-id=' + sessionId + ']').hide();
|
||||
decrementNotificationCount();
|
||||
}
|
||||
|
|
@ -714,20 +734,52 @@
|
|||
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.MUSICIAN_SESSION_JOIN, function(header, payload) {
|
||||
logger.debug("Handling MUSICIAN_SESSION_JOIN msg " + JSON.stringify(payload));
|
||||
|
||||
handleNotification(payload, header.type);
|
||||
var okText = '';
|
||||
var showNotification = false;
|
||||
var callback;
|
||||
if (context.JK.currentUserMusician) {
|
||||
// user is MUSICIAN; musician_access = TRUE
|
||||
if (payload.musician_access) {
|
||||
showNotification = true;
|
||||
okText = "JOIN";
|
||||
callback = joinSession;
|
||||
}
|
||||
// user is MUSICIAN; fan_access = TRUE
|
||||
else if (payload.fan_access) {
|
||||
showNotification = true;
|
||||
okText = "LISTEN";
|
||||
callback = listenToSession;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// user is FAN; fan_access = TRUE
|
||||
if (payload.fan_access) {
|
||||
showNotification = true;
|
||||
okText = "LISTEN";
|
||||
callback = listenToSession;
|
||||
}
|
||||
}
|
||||
|
||||
app.notify({
|
||||
"title": "Musician Joined Session",
|
||||
"text": payload.msg,
|
||||
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
|
||||
}, {
|
||||
"ok_text": "LISTEN",
|
||||
"ok_callback": listenToSession,
|
||||
"ok_callback_args": {
|
||||
"session_id": payload.session_id,
|
||||
"notification_id": payload.notification_id
|
||||
if (showNotification) {
|
||||
handleNotification(payload, header.type);
|
||||
|
||||
app.notify({
|
||||
"title": "Musician Joined Session",
|
||||
"text": payload.msg,
|
||||
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
|
||||
}, {
|
||||
"ok_text": okText,
|
||||
"ok_callback": callback,
|
||||
"ok_callback_args": {
|
||||
"session_id": payload.session_id,
|
||||
"fan_access": payload.fan_access,
|
||||
"musician_access": payload.musician_access,
|
||||
"approval_required": payload.approval_required,
|
||||
"notification_id": payload.notification_id
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -735,20 +787,52 @@
|
|||
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.BAND_SESSION_JOIN, function(header, payload) {
|
||||
logger.debug("Handling BAND_SESSION_JOIN msg " + JSON.stringify(payload));
|
||||
|
||||
handleNotification(payload, header.type);
|
||||
var okText = '';
|
||||
var showNotification = false;
|
||||
var callback;
|
||||
if (context.JK.currentUserMusician) {
|
||||
// user is MUSICIAN; musician_access = TRUE
|
||||
if (payload.musician_access) {
|
||||
showNotification = true;
|
||||
okText = "JOIN";
|
||||
callback = joinSession;
|
||||
}
|
||||
// user is MUSICIAN; fan_access = TRUE
|
||||
else if (payload.fan_access) {
|
||||
showNotification = true;
|
||||
okText = "LISTEN";
|
||||
callback = listenToSession;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// user is FAN; fan_access = TRUE
|
||||
if (payload.fan_access) {
|
||||
showNotification = true;
|
||||
okText = "LISTEN";
|
||||
callback = listenToSession;
|
||||
}
|
||||
}
|
||||
|
||||
app.notify({
|
||||
"title": "Band Joined Session",
|
||||
"text": payload.msg,
|
||||
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
|
||||
}, {
|
||||
"ok_text": "LISTEN",
|
||||
"ok_callback": listenToSession,
|
||||
"ok_callback_args": {
|
||||
"session_id": payload.session_id,
|
||||
"notification_id": payload.notification_id
|
||||
if (showNotification) {
|
||||
handleNotification(payload, header.type);
|
||||
|
||||
app.notify({
|
||||
"title": "Band Joined Session",
|
||||
"text": payload.msg,
|
||||
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
|
||||
}, {
|
||||
"ok_text": "LISTEN",
|
||||
"ok_callback": callback,
|
||||
"ok_callback_args": {
|
||||
"session_id": payload.session_id,
|
||||
"fan_access": payload.fan_access,
|
||||
"musician_access": payload.musician_access,
|
||||
"approval_required": payload.approval_required,
|
||||
"notification_id": payload.notification_id
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -757,6 +841,43 @@
|
|||
context.JK.popExternalLink('/sessions/' + args.session_id);
|
||||
}
|
||||
|
||||
/*********** TODO: THE NEXT 3 FUNCTIONS ARE COPIED FROM sessionList.js. REFACTOR TO COMMON PLACE. *************/
|
||||
function joinSession(args) {
|
||||
// NOTE: invited musicians get their own notification, so no need to check if user has invitation here
|
||||
// like other places because an invited user would never get this notification
|
||||
if (args.musician_access) {
|
||||
if (args.approval_required) {
|
||||
openAlert(args.session_id);
|
||||
}
|
||||
else {
|
||||
openTerms(args);
|
||||
}
|
||||
}
|
||||
deleteNotification(args.notification_id);
|
||||
}
|
||||
|
||||
function openAlert(sessionId) {
|
||||
var alertDialog = new context.JK.AlertDialog(context.JK.app, "YES",
|
||||
"You must be approved to join this session. Would you like to send a request to join?",
|
||||
sessionId, onCreateJoinRequest);
|
||||
|
||||
alertDialog.initialize();
|
||||
context.JK.app.layout.showDialog('alert');
|
||||
}
|
||||
|
||||
function onCreateJoinRequest(sessionId) {
|
||||
var joinRequest = {};
|
||||
joinRequest.music_session = sessionId;
|
||||
joinRequest.user = context.JK.currentUserId;
|
||||
rest.createJoinRequest(joinRequest)
|
||||
.done(function(response) {
|
||||
|
||||
}).error(context.JK.app.ajaxError);
|
||||
|
||||
context.JK.app.layout.closeDialog('alert');
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function registerMusicianRecordingSaved() {
|
||||
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.MUSICIAN_RECORDING_SAVED, function(header, payload) {
|
||||
logger.debug("Handling MUSICIAN_RECORDING_SAVED msg " + JSON.stringify(payload));
|
||||
|
|
@ -776,7 +897,6 @@
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function registerBandRecordingSaved() {
|
||||
|
|
|
|||
|
|
@ -201,8 +201,8 @@
|
|||
<li session-id="{sessionId}" notification-id="{notificationId}">
|
||||
<div class="avatar-small"><img src="{avatar_url}" /></div>
|
||||
<div class="note-text">
|
||||
{text}
|
||||
<em>({date})</em>
|
||||
{text}
|
||||
<em>{date}</em>
|
||||
<div class="note-delete">
|
||||
<a>
|
||||
<img id="img-delete-notification" notification-id="{notificationId}" src="/assets/shared/icon_delete_sm.png" width="13" height="13" />
|
||||
|
|
|
|||
|
|
@ -97,10 +97,12 @@
|
|||
JK.currentUserId = '<%= current_user.id %>';
|
||||
JK.currentUserAvatarUrl = JK.resolveAvatarUrl('<%= current_user.photo_url %>');
|
||||
JK.currentUserName = '<%= current_user.name %>';
|
||||
JK.currentUserMusician = '<%= current_user.musician %>';
|
||||
<% else %>
|
||||
JK.currentUserId = null;
|
||||
JK.currentUserAvatarUrl = null;
|
||||
JK.currentUserName = null;
|
||||
JK.currentUserMusician = null;
|
||||
<% end %>
|
||||
|
||||
// Some things can't be initialized until we're connected. Put them here.
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ MusicSessionManager < BaseManager
|
|||
user.update_progression_field(:first_music_session_at)
|
||||
MusicSessionUserHistory.save(music_session.id, user.id, client_id, tracks)
|
||||
|
||||
|
||||
# only send this notification if it's a band session
|
||||
unless band.nil?
|
||||
Notification.send_band_session_join(music_session, band)
|
||||
end
|
||||
|
|
@ -133,7 +133,7 @@ MusicSessionManager < BaseManager
|
|||
user.update_progression_field(:first_music_session_at)
|
||||
MusicSessionUserHistory.save(music_session_id, user.id, client_id, tracks)
|
||||
|
||||
if as_musician && music_session.musician_access
|
||||
if as_musician
|
||||
|
||||
# send to session participants
|
||||
Notification.send_session_join(music_session, connection, user)
|
||||
|
|
|
|||
Loading…
Reference in New Issue