diff --git a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb index 3a5df086a..22a66b54e 100644 --- a/ruby/lib/jam_ruby/app/mailers/user_mailer.rb +++ b/ruby/lib/jam_ruby/app/mailers/user_mailer.rb @@ -224,7 +224,7 @@ def scheduled_session_rsvp(email, msg) end - def scheduled_session_approved(email, msg) + def scheduled_session_rsvp_approved(email, msg) end def scheduled_session_rsvp_cancelled(email, msg) diff --git a/web/app/assets/javascripts/accounts_identity.js b/web/app/assets/javascripts/accounts_identity.js index 7d7ef1019..0b5ade899 100644 --- a/web/app/assets/javascripts/accounts_identity.js +++ b/web/app/assets/javascripts/accounts_identity.js @@ -142,7 +142,8 @@ { title: "Confirmation Email Sent", text: "A confirmation email should arrive shortly at " + email + ". Please click the confirmation link in it to confirm your email change." }, - { no_cancel: true }); + null, // notify method will add buttons + true); } function postUpdateEmailFailure(xhr, textStatus, errorMessage) { @@ -193,7 +194,8 @@ { title: "Password Changed", text: "You have changed your password successfully." }, - { no_cancel: true }); + null, + true); } function postUpdatePasswordFailure(xhr, textStatus, errorMessage) { diff --git a/web/app/assets/javascripts/accounts_profile.js b/web/app/assets/javascripts/accounts_profile.js index 62a1734bb..32b72de65 100644 --- a/web/app/assets/javascripts/accounts_profile.js +++ b/web/app/assets/javascripts/accounts_profile.js @@ -364,7 +364,8 @@ { title: "Profile Changed", text: "You have updated your profile successfully." }, - { no_cancel: true }); + null, + true); } function postUpdateProfileFailure(xhr, textStatus, errorMessage) { diff --git a/web/app/assets/javascripts/accounts_profile_avatar.js b/web/app/assets/javascripts/accounts_profile_avatar.js index ab5eba833..388bed37c 100644 --- a/web/app/assets/javascripts/accounts_profile_avatar.js +++ b/web/app/assets/javascripts/accounts_profile_avatar.js @@ -370,7 +370,8 @@ { title: "Upload an Avatar First", text: "To update your avatar, first you must upload an image using the UPLOAD button" }, - { no_cancel: true }); + null, + true); } } @@ -387,7 +388,8 @@ { title: "Avatar Changed", text: "You have updated your avatar successfully." }, - { no_cancel: true }); + null, + true); } function onSelectRelease(event) { diff --git a/web/app/assets/javascripts/band_setup_photo.js b/web/app/assets/javascripts/band_setup_photo.js index b5e009150..96f7c5853 100644 --- a/web/app/assets/javascripts/band_setup_photo.js +++ b/web/app/assets/javascripts/band_setup_photo.js @@ -369,7 +369,8 @@ { title: "Upload a Band Photo First", text: "To update your band photo, first you must upload an image using the UPLOAD button" }, - { no_cancel: true }); + null, + true); } } @@ -382,7 +383,8 @@ { title: "Band Photo Changed", text: "You have updated your band photo successfully." }, - { no_cancel: true }); + null, + true); } function onSelectRelease(event) { diff --git a/web/app/assets/javascripts/layout.js b/web/app/assets/javascripts/layout.js index e168da4c6..46f8764fa 100644 --- a/web/app/assets/javascripts/layout.js +++ b/web/app/assets/javascripts/layout.js @@ -784,9 +784,14 @@ cancelButton ]; - this.notify = function (message, buttons) { + this.notify = function (message, buttons, noCancel) { if (!buttons) { - buttons = defaultButtons; + if (noCancel) { + buttons = okButton; + } + else { + buttons = defaultButtons; + } } // this allows clients to just specify the important action button without having to repeat the cancel descripton everywhere diff --git a/web/app/assets/javascripts/notificationPanel.js b/web/app/assets/javascripts/notificationPanel.js index a635f585b..49f42b98e 100644 --- a/web/app/assets/javascripts/notificationPanel.js +++ b/web/app/assets/javascripts/notificationPanel.js @@ -165,7 +165,18 @@ registerJoinRequestRejected(); registerMusicianSessionJoin(); registerBandSessionJoin(); + + // scheduled sessions registerScheduledSessionInvitation(); + registerScheduledSessionRsvp(); + registerScheduledSessionRsvpApproved(); + registerScheduledSessionRsvpCancelled(); + registerScheduledSessionRsvpCancelledOrg(); + registerScheduledSessionCancelled(); + registerScheduledSessionRescheduled(); + registerScheduledSessionReminder(); + registerScheduledSessionComment(); + // recording notifications registerMusicianRecordingSaved(); @@ -741,6 +752,7 @@ }); } + 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)); @@ -755,6 +767,121 @@ }); } + + function registerScheduledSessionRsvp() { + context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_RSVP, function(header, payload) { + logger.debug("Handling SCHEDULED_SESSION_RSVP 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 registerScheduledSessionRsvpApproved() { + context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_RSVP_APPROVED, function(header, payload) { + logger.debug("Handling SCHEDULED_SESSION_RSVP_APPROVED 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 registerScheduledSessionRsvpCancelled() { + context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_RSVP_CANCELLED, function(header, payload) { + logger.debug("Handling SCHEDULED_SESSION_RSVP_CANCELLED 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 registerScheduledSessionRsvpCancelledOrg() { + context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_RSVP_CANCELLED_ORG, function(header, payload) { + logger.debug("Handling SCHEDULED_SESSION_RSVP_CANCELLED_ORG 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 registerScheduledSessionCancelled() { + context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_CANCELLED, function(header, payload) { + logger.debug("Handling SCHEDULED_SESSION_CANCELLED 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 registerScheduledSessionRescheduled() { + context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_RESCHEDULED, function(header, payload) { + logger.debug("Handling SCHEDULED_SESSION_RESCHEDULED 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 registerScheduledSessionReminder() { + context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_REMINDER, function(header, payload) { + logger.debug("Handling SCHEDULED_SESSION_REMINDER 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 registerScheduledSessionComment() { + context.JK.JamServer.registerMessageCallback(context.JK.MessageType.SCHEDULED_SESSION_COMMENT, function(header, payload) { + logger.debug("Handling SCHEDULED_SESSION_COMMENT 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) { logger.debug("Handling MUSICIAN_RECORDING_SAVED msg " + JSON.stringify(payload)); diff --git a/web/app/assets/javascripts/session.js b/web/app/assets/javascripts/session.js index 8f9da6756..d1ffbb7bb 100644 --- a/web/app/assets/javascripts/session.js +++ b/web/app/assets/javascripts/session.js @@ -469,7 +469,8 @@ { title: "Unable to Join Session", text: "The session you attempted to join is over." }, - { no_cancel: true }); + null, + true); } else { app.notifyServerError(xhr, 'Unable to Join Session'); diff --git a/web/app/assets/javascripts/sessionList.js b/web/app/assets/javascripts/sessionList.js index 368b56ffe..097d05d0c 100644 --- a/web/app/assets/javascripts/sessionList.js +++ b/web/app/assets/javascripts/sessionList.js @@ -219,7 +219,8 @@ { title: "Unable to Join Session", text: "There was an unexpected error while attempting to join the session." }, - { no_cancel: true }); + null, + true); } }); } diff --git a/web/app/assets/javascripts/textMessageDialog.js b/web/app/assets/javascripts/textMessageDialog.js index 8099da112..873bbc82d 100644 --- a/web/app/assets/javascripts/textMessageDialog.js +++ b/web/app/assets/javascripts/textMessageDialog.js @@ -277,14 +277,19 @@ "title": "Message from " + payload.sender_name, "text": payload.msg, "icon_url": context.JK.resolveAvatarUrl(payload.photo_url) - }, { - "ok_text": "REPLY", - "ok_callback": respondTextInvitation, - "ok_callback_args": { - "sender_id": payload.sender_id, - "notification_id": payload.notification_id - } - }); + }, [{ + id: "btn-reply", + text: "REPLY", + "layout-action": "close", + href: "#", + css: "button-orange", + callback: respondTextInvitation, + callback_args: { + "sender_id": payload.sender_id, + "notification_id": payload.notification_id + } + }] + ); } } diff --git a/web/app/views/clients/_hoverMusician.html.erb b/web/app/views/clients/_hoverMusician.html.erb index 7041d8717..253e7dceb 100644 --- a/web/app/views/clients/_hoverMusician.html.erb +++ b/web/app/views/clients/_hoverMusician.html.erb @@ -66,7 +66,8 @@ { title: "Unable to Join Session", text: "There was an unexpected error while attempting to join the session." }, - { no_cancel: true }); + null, + true); } }); } @@ -157,7 +158,8 @@ title: "Unable to Message From Here", text: goto }, - { no_cancel: true }); + null, + true); } return false; diff --git a/web/spec/features/notification_highlighter_spec.rb b/web/spec/features/notification_highlighter_spec.rb index 948e0321c..0f8dbc856 100644 --- a/web/spec/features/notification_highlighter_spec.rb +++ b/web/spec/features/notification_highlighter_spec.rb @@ -77,7 +77,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f before(:each) do notification = Notification.send_text_message("text message", user2, user) notification.errors.any?.should be_false - find('#notification #ok-button') # wait for notification to show, so that we know the sidebar had a chance to update + find('#notification #btn-reply') # wait for notification to show, so that we know the sidebar had a chance to update end it_behaves_like :notification_badge, highlighted: false, count:0 @@ -88,7 +88,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f document_blur notification = Notification.send_text_message("text message 2", user2, user) notification.errors.any?.should be_false - find('#notification #ok-button') + find('#notification #btn-reply') end it_behaves_like :notification_badge, highlighted: true, count:1 @@ -157,7 +157,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f badge = find("#{NOTIFICATION_PANEL} .badge", text: '1') badge['class'].include?('highlighted').should == true - find('#notification #ok-button', text: 'ACCEPT').trigger(:click) + find('#notification #btn-reply', text: 'ACCEPT').trigger(:click) badge = find("#{NOTIFICATION_PANEL} .badge", text: '0') badge['class'].include?('highlighted').should == false diff --git a/web/spec/features/production_spec.rb b/web/spec/features/production_spec.rb index 152bb94bc..3e96f53d0 100644 --- a/web/spec/features/production_spec.rb +++ b/web/spec/features/production_spec.rb @@ -73,7 +73,7 @@ describe "Production site at #{www}", :test_www => true, :js => true, :type => expect(page).to have_xpath( "//div[@class='friend-name' and @user-id='#{user2.id}']/span[@class='friend-status']", :text => "Available" ) - find('#notification #ok-button').trigger(:click) + find('#notification #btn-reply').trigger(:click) find('h1', text: 'conversation with ' + user2.name) find('.previous-message-text', text: test_message) send_text_message(test_response, close_on_send: true) diff --git a/web/spec/features/text_message_spec.rb b/web/spec/features/text_message_spec.rb index 517b135da..e5f947450 100644 --- a/web/spec/features/text_message_spec.rb +++ b/web/spec/features/text_message_spec.rb @@ -68,7 +68,7 @@ describe "Text Message", :js => true, :type => :feature, :capybara_feature => tr end in_client(@user1) do - find('#notification #ok-button').trigger(:click) + find('#notification #btn-reply').trigger(:click) find('h1', text: 'conversation with ' + @user2.name) end end @@ -101,7 +101,7 @@ describe "Text Message", :js => true, :type => :feature, :capybara_feature => tr end in_client(@user1) do - find('#notification #ok-button').trigger(:click) + find('#notification #btn-reply').trigger(:click) find('h1', text: 'conversation with ' + @user2.name) find('.previous-message-text', text: "Oh hai to user id #{@user1.id}") send_text_message('hey there yourself') @@ -110,7 +110,6 @@ describe "Text Message", :js => true, :type => :feature, :capybara_feature => tr in_client(@user2) do find('.previous-message-text', text: "hey there yourself") send_text_message('ok bye', close_on_send: true) - end in_client(@user1) do