Commit 179783f1 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'notification-dropdown-active-fix' into 'master'

Fixed issue with notification dropdown not updating active

## What does this MR do?

This fixes an issue where the notification dropdown wouldn't correctly update the selected notification type in the dropdown. I've also added a spinner to show the action is happening & removed the flash message for success.

## What are the relevant issue numbers?

Closes #18480 

## Screenshots (if relevant)

![notifications](/uploads/5ed5055d180c12450cea77543ae5f44e/notifications.gif)

See merge request !4615
parents 15a87f31 62d16e51
class @NotificationsDropdown class @NotificationsDropdown
$ -> constructor: ->
$(document) $(document)
.off 'click', '.update-notification' .off 'click', '.update-notification'
.on 'click', '.update-notification', (e) -> .on 'click', '.update-notification', (e) ->
...@@ -18,7 +18,8 @@ class @NotificationsDropdown ...@@ -18,7 +18,8 @@ class @NotificationsDropdown
.off 'ajax:success', '.notification-form' .off 'ajax:success', '.notification-form'
.on 'ajax:success', '.notification-form', (e, data) -> .on 'ajax:success', '.notification-form', (e, data) ->
if data.saved if data.saved
new Flash('Notification settings saved', 'notice') $(e.currentTarget)
$(e.currentTarget).closest('.notification-dropdown').replaceWith(data.html) .closest('.notification-dropdown')
.replaceWith(data.html)
else else
new Flash('Failed to save new settings', 'alert') new Flash('Failed to save new settings', 'alert')
...@@ -35,7 +35,6 @@ class @Project ...@@ -35,7 +35,6 @@ class @Project
$(@).parents('.no-password-message').remove() $(@).parents('.no-password-message').remove()
e.preventDefault() e.preventDefault()
@projectSelectDropdown() @projectSelectDropdown()
projectSelectDropdown: -> projectSelectDropdown: ->
......
...@@ -101,7 +101,8 @@ ...@@ -101,7 +101,8 @@
.notifications-btn { .notifications-btn {
.fa-bell { .fa-bell,
.fa-spinner {
margin-right: 6px; margin-right: 6px;
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
= label_tag :global_notification_level, "Global notification level", class: "label-light" = label_tag :global_notification_level, "Global notification level", class: "label-light"
%br %br
.clearfix .clearfix
.form-group.pull-left .form-group.pull-left.global-notification-setting
= render 'shared/notifications/button', notification_setting: @global_notification_setting, left_align: true = render 'shared/notifications/button', notification_setting: @global_notification_setting, left_align: true
.clearfix .clearfix
......
...@@ -15,8 +15,6 @@ class Spinach::Features::ProfileNotifications < Spinach::FeatureSteps ...@@ -15,8 +15,6 @@ class Spinach::Features::ProfileNotifications < Spinach::FeatureSteps
end end
step 'I should see Notification saved message' do step 'I should see Notification saved message' do
page.within '.flash-container' do expect(page).to have_content 'On mention'
expect(page).to have_content 'Notification settings saved'
end
end end
end end
...@@ -134,8 +134,8 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -134,8 +134,8 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end end
step 'I should see Notification saved message' do step 'I should see Notification saved message' do
page.within '.flash-container' do page.within '#notifications-button' do
expect(page).to have_content 'Notification settings saved' expect(page).to have_content 'On mention'
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment