diff --git a/app/controllers/webhooks_controller.rb b/app/controllers/webhooks_controller.rb
index 98ebe07fa..eb6e4b806 100644
--- a/app/controllers/webhooks_controller.rb
+++ b/app/controllers/webhooks_controller.rb
@@ -4,6 +4,7 @@ class WebhooksController < ApplicationController
self.main_menu = false
before_action :require_login
+ before_action :check_enabled
before_action :authorize
before_action :find_webhook, only: [:edit, :update, :destroy]
@@ -62,4 +63,8 @@ class WebhooksController < ApplicationController
def authorize
deny_access unless User.current.allowed_to?(:use_webhooks, nil, global: true)
end
+
+ def check_enabled
+ render_403 unless Webhook.enabled?
+ end
end
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index 0bec658a4..85eac4a37 100644
--- a/app/helpers/settings_helper.rb
+++ b/app/helpers/settings_helper.rb
@@ -25,7 +25,7 @@ module SettingsHelper
{:name => 'display', :partial => 'settings/display', :label => :label_display},
{:name => 'authentication', :partial => 'settings/authentication',
:label => :label_authentication},
- {:name => 'api', :partial => 'settings/api', :label => :label_api},
+ {:name => 'integrations', :partial => 'settings/api', :label => :label_integrations},
{:name => 'projects', :partial => 'settings/projects', :label => :label_project_plural},
{:name => 'users', :partial => 'settings/users', :label => :label_user_plural},
{:name => 'issues', :partial => 'settings/issues', :label => :label_issue_tracking},
diff --git a/app/models/webhook.rb b/app/models/webhook.rb
index dd18f579e..51dffa1f5 100644
--- a/app/models/webhook.rb
+++ b/app/models/webhook.rb
@@ -42,9 +42,15 @@ class Webhook < ApplicationRecord
before_validation ->(hook){ hook.projects = hook.projects.to_a & hook.setable_projects }
+ def self.enabled?
+ Setting.webhooks_enabled?
+ end
+
# Triggers the given event for the given object, scheduling qualifying hooks
# to be called.
def self.trigger(event, object)
+ return unless enabled?
+
hooks_for(event, object).each do |hook|
payload = hook.payload(event, object)
WebhookJob.perform_later(hook.id, payload.to_json)
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb
index b516dd842..4073a3a0c 100644
--- a/app/views/my/account.html.erb
+++ b/app/views/my/account.html.erb
@@ -1,7 +1,7 @@
<%= additional_emails_link(@user) %>
<%= link_to(sprite_icon('key', l(:button_change_password)), { :action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %>
-<%= link_to sprite_icon('webhook', l(:label_webhook_plural)), webhooks_path, class: 'icon icon-webhook' if @user.allowed_to?(:use_webhooks, nil, global: true) %>
+<%= link_to sprite_icon('webhook', l(:label_webhook_plural)), webhooks_path, class: 'icon icon-webhook' if Webhook.enabled? && @user.allowed_to?(:use_webhooks, nil, global: true) %>
<%= link_to(sprite_icon('apps', l('label_oauth_authorized_application_plural')), oauth_authorized_applications_path, :class => 'icon icon-applications') if Setting.rest_api_enabled? %>
<%= call_hook(:view_my_account_contextual, :user => @user)%>
diff --git a/app/views/settings/_api.html.erb b/app/views/settings/_api.html.erb
index 6ee401037..3fb584ef9 100644
--- a/app/views/settings/_api.html.erb
+++ b/app/views/settings/_api.html.erb
@@ -1,9 +1,11 @@
-<%= form_tag({:action => 'edit', :tab => 'api'}) do %>
+<%= form_tag({:action => 'edit', :tab => 'integrations'}) do %>
<%= setting_check_box :rest_api_enabled %>
<%= setting_check_box :jsonp_enabled %>
+
+
<%= setting_check_box :webhooks_enabled %>
<%= submit_tag l(:button_save) %>
diff --git a/config/locales/ar.yml b/config/locales/ar.yml
index 8aae80c97..d9ea0b9a7 100644
--- a/config/locales/ar.yml
+++ b/config/locales/ar.yml
@@ -1148,7 +1148,7 @@ ar:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/az.yml b/config/locales/az.yml
index e1f64c888..da31f8121 100644
--- a/config/locales/az.yml
+++ b/config/locales/az.yml
@@ -1239,7 +1239,7 @@ az:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/bg.yml b/config/locales/bg.yml
index a5f3bee7f..026fbd2a3 100644
--- a/config/locales/bg.yml
+++ b/config/locales/bg.yml
@@ -1117,7 +1117,7 @@ bg:
label_relations_mapping: Съответствие между релациите
label_file_content_preview: Предварителен преглед на съдържанието на файла
label_create_missing_values: Създаване на липсващи стойности
- label_api: API
+ label_integrations: Integrations
label_field_format_enumeration: Списък ключ/стойност
label_default_values_for_new_users: Стойности по подразбиране за нови потребители
label_relations: Релации
diff --git a/config/locales/bs.yml b/config/locales/bs.yml
index f9e0f5838..32316df3e 100644
--- a/config/locales/bs.yml
+++ b/config/locales/bs.yml
@@ -1149,7 +1149,7 @@ bs:
label_create_missing_values: Kreiraj nedostajuće vrijednosti
button_import: Import
field_total_estimated_hours: Ukupno procijenjeno vrijeme
- label_api: API
+ label_integrations: Integrations
label_total_plural: Ukupno
label_assigned_issues: Dodijeljeni tiketi
label_field_format_enumeration: Lista ključ/vrijednost
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index 719f5ebd0..a09c99ea0 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -1143,7 +1143,7 @@ ca:
label_create_missing_values: "Crear valors no presents"
button_import: "Importar"
field_total_estimated_hours: "Temps total estimat"
- label_api: "API"
+ label_integrations: Integrations
label_total_plural: "Totals"
label_assigned_issues: "Incidències assignades"
label_field_format_enumeration: "Llistat clau/valor"
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index cf65f5bcd..e3a5bdc33 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -1147,7 +1147,7 @@ cs:
label_create_missing_values: Vytvořit chybějící hodnoty
button_import: Import
field_total_estimated_hours: Celkový odhadovaný čas
- label_api: API
+ label_integrations: Integrations
label_total_plural: Celkem
label_assigned_issues: Přiřazené úkoly
label_field_format_enumeration: Seznam klíčů/hodnot
diff --git a/config/locales/da.yml b/config/locales/da.yml
index ac4b52bb7..5f43f4f01 100644
--- a/config/locales/da.yml
+++ b/config/locales/da.yml
@@ -1165,7 +1165,7 @@ da:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/de.yml b/config/locales/de.yml
index ac4d24971..4b1b7bdc6 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -1220,7 +1220,7 @@ de:
label_create_missing_values: Ergänze fehlende Werte
button_import: Importieren
field_total_estimated_hours: Summe des geschätzten Aufwands
- label_api: API
+ label_integrations: Integrations
label_total_plural: Summe
label_assigned_issues: Zugewiesene Tickets
label_field_format_enumeration: Eigenschaft/Wert-Paare
diff --git a/config/locales/el.yml b/config/locales/el.yml
index 089958d0f..96e18b393 100644
--- a/config/locales/el.yml
+++ b/config/locales/el.yml
@@ -1148,7 +1148,7 @@ el:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml
index c99e772b5..b95865ee7 100644
--- a/config/locales/en-GB.yml
+++ b/config/locales/en-GB.yml
@@ -1155,7 +1155,7 @@ en-GB:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e8ab8cd25..fe2ca7c30 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -505,6 +505,7 @@ en:
setting_thumbnails_size: Thumbnails size (in pixels)
setting_non_working_week_days: Non-working days
setting_jsonp_enabled: Enable JSONP support
+ setting_webhooks_enabled: Enable Webhooks
setting_default_projects_tracker_ids: Default trackers for new projects
setting_mail_handler_excluded_filenames: Exclude attachments by name
setting_force_default_language_for_anonymous: Force default language for anonymous users
@@ -1124,7 +1125,7 @@ en:
label_create_missing_values: Create missing values
label_position: Position
label_message: Message
- label_api: API
+ label_integrations: Integrations
label_field_format_enumeration: Key/value list
label_default_values_for_new_users: Default values for new users
label_relations: Relations
@@ -1182,7 +1183,7 @@ en:
webhook_events_issue_updated: Issue updated
webhook_events_issue_deleted: Issue deleted
webhook_url_info: Redmine will send a POST request to this URL whenever one of the selected events occurs in one of the selected projects.
- webhook_secret_info_html: If provided, Redmine will use this to create a hash signature that is sent with each delivery as the value of the X-Redmine-Signature-256 header.
+ webhook_secret_info_html: If provided, Redmine will use this to create a hash signature that is sent with each delivery as the value of the X-Redmine-Signature-256 header.
button_login: Login
button_submit: Submit
diff --git a/config/locales/es-PA.yml b/config/locales/es-PA.yml
index 4b4827349..a588bfba5 100644
--- a/config/locales/es-PA.yml
+++ b/config/locales/es-PA.yml
@@ -1184,7 +1184,7 @@ es-PA:
label_create_missing_values: Crear valores no presentes
button_import: Importar
field_total_estimated_hours: Total de Tiempo Estimado
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totales
label_assigned_issues: Incidencias Asignadas
label_field_format_enumeration: Lista Llave/valor
diff --git a/config/locales/es.yml b/config/locales/es.yml
index a4aa2dab7..3bcda7c2f 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -1182,7 +1182,7 @@ es:
label_create_missing_values: Crear valores no presentes
button_import: Importar
field_total_estimated_hours: Total de Tiempo Estimado
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totales
label_assigned_issues: Peticiones Asignadas
label_field_format_enumeration: Lista Llave/valor
diff --git a/config/locales/et.yml b/config/locales/et.yml
index b1ca9f248..ab6e0eb27 100644
--- a/config/locales/et.yml
+++ b/config/locales/et.yml
@@ -1153,7 +1153,7 @@ et:
label_create_missing_values: "Loo puuduolevad väärtused"
button_import: "Import"
field_total_estimated_hours: "Ennustatud aja summa"
- label_api: "API"
+ label_integrations: Integrations
label_total_plural: "Summad"
label_assigned_issues: "Määratud väärtused"
label_field_format_enumeration: "Võtme/väärtuse nimekiri"
diff --git a/config/locales/eu.yml b/config/locales/eu.yml
index 5f6229b2e..319563299 100644
--- a/config/locales/eu.yml
+++ b/config/locales/eu.yml
@@ -1149,7 +1149,7 @@ eu:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/fa.yml b/config/locales/fa.yml
index e139004d8..c5cc017a0 100644
--- a/config/locales/fa.yml
+++ b/config/locales/fa.yml
@@ -1110,7 +1110,7 @@ fa:
label_relations_mapping: نگاشت ارتباطات
label_file_content_preview: نمایش محتویات بخش
label_create_missing_values: ساختن مقادیر ناموجود
- label_api: API
+ label_integrations: Integrations
label_field_format_enumeration: فهرست کلید/مقدار
label_default_values_for_new_users: مقادیر پیشفرض برای کاربران جدید
label_relations: ارتباطات
diff --git a/config/locales/fi.yml b/config/locales/fi.yml
index 5f1634aa2..73b1af6c1 100644
--- a/config/locales/fi.yml
+++ b/config/locales/fi.yml
@@ -1166,7 +1166,7 @@ fi:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 6807ed9da..d59bd9208 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -1005,7 +1005,7 @@ fr:
label_fields_mapping: Correspondance des champs
label_file_content_preview: Aperçu du contenu du fichier
label_create_missing_values: Créer les valeurs manquantes
- label_api: API
+ label_integrations: Integrations
label_field_format_enumeration: Liste clé/valeur
label_default_values_for_new_users: Valeurs par défaut pour les nouveaux utilisateurs
label_relations: Relations
diff --git a/config/locales/gl.yml b/config/locales/gl.yml
index 5cc6a7a1f..45d388019 100644
--- a/config/locales/gl.yml
+++ b/config/locales/gl.yml
@@ -1157,7 +1157,7 @@ gl:
label_create_missing_values: Crear valores non presentes
button_import: Importar
field_total_estimated_hours: Total de tempo estimado
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totais
label_assigned_issues: Peticións asignadas
label_field_format_enumeration: Listaxe chave/valor
diff --git a/config/locales/he.yml b/config/locales/he.yml
index 019176bab..b8831dbb3 100644
--- a/config/locales/he.yml
+++ b/config/locales/he.yml
@@ -1153,7 +1153,7 @@ he:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/hr.yml b/config/locales/hr.yml
index 2e1541a7a..b434fc60a 100644
--- a/config/locales/hr.yml
+++ b/config/locales/hr.yml
@@ -1145,7 +1145,7 @@ hr:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index 3bd3517bd..f5b8040dd 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -1154,7 +1154,7 @@
label_create_missing_values: Hiányzó értékek létrehozása
button_import: Importálás
field_total_estimated_hours: Összes becsült óra
- label_api: API
+ label_integrations: Integrations
label_total_plural: Összesítések
label_assigned_issues: Neki kiosztott feladatok
label_field_format_enumeration: Értékpár-lista
diff --git a/config/locales/id.yml b/config/locales/id.yml
index 1fd49a338..e4c65d098 100644
--- a/config/locales/id.yml
+++ b/config/locales/id.yml
@@ -1150,7 +1150,7 @@ id:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/it.yml b/config/locales/it.yml
index ec096c0f6..501e60fc4 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -1121,7 +1121,7 @@ it:
label_relations_mapping: Mappatura delle relazioni
label_file_content_preview: Anteprima del contenuto del file
label_create_missing_values: Crea valori mancanti
- label_api: API
+ label_integrations: Integrations
label_field_format_enumeration: Elenco chiave/valore
label_default_values_for_new_users: Valori predefiniti per i nuovi utenti
label_relations: Relazioni
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index d331bee3c..848522c5d 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -1090,6 +1090,7 @@ ja:
permission_edit_documents: 文書の編集
permission_delete_documents: 文書の削除
setting_jsonp_enabled: JSONPを有効にする
+ setting_webhooks_enabled: Webhooksを有効にする
field_inherit_members: メンバーを継承
field_closed_on: 終了日
field_generate_password: パスワードを自動生成
@@ -1177,7 +1178,7 @@ ja:
label_message: メッセージ
button_import: インポート
field_total_estimated_hours: 合計予定工数
- label_api: API
+ label_integrations: 連携
label_total_plural: 合計
label_assigned_issues: 担当しているチケット
label_field_format_enumeration: キー・バリュー リスト
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index f7ada81d2..da9e917c2 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -1183,7 +1183,7 @@ ko:
label_create_missing_values: 값이 없으면 자동으로 만들기
button_import: 가져오기
field_total_estimated_hours: 추정 시간
- label_api: API
+ label_integrations: Integrations
label_total_plural: 합계
label_assigned_issues: 할당된 일감
label_field_format_enumeration: 키/값 목록
diff --git a/config/locales/lt.yml b/config/locales/lt.yml
index 1d0a428c2..e84b37ea6 100644
--- a/config/locales/lt.yml
+++ b/config/locales/lt.yml
@@ -973,7 +973,7 @@ lt:
label_fields_mapping: Laukų sujungimas
label_file_content_preview: Failo turinio peržiūra
label_create_missing_values: Sukurti trūkstamas reikšmes
- label_api: API
+ label_integrations: Integrations
label_field_format_enumeration: Raktas/reikšmė sąrašas
label_default_values_for_new_users: Numatytosios reikšmės naujiems vartotojams
diff --git a/config/locales/lv.yml b/config/locales/lv.yml
index fd01d4ad6..ae9996a00 100644
--- a/config/locales/lv.yml
+++ b/config/locales/lv.yml
@@ -1142,7 +1142,7 @@ lv:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/mk.yml b/config/locales/mk.yml
index 35b8af623..eedb23eab 100644
--- a/config/locales/mk.yml
+++ b/config/locales/mk.yml
@@ -1148,7 +1148,7 @@ mk:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/mn.yml b/config/locales/mn.yml
index fc384de80..ed70f8f1b 100644
--- a/config/locales/mn.yml
+++ b/config/locales/mn.yml
@@ -1148,7 +1148,7 @@ mn:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Нийлбэр
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index a25b0f169..a2553ab74 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -1125,7 +1125,7 @@ nl:
label_create_missing_values: Ontbrekende waarden invullen
button_import: Importeren
field_total_estimated_hours: Geschatte totaaltijd
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totalen
label_assigned_issues: Toegewezen issues
label_field_format_enumeration: Sleutel/waarde lijst
diff --git a/config/locales/no.yml b/config/locales/no.yml
index 1269c1c34..be16f5911 100644
--- a/config/locales/no.yml
+++ b/config/locales/no.yml
@@ -1139,7 +1139,7 @@
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index 13e620bc9..35f40f5ce 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -1111,7 +1111,7 @@ pl:
label_relations_mapping: Mapowanie relacji
label_file_content_preview: Podgląd treści pliku
label_create_missing_values: Utwórz brakujące wartości
- label_api: API
+ label_integrations: Integrations
label_field_format_enumeration: "Lista klucz/wartość"
label_default_values_for_new_users: Domyślne wartości dla nowych użytkowników
label_relations: Relacje
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index 967e87fca..e5b9296fb 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -1167,7 +1167,7 @@ pt-BR:
label_create_missing_values: Criar valores em falta
button_import: Importar
field_total_estimated_hours: Tempo estimado geral
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totais
label_assigned_issues: Tarefas atribuídas
label_field_format_enumeration: Chave/Lista de valores
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index 9e1a00ca0..b1bf28cd6 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -1148,7 +1148,7 @@ pt:
label_create_missing_values: Criar os valores em falta
button_import: Importar
field_total_estimated_hours: Total de tempo estimado
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totais
label_assigned_issues: Tarefas atribuídas
label_field_format_enumeration: Lista chave/valor
diff --git a/config/locales/ro.yml b/config/locales/ro.yml
index 94282965b..317ebb96b 100644
--- a/config/locales/ro.yml
+++ b/config/locales/ro.yml
@@ -1143,7 +1143,7 @@ ro:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index b28035520..770bd3132 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -1246,7 +1246,7 @@ ru:
label_create_missing_values: Создать недостающие значения
button_import: Импорт
field_total_estimated_hours: Общая оценка временных затрат
- label_api: API
+ label_integrations: Integrations
label_total_plural: Итоги
label_assigned_issues: Назначенные задачи
label_field_format_enumeration: Список ключ/значение
diff --git a/config/locales/sk.yml b/config/locales/sk.yml
index 2e243cf5f..c5965e9e2 100644
--- a/config/locales/sk.yml
+++ b/config/locales/sk.yml
@@ -1137,7 +1137,7 @@ sk:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index 66e26edce..a3b81dc2c 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -1148,7 +1148,7 @@ sl:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/sq.yml b/config/locales/sq.yml
index b4cba8884..3cd25d3c3 100644
--- a/config/locales/sq.yml
+++ b/config/locales/sq.yml
@@ -1062,7 +1062,7 @@ sq:
label_relations_mapping: Përshoqërim marrëdhëniesh
label_file_content_preview: Paraparje lënde kartele
label_create_missing_values: Krijo vlera që mungojnë
- label_api: API
+ label_integrations: Integrations
label_field_format_enumeration: Listë kyç/vlerë
label_default_values_for_new_users: Vlera parazgjedhje për përdorues të rinj
label_relations: Marrëdhënie
diff --git a/config/locales/sr-YU.yml b/config/locales/sr-YU.yml
index 5da905c8a..07690080e 100644
--- a/config/locales/sr-YU.yml
+++ b/config/locales/sr-YU.yml
@@ -1150,7 +1150,7 @@ sr-YU:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/sr.yml b/config/locales/sr.yml
index 4ad7cb584..02d971b34 100644
--- a/config/locales/sr.yml
+++ b/config/locales/sr.yml
@@ -1149,7 +1149,7 @@ sr:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/sv.yml b/config/locales/sv.yml
index d165ecd88..4d171ec79 100644
--- a/config/locales/sv.yml
+++ b/config/locales/sv.yml
@@ -1178,7 +1178,7 @@ sv:
label_create_missing_values: Skapa saknade värden
button_import: Importera
field_total_estimated_hours: Totalt beräknad tid
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totaler
label_assigned_issues: Tilldelade ärenden
label_field_format_enumeration: Nyckel/värde-lista
diff --git a/config/locales/ta-IN.yml b/config/locales/ta-IN.yml
index 94870bfaa..bb3926ede 100644
--- a/config/locales/ta-IN.yml
+++ b/config/locales/ta-IN.yml
@@ -1153,7 +1153,7 @@ ta-IN:
label_create_missing_values: விடுபட்ட மதிப்புகளை உருவாக்கவும்
button_import: இறக்குமதி
field_total_estimated_hours: மொத்த மதிப்பிடப்பட்ட நேரம்
- label_api: API
+ label_integrations: Integrations
label_total_plural: மொத்தம்
label_assigned_issues: ஒதுக்கப்பட்ட சிக்கல்கள்
label_field_format_enumeration: சாவி / மதிப்பு பட்டியலில்
diff --git a/config/locales/th.yml b/config/locales/th.yml
index 992850c11..def7a373d 100644
--- a/config/locales/th.yml
+++ b/config/locales/th.yml
@@ -1144,7 +1144,7 @@ th:
label_create_missing_values: Create missing values
button_import: Import
field_total_estimated_hours: Total estimated time
- label_api: API
+ label_integrations: Integrations
label_total_plural: Totals
label_assigned_issues: Assigned issues
label_field_format_enumeration: Key/value list
diff --git a/config/locales/tr.yml b/config/locales/tr.yml
index e59d90374..116d594fe 100644
--- a/config/locales/tr.yml
+++ b/config/locales/tr.yml
@@ -1155,7 +1155,7 @@ tr:
label_create_missing_values: Eşleşlmeyen alanları oluştur
button_import: İçeri aktar
field_total_estimated_hours: Toplam tahmini zaman
- label_api: API
+ label_integrations: Integrations
label_total_plural: Toplamlar
label_assigned_issues: Atanan işler
label_field_format_enumeration: Anahtar/Değer listesi
diff --git a/config/locales/uk.yml b/config/locales/uk.yml
index 5298e0a3d..7bfbd2314 100644
--- a/config/locales/uk.yml
+++ b/config/locales/uk.yml
@@ -1149,7 +1149,7 @@ uk:
label_create_missing_values: Створити відсутні значення
button_import: Імпорт
field_total_estimated_hours: Всього залишилось часу
- label_api: API
+ label_integrations: Integrations
label_total_plural: Висновки
label_assigned_issues: Призначені задачі
label_field_format_enumeration: Ключ/значення список
diff --git a/config/locales/vi.yml b/config/locales/vi.yml
index beb52851c..41747f5b5 100644
--- a/config/locales/vi.yml
+++ b/config/locales/vi.yml
@@ -1193,7 +1193,7 @@ vi:
label_create_missing_values: Tạo các giá trị còn thiếu
button_import: Import
field_total_estimated_hours: Tổng thời gian ước tính
- label_api: API
+ label_integrations: Integrations
label_total_plural: Tổng
label_assigned_issues: Các vấn đề được giao
label_field_format_enumeration: Danh sách khóa / giá trị
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 7aa6d50e1..824f63754 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -1083,7 +1083,7 @@
label_fields_mapping: 欄位對應
label_file_content_preview: 檔案內容預覽
label_create_missing_values: 建立缺少的數值
- label_api: API
+ label_integrations: Integrations
label_field_format_enumeration: 鍵/值 清單
label_default_values_for_new_users: 新用戶使用之預設值
label_relations: 關聯
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 34b89889e..19078c7c5 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -1144,7 +1144,7 @@ zh:
label_create_missing_values: 创建缺失的数值
button_import: 导入
field_total_estimated_hours: 预估工时统计
- label_api: API
+ label_integrations: Integrations
label_total_plural: 总计
label_assigned_issues: 被指派的问题
label_field_format_enumeration: 键/值 清单
diff --git a/config/settings.yml b/config/settings.yml
index 753cd5b49..10447842d 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -336,6 +336,8 @@ rest_api_enabled:
jsonp_enabled:
default: 0
security_notifications: 1
+webhooks_enabled:
+ default: 1
default_notification_option:
default: 'only_assigned'
emails_header:
diff --git a/test/functional/my_controller_test.rb b/test/functional/my_controller_test.rb
index 3066f68e0..20f7f1062 100644
--- a/test/functional/my_controller_test.rb
+++ b/test/functional/my_controller_test.rb
@@ -398,6 +398,20 @@ class MyControllerTest < Redmine::ControllerTest
assert_select 'select[name=?]', 'user[language]'
end
+ def test_my_account_should_toggle_webhook_link_with_setting
+ User.find(2).roles.first.add_permission!(:use_webhooks)
+
+ get :account
+ assert_response :success
+ assert_select 'a.icon-webhook', 1
+
+ with_settings webhooks_enabled: '0' do
+ get :account
+ assert_response :success
+ assert_select 'a.icon-webhook', 0
+ end
+ end
+
def test_my_account_with_avatar_enabled_should_link_to_edit_avatar
with_settings :gravatar_enabled => '1' do
Redmine::Configuration.with 'avatar_server_url' => 'https://gravatar.com' do
diff --git a/test/functional/webhooks_controller_test.rb b/test/functional/webhooks_controller_test.rb
index 220636b2e..64fda1b6f 100644
--- a/test/functional/webhooks_controller_test.rb
+++ b/test/functional/webhooks_controller_test.rb
@@ -27,6 +27,16 @@ class WebhooksControllerTest < Redmine::ControllerTest
assert_select 'td', text: @other_hook.url, count: 0
end
+ test "should return not found when disabled" do
+ with_settings webhooks_enabled: '0' do
+ get :index
+ assert_response :forbidden
+
+ get :new
+ assert_response :forbidden
+ end
+ end
+
test "should get new" do
get :new
assert_response :success
diff --git a/test/unit/webhook_test.rb b/test/unit/webhook_test.rb
index df0ed2240..2443a4d01 100644
--- a/test/unit/webhook_test.rb
+++ b/test/unit/webhook_test.rb
@@ -168,6 +168,28 @@ class WebhookTest < ActiveSupport::TestCase
end
end
+ test "enabled? should follow setting flag" do
+ assert Webhook.enabled?
+
+ with_settings webhooks_enabled: '0' do
+ assert_not Webhook.enabled?
+ end
+
+ with_settings webhooks_enabled: '1' do
+ assert Webhook.enabled?
+ end
+ end
+
+ test "trigger should not enqueue jobs when disabled" do
+ create_hook
+
+ with_settings webhooks_enabled: '0' do
+ assert_no_enqueued_jobs do
+ Webhook.trigger('issue.created', @issue)
+ end
+ end
+ end
+
test "should compute payload" do
hook = create_hook
payload = hook.payload('issue.created', @issue)