diff options
Diffstat (limited to 'app')
26 files changed, 75 insertions, 76 deletions
diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index 1a080b4a..4e174ac6 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Skaber', 'Modification date' => 'Ændringsdato', 'Completion date' => 'Afslutningsdato', - 'Webhook URL for task creation' => 'Webhook URL for opgave oprettelse', - 'Webhook URL for task modification' => 'Webhook URL opgave redigering', 'Clone' => 'Kopier', 'Clone Project' => 'Kopier projekt', 'Project cloned successfully.' => 'Projektet er kopieret.', diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index 3dff0aab..787974dd 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Erstellt von', 'Modification date' => 'Änderungsdatum', 'Completion date' => 'Abschlussdatum', - 'Webhook URL for task creation' => 'Webhook URL zur Aufgabenerstellung', - 'Webhook URL for task modification' => 'Webhook URL zur Aufgabenbearbeitung', 'Clone' => 'duplizieren', 'Clone Project' => 'Projekt duplizieren', 'Project cloned successfully.' => 'Projekt wurde dupliziert.', diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index e778d5a8..68bd73b6 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Creador', 'Modification date' => 'Fecha de modificación', 'Completion date' => 'Fecha de terminación', - 'Webhook URL for task creation' => 'Disparador Web (Webhook) para la creación de tareas', - 'Webhook URL for task modification' => 'Disparador Web (Webhook) para la modificación de tareas', 'Clone' => 'Clonar', 'Clone Project' => 'Clonar proyecto', 'Project cloned successfully.' => 'Proyecto clonado correctamente', diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index d41cd82f..2bb28719 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Luonut', 'Modification date' => 'Muokkauspäivä', 'Completion date' => 'Valmistumispäivä', - 'Webhook URL for task creation' => 'Webhook URL tehtävän luomiselle', - 'Webhook URL for task modification' => 'Webhook URL tehtävän muokkaamiselle', 'Clone' => 'Kahdenna', 'Clone Project' => 'Kahdenna projekti', 'Project cloned successfully.' => 'Projekti kahdennettu onnistuneesti', diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 3621413a..64cb0999 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Créateur', 'Modification date' => 'Date de modification', 'Completion date' => 'Date de complétion', - 'Webhook URL for task creation' => 'URL du webhook pour la création de tâche', - 'Webhook URL for task modification' => 'URL du webhook pour la modification de tâche', 'Clone' => 'Clone', 'Clone Project' => 'Cloner le projet', 'Project cloned successfully.' => 'Projet cloné avec succès.', diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index 468b6a01..9831aa8a 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Készítette', 'Modification date' => 'Módosítás dátuma', 'Completion date' => 'Befejezés határideje', - 'Webhook URL for task creation' => 'Webhook URL a feladat létrehozásakor', - 'Webhook URL for task modification' => 'Webhook URL a feladatot módosításakor', 'Clone' => 'Másolat', 'Clone Project' => 'Projekt másolása', 'Project cloned successfully.' => 'A projekt sikeresen másolva.', diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 2bbd8ba7..4674ddc4 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Creatore', 'Modification date' => 'Data di modifica', 'Completion date' => 'Data di termine', - 'Webhook URL for task creation' => 'URL del Webhook per la creazione di compiti', - 'Webhook URL for task modification' => 'URL del Webhook per la modifica di compiti', 'Clone' => 'Clona', 'Clone Project' => 'Clona il progetto', 'Project cloned successfully.' => 'Progetto clonato con successo.', diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 1cc3818a..f4ea4d5f 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => '作成者', 'Modification date' => '変更日', 'Completion date' => '完了日', - 'Webhook URL for task creation' => 'タスク作成の Webhook URL', - 'Webhook URL for task modification' => 'タスク変更の Webhook URL', 'Clone' => '複製', 'Clone Project' => 'プロジェクトの複製', 'Project cloned successfully.' => 'プロジェクトを複製しました。', diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index c4c262e1..5d1f0695 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Aangemaakt door', 'Modification date' => 'Wijzigingsdatum', 'Completion date' => 'Afgerond op', - 'Webhook URL for task creation' => 'Webhook URL voor aanmaken taak', - 'Webhook URL for task modification' => 'Webhook URL voor wijzigen taak', 'Clone' => 'Kloon', 'Clone Project' => 'Project klonen', 'Project cloned successfully.' => 'Project succesvol gekloond.', diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index f1dade8f..8e0d8f58 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Autor', 'Modification date' => 'Data modyfyfikacji', 'Completion date' => 'Data ukończenia', - 'Webhook URL for task creation' => 'Webhook URL do tworzenia zadań', - 'Webhook URL for task modification' => 'Webhook URL do modyfikacji zadań', 'Clone' => 'Sklonuj', 'Clone Project' => 'Sklonuj projekt', 'Project cloned successfully.' => 'Projekt sklonowany pomyślnie.', diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index e8414330..85fc57f5 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Criado por', 'Modification date' => 'Data da modificação', 'Completion date' => 'Data da finalização', - 'Webhook URL for task creation' => 'Webhook URL para criação de tarefas', - 'Webhook URL for task modification' => 'Webhook URL para modificação de tarefa', 'Clone' => 'Clonar', 'Clone Project' => 'Clonar Projeto', 'Project cloned successfully.' => 'Projeto clonado com sucesso.', diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index d5df5e44..8bb5076c 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Автор', 'Modification date' => 'Дата изменения', 'Completion date' => 'Дата завершения', - 'Webhook URL for task creation' => 'Webhook URL для создания задачи', - 'Webhook URL for task modification' => 'Webhook URL для изменения задачи', 'Clone' => 'Клонировать', 'Clone Project' => 'Клонировать проект', 'Project cloned successfully.' => 'Проект клонирован.', diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index cf125c54..9b0e56be 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Autor', 'Modification date' => 'Datum izmene', 'Completion date' => 'Datum kompletiranja', - 'Webhook URL for task creation' => 'Webhook URL zadatka za kreiranje', - 'Webhook URL for task modification' => 'Webhook URL zadatka za izmenu', 'Clone' => 'Iskopiraj', 'Clone Project' => 'Iskopiraj projekat', 'Project cloned successfully.' => 'Projekat uspešno iskopiran.', diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index e2c46c9e..f144e9ad 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Skapare', 'Modification date' => 'Ändringsdatum', 'Completion date' => 'Slutfört datum', - 'Webhook URL for task creation' => 'Webhook URL för att skapa uppgift', - 'Webhook URL for task modification' => 'Webhook URL för att ändra uppgift', 'Clone' => 'Klona', 'Clone Project' => 'Klona projekt', 'Project cloned successfully.' => 'Projektet har klonats.', diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 68b32c42..e6642a3d 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'ผู้สร้าง', 'Modification date' => 'วันที่แก้ไข', 'Completion date' => 'วันที่เสร็จสิ้น', - 'Webhook URL for task creation' => 'Webhook URL for task creation', - 'Webhook URL for task modification' => 'Webhook URL for task modification', 'Clone' => 'เลียนแบบ', // 'Clone Project' => '', 'Project cloned successfully.' => 'เลียนแบบโปรเจคเรียบร้อยแล้ว', diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index 1368c358..a4327351 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => 'Oluşturan', 'Modification date' => 'Değişiklik tarihi', 'Completion date' => 'Tamamlanma tarihi', - // 'Webhook URL for task creation' => '', - // 'Webhook URL for task modification' => '', 'Clone' => 'Kopya oluştur', 'Clone Project' => 'Projenin kopyasını oluştur', 'Project cloned successfully.' => 'Proje kopyası başarıyla oluşturuldu.', diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 7d492635..c9350c8b 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -389,8 +389,6 @@ return array( 'Creator' => '创建者', 'Modification date' => '修改日期', 'Completion date' => '完成日期', - 'Webhook URL for task creation' => '创建任务的Webhook URL', - 'Webhook URL for task modification' => '修改任务的Webhook URL', 'Clone' => '克隆', 'Clone Project' => '复制项目', 'Project cloned successfully.' => '成功复制项目。', diff --git a/app/Model/Comment.php b/app/Model/Comment.php index 844f0c89..3aa9c027 100644 --- a/app/Model/Comment.php +++ b/app/Model/Comment.php @@ -129,7 +129,9 @@ class Comment extends Base ->eq('id', $values['id']) ->update(array('comment' => $values['comment'])); - $this->container['dispatcher']->dispatch(self::EVENT_UPDATE, new CommentEvent($values)); + if ($result) { + $this->container['dispatcher']->dispatch(self::EVENT_UPDATE, new CommentEvent($values)); + } return $result; } diff --git a/app/Model/Webhook.php b/app/Model/Webhook.php index b3603818..8c270fb6 100644 --- a/app/Model/Webhook.php +++ b/app/Model/Webhook.php @@ -14,20 +14,23 @@ class Webhook extends Base * Call the external URL * * @access public - * @param string $url URL to call - * @param array $task Task data + * @param array $values Event payload */ - public function notify($url, array $task) + public function notify(array $values) { + $url = $this->config->get('webhook_url'); $token = $this->config->get('webhook_token'); - if (strpos($url, '?') !== false) { - $url .= '&token='.$token; - } - else { - $url .= '?token='.$token; - } + if (! empty($url)) { - return $this->httpClient->post($url, $task); + if (strpos($url, '?') !== false) { + $url .= '&token='.$token; + } + else { + $url .= '?token='.$token; + } + + return $this->httpClient->post($url, $values); + } } } diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index 593cca80..aa611a6e 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -6,7 +6,16 @@ use PDO; use Core\Security; use Model\Link; -const VERSION = 70; +const VERSION = 71; + +function version_71($pdo) +{ + $rq = $pdo->prepare('INSERT INTO `settings` VALUES (?, ?)'); + $rq->execute(array('webhook_url', '')); + + $pdo->exec("DELETE FROM `settings` WHERE `option`='webhook_url_task_creation'"); + $pdo->exec("DELETE FROM `settings` WHERE `option`='webhook_url_task_modification'"); +} function version_70($pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index 4ec6965f..0afcd26a 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -6,7 +6,16 @@ use PDO; use Core\Security; use Model\Link; -const VERSION = 51; +const VERSION = 52; + +function version_52($pdo) +{ + $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); + $rq->execute(array('webhook_url', '')); + + $pdo->exec("DELETE FROM settings WHERE option='webhook_url_task_creation'"); + $pdo->exec("DELETE FROM settings WHERE option='webhook_url_task_modification'"); +} function version_51($pdo) { diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index 84892aaf..43fb136e 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -6,7 +6,16 @@ use Core\Security; use PDO; use Model\Link; -const VERSION = 69; +const VERSION = 70; + +function version_70($pdo) +{ + $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)'); + $rq->execute(array('webhook_url', '')); + + $pdo->exec("DELETE FROM settings WHERE option='webhook_url_task_creation'"); + $pdo->exec("DELETE FROM settings WHERE option='webhook_url_task_modification'"); +} function version_69($pdo) { diff --git a/app/Subscriber/WebhookSubscriber.php b/app/Subscriber/WebhookSubscriber.php index 6b5abf1b..e28675bd 100644 --- a/app/Subscriber/WebhookSubscriber.php +++ b/app/Subscriber/WebhookSubscriber.php @@ -2,8 +2,13 @@ namespace Subscriber; +use Event\CommentEvent; +use Event\GenericEvent; use Event\TaskEvent; +use Model\Comment; use Model\Task; +use Model\File; +use Model\Subtask; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class WebhookSubscriber extends Base implements EventSubscriberInterface @@ -11,32 +16,30 @@ class WebhookSubscriber extends Base implements EventSubscriberInterface public static function getSubscribedEvents() { return array( - Task::EVENT_CREATE => array('onTaskCreation', 0), - Task::EVENT_UPDATE => array('onTaskModification', 0), - Task::EVENT_CLOSE => array('onTaskModification', 0), - Task::EVENT_OPEN => array('onTaskModification', 0), - Task::EVENT_MOVE_COLUMN => array('onTaskModification', 0), - Task::EVENT_MOVE_POSITION => array('onTaskModification', 0), - Task::EVENT_ASSIGNEE_CHANGE => array('onTaskModification', 0), + Task::EVENT_CREATE => array('execute', 0), + Task::EVENT_UPDATE => array('execute', 0), + Task::EVENT_CLOSE => array('execute', 0), + Task::EVENT_OPEN => array('execute', 0), + Task::EVENT_MOVE_COLUMN => array('execute', 0), + Task::EVENT_MOVE_POSITION => array('execute', 0), + Task::EVENT_ASSIGNEE_CHANGE => array('execute', 0), + Task::EVENT_MOVE_PROJECT => array('execute', 0), + Task::EVENT_MOVE_SWIMLANE => array('execute', 0), + Comment::EVENT_CREATE => array('execute', 0), + Comment::EVENT_UPDATE => array('execute', 0), + File::EVENT_CREATE => array('execute', 0), + Subtask::EVENT_CREATE => array('execute', 0), + Subtask::EVENT_UPDATE => array('execute', 0), ); } - public function onTaskCreation(TaskEvent $event) + public function execute(GenericEvent $event, $event_name) { - $this->executeRequest('webhook_url_task_creation', $event); - } - - public function onTaskModification(TaskEvent $event) - { - $this->executeRequest('webhook_url_task_modification', $event); - } - - public function executeRequest($parameter, TaskEvent $event) - { - $url = $this->config->get($parameter); + $payload = array( + 'event_name' => $event_name, + 'event_data' => $event->getAll(), + ); - if (! empty($url)) { - $this->webhook->notify($url, $event->getAll()); - } + $this->webhook->notify($payload); } } diff --git a/app/Template/comment/edit.php b/app/Template/comment/edit.php index b4126a3e..2785fe62 100644 --- a/app/Template/comment/edit.php +++ b/app/Template/comment/edit.php @@ -7,6 +7,7 @@ <?= $this->formCsrf() ?> <?= $this->formHidden('id', $values) ?> <?= $this->formHidden('task_id', $values) ?> + <?= $this->formHidden('user_id', $values) ?> <div class="form-tabs"> <ul class="form-tabs-nav"> diff --git a/app/Template/config/webhook.php b/app/Template/config/webhook.php index d4f06d3f..06f7870b 100644 --- a/app/Template/config/webhook.php +++ b/app/Template/config/webhook.php @@ -6,11 +6,8 @@ <?= $this->formCsrf() ?> - <?= $this->formLabel(t('Webhook URL for task creation'), 'webhook_url_task_creation') ?> - <?= $this->formText('webhook_url_task_creation', $values, $errors) ?><br/> - - <?= $this->formLabel(t('Webhook URL for task modification'), 'webhook_url_task_modification') ?> - <?= $this->formText('webhook_url_task_modification', $values, $errors) ?><br/> + <?= $this->formLabel(t('Webhook URL'), 'webhook_url') ?> + <?= $this->formText('webhook_url', $values, $errors) ?> <div class="form-actions"> <input type="submit" value="<?= t('Save') ?>" class="btn btn-blue"/> diff --git a/app/Template/user/show.php b/app/Template/user/show.php index 9473b382..1be39cc3 100644 --- a/app/Template/user/show.php +++ b/app/Template/user/show.php @@ -33,7 +33,7 @@ <div class="listing"> <ul class="no-bullet"> - <li><strong><i class="fa fa-calendar"></i> <?= $this->a(t('iCalendar (iCal format, *.ics)'), 'ical', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> + <li><strong><i class="fa fa-calendar"></i> <?= $this->a(t('iCal feed'), 'ical', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li> </ul> </div> <?php endif ?> |