Revert "VRFS-1668 initial work on new notifications / refactor to make notification buttons more dynamic"

This reverts commit 2302c89154.
This commit is contained in:
Seth Call 2014-05-13 08:21:32 -05:00
parent 2302c89154
commit 9ee27a5127
11 changed files with 197 additions and 510 deletions

View File

@ -152,5 +152,4 @@ connection_stale_expire.sql
rename_chat_messages.sql
fix_connection_fields.sql
session_ratings.sql
scheduled_sessions.sql
notification_scheduled_session.sql
scheduled_sessions.sql

View File

@ -1 +0,0 @@
alter table notifications alter column description TYPE varchar(100);

View File

@ -27,25 +27,15 @@ message ClientMessage {
NEW_BAND_FOLLOWER = 161;
// session invitations
SESSION_INVITATION = 165;
SESSION_ENDED = 166;
JOIN_REQUEST = 167;
JOIN_REQUEST_APPROVED = 168;
JOIN_REQUEST_REJECTED = 169;
SESSION_JOIN = 170;
SESSION_DEPART = 171;
MUSICIAN_SESSION_JOIN = 172;
TRACKS_CHANGED = 173;
SCHEDULED_SESSION_INVITATION = 174;
SCHEDULED_SESSION_RSVP = 175;
SCHEDULED_SESSION_RSVP_APPROVED = 176;
SCHEDULED_SESSION_RSVP_CANCELLED = 177;
SCHEDULED_SESSION_RSVP_CANCELLED_ORG = 178;
SCHEDULED_SESSION_CANCELLED = 179;
SCHEDULED_SESSION_RESCHEDULED = 180;
SCHEDULED_SESSION_REMINDER = 181;
SCHEDULED_SESSION_COMMENT = 182;
SESSION_INVITATION = 165;
SESSION_ENDED = 170;
JOIN_REQUEST = 175;
JOIN_REQUEST_APPROVED = 180;
JOIN_REQUEST_REJECTED = 185;
SESSION_JOIN = 190;
SESSION_DEPART = 195;
MUSICIAN_SESSION_JOIN = 196;
TRACKS_CHANGED = 197;
// recording notifications
MUSICIAN_RECORDING_SAVED = 200;
@ -116,24 +106,15 @@ message ClientMessage {
optional NewBandFollower new_band_follower = 161;
// session invitations
optional SessionInvitation session_invitation = 165; // from server to user
optional SessionEnded session_ended = 166;
optional JoinRequest join_request = 167;
optional JoinRequestApproved join_request_approved = 168;
optional JoinRequestRejected join_request_rejected = 169;
optional SessionJoin session_join = 170;
optional SessionDepart session_depart = 171;
optional MusicianSessionJoin musician_session_join = 172;
optional TracksChanged tracks_changed = 173;
optional ScheduledSessionInvitation scheduled_session_invitation = 174;
optional ScheduledSessionRsvp scheduled_session_rsvp = 175;
optional ScheduledSessionRsvpApproved scheduled_session_rsvp_approved = 176;
optional ScheduledSessionRsvpCancelled scheduled_session_rsvp_cancelled = 177;
optional ScheduledSessionRsvpCancelledOrg scheduled_session_rsvp_cancelled_org = 178;
optional ScheduledSessionCancelled scheduled_session_cancelled = 179;
optional ScheduledSessionRescheduled scheduled_session_rescheduled = 180;
optional ScheduledSessionReminder scheduled_session_reminder = 181;
optional ScheduledSessionComment scheduled_session_comment = 182;
optional SessionInvitation session_invitation = 165; // from server to user
optional SessionEnded session_ended = 170;
optional JoinRequest join_request = 175;
optional JoinRequestApproved join_request_approved = 180;
optional JoinRequestRejected join_request_rejected = 185;
optional SessionJoin session_join = 190;
optional SessionDepart session_depart = 195;
optional MusicianSessionJoin musician_session_join = 196;
optional TracksChanged tracks_changed = 197;
// recording notifications
optional MusicianRecordingSaved musician_recording_saved = 200;
@ -343,56 +324,6 @@ message MusicianSessionJoin {
optional string created_at = 8;
}
message ScheduledSessionInvitation {
optional string session_id = 1;
optional string photo_url = 2;
optional string msg = 3;
optional string session_name = 4;
optional string session_date = 5;
optional string notification_id = 6;
optional string created_at = 7;
}
message ScheduledSessionRsvp {
optional string session_id = 1;
optional string photo_url = 2;
optional string msg = 3;
optional string slot_id = 4;
optional string instruments = 5;
optional string session_name = 6;
optional string session_date = 7;
optional string notification_id = 8;
optional string created_at = 9;
}
message ScheduledSessionRsvpApproved {
}
message ScheduledSessionRsvpCancelled {
}
message ScheduledSessionRsvpCancelledOrg {
}
message ScheduledSessionCancelled {
}
message ScheduledSessionRescheduled {
}
message ScheduledSessionReminder {
}
message ScheduledSessionComment {
}
message MusicianRecordingSaved {
optional string recording_id = 1;
optional string photo_url = 2;

View File

@ -218,33 +218,6 @@
end
end
def scheduled_session_invitation(email, msg, session_id)
end
def scheduled_session_rsvp(email, msg)
end
def scheduled_session_approved(email, msg)
end
def scheduled_session_rsvp_cancelled(email, msg)
end
def scheduled_session_rsvp_cancelled_org(email, msg)
end
def scheduled_session_cancelled(email, msg)
end
def scheduled_session_rescheduled(email, msg)
end
def scheduled_session_reminder(email, msg)
end
def scheduled_session_comment(email, msg)
end
def band_session_join(email, msg, session_id)
subject = "A band that you follow has joined a session"
unique_args = {:type => "band_session_join"}

View File

@ -18,17 +18,6 @@ module NotificationTypes
SESSION_DEPART = "SESSION_DEPART"
MUSICIAN_SESSION_JOIN = "MUSICIAN_SESSION_JOIN"
# scheduled sessions
SCHEDULED_SESSION_INVITATION = "SCHEDULED_SESSION_INVITATION"
SCHEDULED_SESSION_RSVP = "SCHEDULED_SESSION_RSVP"
SCHEDULED_SESSION_RSVP_APPROVED = "SCHEDULED_SESSION_RSVP_APPROVED"
SCHEDULED_SESSION_RSVP_CANCELLED = "SCHEDULED_SESSION_RSVP_CANCELLED"
SCHEDULED_SESSION_RSVP_CANCELLED_ORG = "SCHEDULED_SESSION_RSVP_CANCELLED_ORG"
SCHEDULED_SESSION_CANCELLED = "SCHEDULED_SESSION_CANCELLED"
SCHEDULED_SESSION_RESCHEDULED = "SCHEDULED_SESSION_RESCHEDULED"
SCHEDULED_SESSION_REMINDER = "SCHEDULED_SESSION_REMINDER"
SCHEDULED_SESSION_COMMENT = "SCHEDULED_SESSION_COMMENT"
# recording notifications
MUSICIAN_RECORDING_SAVED = "MUSICIAN_RECORDING_SAVED"
BAND_RECORDING_SAVED = "BAND_RECORDING_SAVED"

View File

@ -434,52 +434,6 @@ module JamRuby
)
end
def scheduled_session_invitation(receiver_id, session_id, photo_url, msg, session_name, session_date, notification_id, created_at)
scheduled_session_invitation = Jampb::ScheduledSessionInvitation.new(
:session_id => session_id,
:photo_url => photo_url,
:msg => msg,
:session_name => session_name,
:session_date => session_date,
:notification_id => notification_id,
:created_at => created_at
)
Jampb::ClientMessage.new(
:type => ClientMessage::Type::SCHEDULED_SESSION_INVITATION,
:route_to => USER_TARGET_PREFIX + receiver_id,
:scheduled_session_invitation => scheduled_session_invitation
)
end
# SCHEDULED_SESSION_RSVP = 175;
# SCHEDULED_SESSION_RSVP_APPROVED = 176;
# SCHEDULED_SESSION_RSVP_CANCELLED = 177;
# SCHEDULED_SESSION_RSVP_CANCELLED_ORG = 178;
# SCHEDULED_SESSION_CANCELLED = 179;
# SCHEDULED_SESSION_RESCHEDULED = 180;
# SCHEDULED_SESSION_REMINDER = 181;
# SCHEDULED_SESSION_COMMENT = 182;
def scheduled_session_rsvp(receiver_id, session_id, photo_url, msg, slots, instruments, session_name, session_date, notification_id, created_at)
scheduled_session_rsvp = Jampb::ScheduledSessionRsvp.new(
:session_id => session_id,
:photo_url => photo_url,
:msg => msg,
:session_name => session_name,
:session_date => session_date,
:notification_id => notification_id,
:created_at => created_at
)
Jampb::ClientMessage.new(
:type => ClientMessage::Type::SCHEDULED_SESSION_RSVP,
:route_to => USER_TARGET_PREFIX + receiver_id,
:scheduled_session_rsvp => scheduled_session_rsvp
)
end
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,

View File

@ -10,7 +10,7 @@ module JamRuby
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"
belongs_to :band, :class_name => "JamRuby::Band", :foreign_key => "band_id"
belongs_to :music_session, :class_name => "JamRuby::MusicSession", :foreign_key => "music_session_id"
belongs_to :session, :class_name => "JamRuby::ActiveMusicSession", :foreign_key => "session_id"
belongs_to :recording, :class_name => "JamRuby::Recording", :foreign_key => "recording_id"
validates :target_user, :presence => true
@ -50,7 +50,7 @@ module JamRuby
band = Band.find(self.band_id)
end
self.class.format_msg(self.description, {:user => source_user, :band => band})
self.class.format_msg(self.description, source_user, band)
end
# TODO: MAKE ALL METHODS BELOW ASYNC SO THE CLIENT DOESN'T BLOCK ON NOTIFICATION LOGIC
@ -111,12 +111,7 @@ module JamRuby
return ids
end
def format_msg(description, options)
user = options[:user]
band = options[:band]
session = options[:session]
def format_msg(description, user = nil, band = nil)
name, band_name = ""
unless user.nil?
name = user.name
@ -148,7 +143,7 @@ module JamRuby
# session notifications
when NotificationTypes::SESSION_INVITATION
return "You have been invited to join a session by #{name}."
return "#{name} has invited you to a session."
when NotificationTypes::JOIN_REQUEST
return "#{name} has requested to join your session."
@ -171,32 +166,6 @@ module JamRuby
when NotificationTypes::BAND_SESSION_JOIN
return "#{band_name} is now in a session."
when NotificationTypes::SCHEDULED_SESSION_INVITATION
return "You have been invited to join a session by #{name}."
when NotificationTypes::SCHEDULED_SESSION_RSVP
return "#{name} would like to play in a session you have scheduled."
when NotificationTypes::SCHEDULED_SESSION_RSVP_APPROVED
return "Your RSVP to a scheduled session has been approved!"
when NotificationTypes::SCHEDULED_SESSION_RSVP_CANCELLED
return "A musician has cancelled an RSVP to your session."
when NotificationTypes::SCHEDULED_SESSION_RSVP_CANCELLED_ORG
return "The session organizer has cancelled this session."
when NotificationTypes::SCHEDULED_SESSION_CANCELLED
return "The session organizer has cancelled this session:"
when NotificationTypes::SCHEDULED_SESSION_RESCHEDULED
return "The following session has been rescheduled:"
when NotificationTypes::SCHEDULED_SESSION_REMINDER
return "A session to which you have RSVPd will begin in one hour, so get ready to play!"
when NotificationTypes::SCHEDULED_SESSION_COMMENT
return "New message about session:"
# recording notifications
when NotificationTypes::MUSICIAN_RECORDING_SAVED
@ -235,7 +204,7 @@ module JamRuby
user = User.find(user_id)
online_msg = online ? "online." : "offline."
notification_msg = format_msg(NotificationTypes::FRIEND_UPDATE, {:user => user}) + online_msg
notification_msg = format_msg(NotificationTypes::FRIEND_UPDATE, user) + online_msg
msg = @@message_factory.friend_update(
user.id,
user.photo_url,
@ -258,7 +227,7 @@ module JamRuby
notification.friend_request_id = friend_request_id
notification.save
notification_msg = format_msg(notification.description, {:user => user})
notification_msg = format_msg(notification.description, user)
if friend.online
msg = @@message_factory.friend_request(
@ -287,7 +256,7 @@ module JamRuby
notification.target_user_id = user_id
notification.save
notification_msg = format_msg(notification.description, {:user => friend})
notification_msg = format_msg(notification.description, friend)
if user.online
msg = @@message_factory.friend_request_accepted(
@ -313,7 +282,7 @@ module JamRuby
notification.target_user_id = user.id
notification.save
notification_msg = format_msg(notification.description, {:user => follower})
notification_msg = format_msg(notification.description, follower)
if follower.id != user.id
if user.online
@ -346,7 +315,7 @@ module JamRuby
notification.band_id = band.id
notification.save
notification_msg = format_msg(notification.description, {:user => follower, :band => band})
notification_msg = format_msg(notification.description, follower, band)
# this protects against sending the notification to a band member who decides to follow the band
if follower.id != bm.user.id
@ -377,7 +346,7 @@ module JamRuby
notification.session_id = session_id
notification.save
notification_msg = format_msg(NotificationTypes::SESSION_INVITATION, {:user => sender})
notification_msg = format_msg(NotificationTypes::SESSION_INVITATION, sender)
if receiver.online
msg = @@message_factory.session_invitation(
@ -420,7 +389,7 @@ module JamRuby
notification.session_id = music_session.id
notification.save
notification_msg = format_msg(notification.description, {:user => join_request.user})
notification_msg = format_msg(notification.description, join_request.user)
msg = @@message_factory.join_request(
join_request.id,
@ -443,7 +412,7 @@ module JamRuby
notification.session_id = music_session.id
notification.save
notification_msg = format_msg(notification.description, {:user => music_session.creator})
notification_msg = format_msg(notification.description, music_session.creator)
msg = @@message_factory.join_request_approved(
join_request.id,
@ -466,7 +435,7 @@ module JamRuby
notification.session_id = music_session.id
notification.save
notification_msg = format_msg(notification.description, {:user => music_session.creator})
notification_msg = format_msg(notification.description, music_session.creator)
msg = @@message_factory.join_request_rejected(
join_request.id,
@ -482,7 +451,7 @@ module JamRuby
def send_session_join(music_session, connection, user)
notification_msg = format_msg(NotificationTypes::SESSION_JOIN, {:user => user})
notification_msg = format_msg(NotificationTypes::SESSION_JOIN, user)
msg = @@message_factory.session_join(
music_session.id,
@ -496,7 +465,7 @@ module JamRuby
def send_session_depart(music_session, client_id, user, recordingId)
notification_msg = format_msg(NotificationTypes::SESSION_DEPART, {:user => user})
notification_msg = format_msg(NotificationTypes::SESSION_DEPART, user)
msg = @@message_factory.session_depart(
music_session.id,
@ -517,7 +486,7 @@ module JamRuby
@@mq_router.server_publish_to_session(music_session, msg)
end
def send_musician_session_join(music_session, user)
def send_musician_session_join(music_session, connection, user)
if music_session.musician_access || music_session.fan_access
@ -532,7 +501,7 @@ module JamRuby
# remove anyone in the session and invited musicians
friends_and_followers = friends_and_followers - music_session.users - music_session.invited_musicians
notifications, online_ff, offline_ff = [], [], []
notification_msg = format_msg(NotificationTypes::MUSICIAN_SESSION_JOIN, {:user => user})
notification_msg = format_msg(NotificationTypes::MUSICIAN_SESSION_JOIN, user)
friends_and_followers.each do |ff|
notification = Notification.new
@ -572,61 +541,13 @@ module JamRuby
end
end
def send_scheduled_session_invitation(music_session, user)
notification = Notification.new
notification.description = NotificationTypes::SCHEDULED_SESSION_INVITATION
notification.source_user_id = music_session.creator.id
notification.target_user_id = user.id
notification.session_id = music_session.id
notification.save
notification_msg = format_msg(notification.description, {:user => music_session.creator, :session => music_session})
msg = @@message_factory.scheduled_session_invitation(
user.id,
music_session.id,
music_session.creator.photo_url,
notification_msg,
music_session.description,
music_session.scheduled_start,
notification.id,
notification.created_date
)
@@mq_router.publish_to_user(user.id, msg)
end
def send_scheduled_session_rsvp(music_session, user, rsvp_requests)
end
def send_scheduled_session_approved(email, msg)
end
def send_scheduled_session_rsvp_cancelled(email, msg)
end
def send_scheduled_session_rsvp_cancelled_org(email, msg)
end
def send_scheduled_session_cancelled(email, msg)
end
def send_scheduled_session_rescheduled(email, msg)
end
def send_scheduled_session_reminder(email, msg)
end
def send_scheduled_session_comment(email, msg)
end
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
notifications, online_followers, offline_followers = [], [], []
notification_msg = format_msg(NotificationTypes::BAND_SESSION_JOIN, {:band => band})
notification_msg = format_msg(NotificationTypes::BAND_SESSION_JOIN, nil, band)
followers = band.followers.map { |bf| bf.user }
@ -681,7 +602,7 @@ module JamRuby
friends_and_followers = friend_users.concat(follower_users).uniq
notifications, online_ff, offline_ff = [], [], []
notification_msg = format_msg(NotificationTypes::MUSICIAN_RECORDING_SAVED, {:user => user})
notification_msg = format_msg(NotificationTypes::MUSICIAN_RECORDING_SAVED, user)
friends_and_followers.each do |ff|
notification = Notification.new
@ -715,7 +636,7 @@ module JamRuby
def send_band_recording_saved(recording)
notification_msg = format_msg(NotificationTypes::BAND_RECORDING_SAVED, {:band => recording.band})
notification_msg = format_msg(NotificationTypes::BAND_RECORDING_SAVED, nil, recording.band)
band.followers.each do |bf|
follower = bf.user
@ -748,9 +669,9 @@ module JamRuby
end
end
def send_recording_started(music_session, user)
def send_recording_started(music_session, connection, user)
notification_msg = format_msg(NotificationTypes::RECORDING_STARTED, {:user => user})
notification_msg = format_msg(NotificationTypes::RECORDING_STARTED, user)
music_session.users.each do |musician|
if musician.id != user.id
@ -765,9 +686,9 @@ module JamRuby
end
end
def send_recording_ended(music_session, user)
def send_recording_ended(music_session, connection, user)
notification_msg = format_msg(NotificationTypes::RECORDING_ENDED, {:user => user})
notification_msg = format_msg(NotificationTypes::RECORDING_ENDED, user)
music_session.users.each do |musician|
if musician.id != user.id
@ -794,7 +715,7 @@ module JamRuby
notification.description = NotificationTypes::RECORDING_MASTER_MIX_COMPLETE
notification.save
notification_msg = format_msg(notification.description, {:band => recording.band})
notification_msg = format_msg(notification.description, nil, recording.band)
msg = @@message_factory.recording_master_mix_complete(
claimed_recording.user_id,
@ -850,7 +771,7 @@ module JamRuby
notification.target_user_id = receiver.id
notification.save
notification_msg = format_msg(notification.description, {:band => band})
notification_msg = format_msg(notification.description, nil, band)
if receiver.online
msg = @@message_factory.band_invitation(
@ -879,7 +800,7 @@ module JamRuby
notification.target_user_id = receiver.id
notification.save
notification_msg = format_msg(notification.description, {:user => sender, :band => band})
notification_msg = format_msg(notification.description, sender, band)
if receiver.online
msg = @@message_factory.band_invitation_accepted(

View File

@ -33,17 +33,9 @@
JOIN_REQUEST_REJECTED : "JOIN_REQUEST_REJECTED",
SESSION_JOIN : "SESSION_JOIN",
SESSION_DEPART : "SESSION_DEPART",
MUSICIAN_SESSION_JOIN : "MUSICIAN_SESSION_JOIN",
TRACKS_CHANGED : "TRACKS_CHANGED",
SCHEDULED_SESSION_INVITATION : "SCHEDULED_SESSION_INVITATION",
SCHEDULED_SESSION_RSVP : "SCHEDULED_SESSION_RSVP",
SCHEDULED_SESSION_RSVP_APPROVED : "SCHEDULED_SESSION_RSVP_APPROVED",
SCHEDULED_SESSION_RSVP_CANCELLED : "SCHEDULED_SESSION_RSVP_CANCELLED",
SCHEDULED_SESSION_RSVP_CANCELLED_ORG : "SCHEDULED_SESSION_RSVP_CANCELLED_ORG",
SCHEDULED_SESSION_CANCELLED : "SCHEDULED_SESSION_CANCELLED",
SCHEDULED_SESSION_RESCHEDULED : "SCHEDULED_SESSION_RESCHEDULED",
SCHEDULED_SESSION_REMINDER : "SCHEDULED_SESSION_REMINDER",
SCHEDULED_SESSION_COMMENT : "SCHEDULED_SESSION_COMMENT",
MUSICIAN_SESSION_JOIN : "MUSICIAN_SESSION_JOIN",
BAND_SESSION_JOIN : "BAND_SESSION_JOIN",
// recording notifications
MUSICIAN_RECORDING_SAVED : "MUSICIAN_RECORDING_SAVED",
@ -56,7 +48,6 @@
// band notifications
BAND_INVITATION : "BAND_INVITATION",
BAND_INVITATION_ACCEPTED : "BAND_INVITATION_ACCEPTED",
BAND_SESSION_JOIN : "BAND_SESSION_JOIN",
// text message
TEXT_MESSAGE : "TEXT_MESSAGE",

View File

@ -763,46 +763,15 @@
var firstNotification = false;
var notifyDetails;
var okButton = {
id: "btn-okay",
text: "OKAY",
"layout-action": "close",
href: "#",
css: "button-orange"
};
var cancelButton = {
id: "btn-cancel",
text: "CANCEL",
"layout-action": "close",
href: "#",
css: "button-grey"
};
var defaultButtons = [
okButton,
cancelButton
];
this.notify = function (message, buttons) {
if (!buttons) {
buttons = defaultButtons;
}
// this allows clients to just specify the important action button without having to repeat the cancel descripton everywhere
if (buttons.length === 1) {
buttons.push(cancelButton);
}
this.notify = function (message, descriptor) {
var $notify = $('[layout="notify"]');
if (notifyQueue.length === 0) {
firstNotification = true;
setNotificationInfo(message, buttons, $notify);
setNotificationInfo(message, descriptor, $notify);
}
notifyQueue.push({message: message, descriptor: buttons});
notifyQueue.push({message: message, descriptor: descriptor});
// JW - speeding up the in/out parts of notify. Extending non-moving time.
$notify.slideDown(250)
.delay(4000)
@ -827,7 +796,7 @@
});
};
function setNotificationInfo(message, buttons, notificationSelector) {
function setNotificationInfo(message, descriptor, notificationSelector) {
var $notify = $('[layout="notify"]');
$('h2', $notify).text(message.title);
$('p', $notify).empty();
@ -853,32 +822,73 @@
$('div.detail', $notify).hide();
}
var $buttonDiv = $('#buttons', $notify);
$buttonDiv.empty();
$('#ok-button', $notify).unbind('click');
$('#cancel-button', $notify).unbind('click');
$.each(buttons, function(index, val) {
$buttonDiv.append('<a id="' + val.id + '" href="#" class="' + val.css + '" layout-action="close">' + val.text + '</a>&nbsp;&nbsp;')
// ensure it doesn't fire twice
$('#' + val.id, $notify).unbind('click');
$('#' + val.id, $notify).click(function() {
console.log($(this).attr('class'));
console.log("handling click");
if (val.callback !== undefined) {
if (val.callback_args) {
val.callback(val.callback_args);
if (descriptor) {
if (descriptor.ok_text) {
$('#ok-button', $notify).html(descriptor.ok_text);
}
else {
$('#ok-button', $notify).html("OKAY");
}
$('#ok-button', $notify).click(function () {
if (descriptor.ok_callback !== undefined) {
if (descriptor.ok_callback_args) {
descriptor.ok_callback(descriptor.ok_callback_args);
return false;
}
else {
val.callback();
descriptor.ok_callback();
return false;
}
return false;
}
else {
notificationSelector.hide();
}
});
});
if (descriptor.cancel_text) {
$('#cancel-button', $notify).html(descriptor.cancel_text);
}
else {
if (descriptor.no_cancel) {
$('#cancel-button', $notify).hide();
}
else {
$('#cancel-button', $notify).html("CANCEL");
}
}
$('#cancel-button', $notify).click(function () {
if (descriptor.cancel_callback !== undefined) {
if (descriptor.cancel_callback_args) {
descriptor.cancel_callback(descriptor.cancel_callback_args);
return false;
}
else {
descriptor.cancel_callback();
return false;
}
}
else {
notificationSelector.hide();
}
});
}
// by default OKAY and CANCEL should just hide the notification
else {
$('#ok-button', $notify).html("OKAY");
$('#ok-button', $notify).click(function () {
notificationSelector.hide();
});
$('#cancel-button', $notify).html("CANCEL");
$('#cancel-button', $notify).click(function () {
notificationSelector.hide();
});
}
}
this.setWizardStep = setWizardStep;

View File

@ -165,7 +165,6 @@
registerJoinRequestRejected();
registerMusicianSessionJoin();
registerBandSessionJoin();
registerScheduledSessionInvitation();
// recording notifications
registerMusicianRecordingSaved();
@ -412,19 +411,11 @@
"title": "Join Request Approved",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
}, [{
id: "btn-join",
text: "JOIN SESSION",
"layout-action": "close",
href: "#",
css: "button-orange",
callback: openTerms,
callback_args: {
"session_id": payload.session_id,
"notification_id": payload.notification_id
}
}]
);
}, {
"ok_text": "JOIN SESSION",
"ok_callback": openTerms,
"ok_callback_args": { "session_id": payload.session_id, "notification_id": payload.notification_id }
});
});
}
@ -453,31 +444,14 @@
"title": "New Join Request",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
}, [{
id: "btn-approve",
text: "APPROVE",
"layout-action": "close",
href: "#",
css: "button-orange",
callback: approveJoinRequest,
callback_args: {
"join_request_id": payload.join_request_id,
"notification_id": payload.notification_id
}
},
{
id: "btn-reject",
text: "REJECT",
"layout-action": "close",
href: "#",
css: "button-grey",
callback: rejectJoinRequest,
callback_args: {
"join_request_id": payload.join_request_id,
"notification_id": payload.notification_id
}
}]
);
}, {
"ok_text": "APPROVE",
"ok_callback": approveJoinRequest,
"ok_callback_args": { "join_request_id": payload.join_request_id, "notification_id": payload.notification_id },
"cancel_text": "REJECT",
"cancel_callback": rejectJoinRequest,
"cancel_callback_args": { "join_request_id": payload.join_request_id, "notification_id": payload.notification_id }
});
});
}
@ -540,19 +514,11 @@
"title": "New Friend Request",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
}, [{
id: "btn-accept",
text: "ACCEPT",
"layout-action": "close",
href: "#",
css: "button-orange",
callback: acceptFriendRequest,
callback_args: {
"friend_request_id": payload.friend_request_id,
"notification_id": payload.notification_id
}
}]
);
}, {
"ok_text": "ACCEPT",
"ok_callback": acceptFriendRequest,
"ok_callback_args": { "friend_request_id": payload.friend_request_id, "notification_id": payload.notification_id }
});
});
}
@ -607,19 +573,11 @@
app.notify({
"title": "Session Invitation",
"text": participantHtml
}, [{
id: "btn-join",
text: "JOIN SESSION",
"layout-action": "close",
href: "#",
css: "button-orange",
callback: openTerms,
callback_args: {
"session_id": payload.session_id,
"notification_id": payload.notification_id
}
}]
);
}, {
"ok_text": "JOIN SESSION",
"ok_callback": openTerms,
"ok_callback_args": { "session_id": payload.session_id, "notification_id": payload.notification_id }
});
}).error(app.ajaxError);
});
@ -660,24 +618,20 @@
handleNotification(payload, header.type);
app.notify({
"title": "Musician Joined Session",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
}, [{
id: "btn-action",
text: okText,
"layout-action": "close",
href: "#",
css: "button-orange",
callback: callback,
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
}
}]
"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
}
}
);
}
});
@ -718,42 +672,25 @@
handleNotification(payload, header.type);
app.notify({
"title": "Band Joined Session",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
}, [{
id: "btn-listen",
text: okText,
"layout-action": "close",
href: "#",
css: "button-orange",
callback: callback,
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
}
}]
"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
}
}
);
}
});
}
function registerScheduledSessionInvitation() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_INVITATION, function(header, payload) {
logger.debug("Handling SCHEDULED_SESSION_INVITATION msg " + JSON.stringify(payload));
handleNotification(payload, header.type);
app.notify({
"title": "Session Invitation",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
});
});
}
function registerMusicianRecordingSaved() {
context.JK.JamServer.registerMessageCallback(context.JK.MessageType.MUSICIAN_RECORDING_SAVED, function(header, payload) {
@ -765,19 +702,14 @@
"title": "Musician Recording Saved",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
}, [{
id: "btn-listen",
text: "LISTEN",
"layout-action": "close",
href: "#",
css: "button-orange",
callback: listenToRecording,
callback_args: {
"recording_id": payload.recording_id,
"notification_id": payload.notification_id
}
}]
);
}, {
"ok_text": "LISTEN",
"ok_callback": listenToRecording,
"ok_callback_args": {
"recording_id": payload.recording_id,
"notification_id": payload.notification_id
}
});
});
}
@ -791,19 +723,14 @@
"title": "Band Recording Saved",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
}, [{
id: "btn-listen",
text: "LISTEN",
"layout-action": "close",
href: "#",
css: "button-orange",
callback: listenToRecording,
callback_args: {
"recording_id": payload.recording_id,
"notification_id": payload.notification_id
}
}]
);
}, {
"ok_text": "LISTEN",
"ok_callback": listenToRecording,
"ok_callback_args": {
"recording_id": payload.recording_id,
"notification_id": payload.notification_id
}
});
});
}
@ -818,18 +745,13 @@
"title": "Recording Master Mix Complete",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
}, [{
id: "btn-share",
text: "SHARE",
"layout-action": "close",
href: "#",
css: "button-orange",
callback: shareRecording,
callback_args: {
"recording_id": payload.recording_id
}
}]
);
}, {
"ok_text": "SHARE",
"ok_callback": shareRecording,
"ok_callback_args": {
"recording_id": payload.recording_id
}
});
});
}
@ -847,20 +769,15 @@
"title": "Band Invitation",
"text": payload.msg,
"icon_url": context.JK.resolveAvatarUrl(payload.photo_url)
}, [{
id: "btn-accept",
text: "ACCEPT",
"layout-action": "close",
href: "#",
css: "button-orange",
callback: acceptBandInvitation,
callback_args: {
"band_invitation_id": payload.band_invitation_id,
"band_id": payload.band_id,
"notification_id": payload.notification_id
}
}]
);
}, {
"ok_text": "ACCEPT",
"ok_callback": acceptBandInvitation,
"ok_callback_args": {
"band_invitation_id": payload.band_invitation_id,
"band_id": payload.band_id,
"notification_id": payload.notification_id
}
});
});
}

View File

@ -6,7 +6,10 @@
</a>
<p></p>
<div class="detail"></div>
<div id="buttons" class="right clearall">
<div class="right clearall">
<a id="ok-button" href="#" class="button-orange" layout-action="close">OKAY</a>
&nbsp;&nbsp;
<a id="cancel-button" href="#" class="button-grey" layout-action="close">CANCEL</a>
</div>
</div>