diff --git a/web/app/assets/javascripts/findMusician.js b/web/app/assets/javascripts/findMusician.js index 8b0596154..a266cabc0 100644 --- a/web/app/assets/javascripts/findMusician.js +++ b/web/app/assets/javascripts/findMusician.js @@ -310,6 +310,7 @@ evt.stopPropagation(); var uid = $(this).parent().data('musician-id'); rest.sendFriendRequest(app, uid, friendRequestCallback); + return false; } function friendRequestCallback(user_id) { diff --git a/web/app/assets/javascripts/jam_rest.js b/web/app/assets/javascripts/jam_rest.js index cb17f10da..26a6fbfdf 100644 --- a/web/app/assets/javascripts/jam_rest.js +++ b/web/app/assets/javascripts/jam_rest.js @@ -1152,7 +1152,7 @@ processData: false, success: function (response) { if (callback) { - callback(userId); + callback(userId, app); } context.JK.GA.trackFriendConnect(context.JK.GA.FriendConnectTypes.request); }, diff --git a/web/app/assets/javascripts/member_search_filter.js.coffee b/web/app/assets/javascripts/member_search_filter.js.coffee index 357806ebc..1f96f9df9 100644 --- a/web/app/assets/javascripts/member_search_filter.js.coffee +++ b/web/app/assets/javascripts/member_search_filter.js.coffee @@ -445,16 +445,20 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter extends BaseSearchF _bindFriendMusician: () => objThis = this + callback = this.friendRequestCallback @screen.find('.search-m-friend').on 'click', (evt) -> # if the musician is already a friend, remove the button-orange class, and prevent the link from working + console.log("friend request connected") if 0 == $(this).closest('.button-orange').size() + console.log("friend request bail out") return false $(this).click (ee) -> ee.preventDefault() - return + return false evt.stopPropagation() uid = $(this).parent().data('musician-id') - objThis.rest.sendFriendRequest objThis.app, uid, this.friendRequestCallback + objThis.rest.sendFriendRequest(objThis.app, uid, callback) + return false _bindFollowMusician: () => objThis = this @@ -493,8 +497,9 @@ context.JK.MusicianSearchFilter = class MusicianSearchFilter extends BaseSearchF else 'Location Unavailable' - friendRequestCallback: (user_id)=> - # TODO: + friendRequestCallback: (user_id, app)=> + $('div[data-musician-id=' + user_id + '] .search-m-friend').removeClass('button-orange').addClass('button-grey'); + app.notify({title: 'Friend Request Sent', text: 'Your friend request has been sent! They have to approve to become friends.'}); paginate: () => super() diff --git a/web/app/assets/javascripts/notificationPanel.js b/web/app/assets/javascripts/notificationPanel.js index 121caa43e..2cd252382 100644 --- a/web/app/assets/javascripts/notificationPanel.js +++ b/web/app/assets/javascripts/notificationPanel.js @@ -94,6 +94,11 @@ } function onNotificationOccurred(payload) { + + incrementNotificationCount(); + highlightCount(); + + if(userCanSeeNotifications(payload)) { app.updateNotificationSeen(payload.notification_id, payload.created_at); } @@ -105,8 +110,6 @@ } else { queueNotificationSeen(payload.notification_id, payload.created_at, payload.description); - highlightCount(); - incrementNotificationCount(); missedNotificationsWhileAway = true; } } diff --git a/web/app/assets/javascripts/searchResults.js b/web/app/assets/javascripts/searchResults.js index 28ed57fc0..bf9461622 100644 --- a/web/app/assets/javascripts/searchResults.js +++ b/web/app/assets/javascripts/searchResults.js @@ -215,7 +215,7 @@ if ($btn.is('.disabled')) { logger.debug("ignoring send friend request on disabled btn") - return; + return false; } var userId = $btn.parent().attr('user-id'); @@ -232,7 +232,7 @@ app.notify({title: 'Friend Request Sent', text: 'Your friend request has been sent'}) $btn.addClass('disabled') }) - + return false; } } diff --git a/web/app/assets/stylesheets/client/content.scss b/web/app/assets/stylesheets/client/content.scss index 010ca0cd9..4590d788e 100644 --- a/web/app/assets/stylesheets/client/content.scss +++ b/web/app/assets/stylesheets/client/content.scss @@ -181,7 +181,7 @@ > a.smallbutton { margin: 4px; &.button-grey { - display:none; // @FIXME VRFS-930 / VRFS-931 per comment from David - don't show. + //display:none; // @FIXME VRFS-930 / VRFS-931 per comment from David - don't show. } } } diff --git a/web/spec/features/notification_highlighter_spec.rb b/web/spec/features/notification_highlighter_spec.rb index 9da87c8dd..187c2a22b 100644 --- a/web/spec/features/notification_highlighter_spec.rb +++ b/web/spec/features/notification_highlighter_spec.rb @@ -47,7 +47,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f notification.errors.any?.should be false end - it_behaves_like :notification_badge, highlighted: false, count:0, action: :click + it_behaves_like :notification_badge, highlighted: true, count:1, action: :click end describe "document out of focus" do @@ -83,7 +83,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f 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 + it_behaves_like :notification_badge, highlighted: true, count:1 end describe "document out of focus" do @@ -150,9 +150,7 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f JamRuby::Score.connection.execute('delete from current_network_scores').check JamRuby::Score.createx(1, 'a', 1, 2, 'b', 2, 10) - in_client(user) do - sign_in_poltergeist(user) - end + sign_in_poltergeist(user) in_client(user2) do sign_in_poltergeist(user2) @@ -160,15 +158,14 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f find(".result-list-button-wrapper[data-musician-id='#{user.id}'] .search-m-friend").click end - in_client(user) do - badge = find("#{NOTIFICATION_PANEL} .badge", text: '1') - badge['class'].include?('highlighted').should == true - find('#notification #btn-accept', text: 'ACCEPT').trigger(:click) + badge = find("#{NOTIFICATION_PANEL} .badge", text: '1') + badge['class'].include?('highlighted').should == true - badge = find("#{NOTIFICATION_PANEL} .badge", text: '0') - badge['class'].include?('highlighted').should == false - end + find('#notification #btn-accept', text: 'ACCEPT').click + + badge = find("#{NOTIFICATION_PANEL} .badge", text: '0') + badge['class'].include?('highlighted').should == false end end end diff --git a/web/spec/spec_helper.rb b/web/spec/spec_helper.rb index b4a869629..43ccb3fc3 100644 --- a/web/spec/spec_helper.rb +++ b/web/spec/spec_helper.rb @@ -88,10 +88,10 @@ Thread.new do JamWebsockets::Server.new.run( :port => 6759, :emwebsocket_debug => false, - :connect_time_stale_client => 4, - :connect_time_expire_client => 6, - :connect_time_stale_browser => 4, - :connect_time_expire_browser => 6, + :connect_time_stale_client => 80, + :connect_time_expire_client => 120, + :connect_time_stale_browser => 80, + :connect_time_expire_browser => 120, :max_connections_per_user => 20, :rabbitmq_host => '127.0.0.1', :rabbitmq_port => 5672, diff --git a/web/spec/support/utilities.rb b/web/spec/support/utilities.rb index b0e1569e6..be5bdc431 100644 --- a/web/spec/support/utilities.rb +++ b/web/spec/support/utilities.rb @@ -46,12 +46,12 @@ end # in place of ever using Capybara.session_name directly, # this utility is used to handle the mapping of session names in a way across all tests runs -def in_client(name) +def in_client(name, &blk) session_name = name.class == JamRuby::User ? name.id : name - Capybara.session_name = mapped_session_name(session_name) + #Capybara.session_name = mapped_session_name(session_name) - yield + Capybara.using_session(session_name, &blk) end