Commit 89ca2e3a authored by Manoj M J's avatar Manoj M J

Fix updating emails for group notifications

This MR fixes the bug that causes
404 error while trying to update
email for group notifications.

Changelog: fixed
parent b3f5e1e5
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
.js-vue-notification-dropdown{ data: { disabled: emails_disabled.to_s, dropdown_items: notification_dropdown_items(setting).to_json, notification_level: setting.level, group_id: group.id, container_class: 'gl-mr-3', show_label: "true" } } .js-vue-notification-dropdown{ data: { disabled: emails_disabled.to_s, dropdown_items: notification_dropdown_items(setting).to_json, notification_level: setting.level, group_id: group.id, container_class: 'gl-mr-3', show_label: "true" } }
.table-section.section-30 .table-section.section-30
= form_for setting, url: profile_notifications_group_path(group), method: :put, html: { class: 'update-notifications gl-display-flex' } do |f| = form_for setting, url: profile_group_notifications_path(group), method: :put, html: { class: 'update-notifications gl-display-flex' } do |f|
= f.select :notification_email, @user.public_verified_emails, { include_blank: 'Global notification email' }, class: 'select2 js-group-notification-email' = f.select :notification_email, @user.public_verified_emails, { include_blank: 'Global notification email' }, class: 'select2 js-group-notification-email'
...@@ -22,7 +22,14 @@ resource :profile, only: [:show, :update] do ...@@ -22,7 +22,14 @@ resource :profile, only: [:show, :update] do
end end
resource :notifications, only: [:show, :update] do resource :notifications, only: [:show, :update] do
resources :groups, only: :update, constraints: { id: Gitlab::PathRegex.full_namespace_route_regex } scope(path: 'groups/*id',
id: Gitlab::PathRegex.full_namespace_route_regex,
as: :group,
controller: :groups,
constraints: { format: /(html|json)/ }) do
patch '/', action: :update
put '/', action: :update
end
end end
resource :password, only: [:new, :create, :edit, :update] do resource :password, only: [:new, :create, :edit, :update] do
......
...@@ -12,7 +12,8 @@ RSpec.describe "notifications routing" do ...@@ -12,7 +12,8 @@ RSpec.describe "notifications routing" do
end end
it 'routes to group #update' do it 'routes to group #update' do
expect(put("/-/profile/notifications/groups/gitlab-org")).to route_to("profiles/groups#update", id: 'gitlab-org') expect(put("/-/profile/groups/gitlab-org/notifications")).to route_to("profiles/groups#update", id: 'gitlab-org')
expect(put("/-/profile/notifications/groups/gitlab.org")).to route_to("profiles/groups#update", id: 'gitlab.org') expect(put("/-/profile/groups/gitlab.org/notifications/")).to route_to("profiles/groups#update", id: 'gitlab.org')
expect(put("/-/profile/groups/gitlab.org/gitlab/notifications")).to route_to("profiles/groups#update", id: 'gitlab.org/gitlab')
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