diff --git a/app/controllers/admin/settings/notifications_settings_controller.rb b/app/controllers/admin/settings/aggregation_settings_controller.rb similarity index 92% rename from app/controllers/admin/settings/notifications_settings_controller.rb rename to app/controllers/admin/settings/aggregation_settings_controller.rb index 694742c54a..fb87cf4a01 100644 --- a/app/controllers/admin/settings/notifications_settings_controller.rb +++ b/app/controllers/admin/settings/aggregation_settings_controller.rb @@ -27,7 +27,7 @@ #++ module Admin::Settings - class NotificationsSettingsController < ::Admin::SettingsController + class AggregationSettingsController < ::Admin::SettingsController current_menu_item [:show] do :notification_settings end @@ -37,7 +37,7 @@ module Admin::Settings end def default_breadcrumb - t(:'menus.admin.incoming_outgoing') + t(:'menus.admin.aggregation_and_retention') end def show_local_breadcrumb diff --git a/app/controllers/admin/settings/api_settings_controller.rb b/app/controllers/admin/settings/api_settings_controller.rb index ab4371803b..e7233cbe0a 100644 --- a/app/controllers/admin/settings/api_settings_controller.rb +++ b/app/controllers/admin/settings/api_settings_controller.rb @@ -28,7 +28,7 @@ module Admin::Settings class APISettingsController < ::Admin::SettingsController - menu_item :settings_api + menu_item :api def default_breadcrumb t(:label_api_access_key_type) diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index 10417dd1da..acf0a3dd33 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -54,11 +54,6 @@ module SettingsHelper controller: '/admin/settings/attachments_settings', label: :'attributes.attachments' }, - { - name: 'api', - controller: '/admin/settings/api_settings', - label: :label_api_access_key_type - }, { name: 'repositories', controller:'/admin/settings/repositories_settings', diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb index 5eec47a1ab..6e5e694aa6 100644 --- a/app/views/admin/index.html.erb +++ b/app/views/admin/index.html.erb @@ -34,7 +34,7 @@ See COPYRIGHT and LICENSE files for more details.
+ <%= t('webhooks.outgoing.explanation.text', + link: link_to(t(:'webhooks.outgoing.explanation.link'), admin_settings_aggregation_path, target: '_blank')).html_safe %> +
+ <%= rails_cell ::Webhooks::Outgoing::Webhooks::TableCell, @webhooks %> diff --git a/modules/webhooks/config/locales/en.yml b/modules/webhooks/config/locales/en.yml index 0df7114387..cf795fc926 100644 --- a/modules/webhooks/config/locales/en.yml +++ b/modules/webhooks/config/locales/en.yml @@ -27,6 +27,11 @@ en: events: created: "Created" updated: "Updated" + explanation: + text: > + Upon the occurrence of an event like the creation of a work package or an update on a project, OpenProject will send a POST request to the configured web endpoints. + Oftentimes, the event is sent after the %{link} has passed. + link: configured aggregation period status: enabled: 'Webhook is enabled' disabled: 'Webhook is disabled' diff --git a/modules/webhooks/config/routes.rb b/modules/webhooks/config/routes.rb index 500cf86bcd..eebea808f6 100644 --- a/modules/webhooks/config/routes.rb +++ b/modules/webhooks/config/routes.rb @@ -32,9 +32,11 @@ OpenProject::Application.routes.draw do end scope 'admin' do - resources :webhooks, - param: :webhook_id, - controller: 'webhooks/outgoing/admin', - as: 'admin_outgoing_webhooks' + scope :settings do + resources :webhooks, + param: :webhook_id, + controller: 'webhooks/outgoing/admin', + as: 'admin_outgoing_webhooks' + end end end diff --git a/modules/webhooks/lib/open_project/webhooks/engine.rb b/modules/webhooks/lib/open_project/webhooks/engine.rb index 2a38fc73b4..5cce8e5b45 100644 --- a/modules/webhooks/lib/open_project/webhooks/engine.rb +++ b/modules/webhooks/lib/open_project/webhooks/engine.rb @@ -41,14 +41,8 @@ module OpenProject::Webhooks :plugin_webhooks, { controller: 'webhooks/outgoing/admin', action: :index }, if: Proc.new { User.current.admin? }, - parent: :in_out, - caption: ->(*) { I18n.t('webhooks.plural') } - end - - config.before_configuration do |app| - # This is required for the routes to be loaded first as the routes should - # be prepended so they take precedence over the core. - app.config.paths['config/routes.rb'].unshift File.join(File.dirname(__FILE__), "..", "..", "..", "config", "routes.rb") + parent: :api_and_webhooks, + caption: :'webhooks.plural' end initializer 'webhooks.subscribe_to_notifications' do diff --git a/modules/webhooks/spec/routing/webhooks/outgoing/admin_controller_spec.rb b/modules/webhooks/spec/routing/webhooks/outgoing/admin_controller_spec.rb index 87f1e8117b..be63a153a0 100644 --- a/modules/webhooks/spec/routing/webhooks/outgoing/admin_controller_spec.rb +++ b/modules/webhooks/spec/routing/webhooks/outgoing/admin_controller_spec.rb @@ -30,34 +30,34 @@ require 'spec_helper' describe 'Outgoing webhooks administration', type: :routing do it 'route to index' do - expect(get('/admin/webhooks')).to route_to('webhooks/outgoing/admin#index') + expect(get('/admin/settings/webhooks')).to route_to('webhooks/outgoing/admin#index') end it 'route to new' do - expect(get('/admin/webhooks/new')).to route_to('webhooks/outgoing/admin#new') + expect(get('/admin/settings/webhooks/new')).to route_to('webhooks/outgoing/admin#new') end it 'route to show' do - expect(get('/admin/webhooks/1')).to route_to(controller: 'webhooks/outgoing/admin', - action: 'show', - webhook_id: '1') + expect(get('/admin/settings/webhooks/1')).to route_to(controller: 'webhooks/outgoing/admin', + action: 'show', + webhook_id: '1') end it 'route to edit' do - expect(get('/admin/webhooks/1/edit')).to route_to(controller: 'webhooks/outgoing/admin', - action: 'edit', - webhook_id: '1') + expect(get('/admin/settings/webhooks/1/edit')).to route_to(controller: 'webhooks/outgoing/admin', + action: 'edit', + webhook_id: '1') end it 'route to PUT update' do - expect(put('/admin/webhooks/1')).to route_to(controller: 'webhooks/outgoing/admin', - action: 'update', - webhook_id: '1') + expect(put('/admin/settings/webhooks/1')).to route_to(controller: 'webhooks/outgoing/admin', + action: 'update', + webhook_id: '1') end it 'route to DELETE destroy' do - expect(delete('/admin/webhooks/1')).to route_to(controller: 'webhooks/outgoing/admin', - action: 'destroy', - webhook_id: '1') + expect(delete('/admin/settings/webhooks/1')).to route_to(controller: 'webhooks/outgoing/admin', + action: 'destroy', + webhook_id: '1') end end diff --git a/spec/features/users/edit_users_spec.rb b/spec/features/users/edit_users_spec.rb index 1d4e78f145..4ef2d8850e 100644 --- a/spec/features/users/edit_users_spec.rb +++ b/spec/features/users/edit_users_spec.rb @@ -92,7 +92,7 @@ describe 'edit users', type: :feature, js: true do visit edit_user_path(user) expect(page).to have_no_selector('.admin-overview-menu-item', text: 'Overview') - expect(page).to have_no_selector('.users-and-permissions-menu-item', text: 'Users & Permissions') + expect(page).to have_no_selector('.users-and-permissions-menu-item', text: 'Users and permissions') expect(page).to have_selector('.users-menu-item.selected', text: 'Users') expect(page).to have_selector 'select#user_auth_source_id'