public function onCommit(GenericEvent $event)
 {
     $data = $event->getAll();
     $this->assertEquals(1, $data['project_id']);
     $this->assertEquals(2, $data['task_id']);
     $this->assertEquals('test2', $data['title']);
     $this->assertEquals("Fix issue #2\n\n\n[Commit made by @Frederic Guillot on Gogs](http://192.168.99.100:3000/me/test/commit/6ed26f1acb801e8904f12b842b918dfd9d10417b)", $data['comment']);
     $this->assertEquals("Fix issue #2\n", $data['commit_message']);
     $this->assertEquals('http://192.168.99.100:3000/me/test/commit/6ed26f1acb801e8904f12b842b918dfd9d10417b', $data['commit_url']);
 }
Beispiel #2
0
 /**
  * Execute job
  *
  * @param string       $text
  * @param string       $eventName
  * @param array        $eventData
  */
 public function execute($text, $eventName, array $eventData)
 {
     $event = new GenericEvent($eventData);
     $users = $this->getMentionedUsers($text);
     foreach ($users as $user) {
         if ($this->projectPermissionModel->isMember($event->getProjectId(), $user['id'])) {
             $event['mention'] = $user;
             $this->dispatcher->dispatch($eventName, $event);
         }
     }
 }
Beispiel #3
0
 /**
  * Set job parameters
  *
  * @param GenericEvent $event
  * @param string       $eventName
  * @param string       $eventObjectName
  * @return $this
  */
 public function withParams(GenericEvent $event, $eventName, $eventObjectName)
 {
     $this->jobParams = array($event->getAll(), $eventName, $eventObjectName);
     return $this;
 }
 /**
  * Execute the action
  *
  * @access public
  * @param  \Kanboard\Event\GenericEvent   $event
  * @param  string                         $eventName
  * @return bool
  */
 public function execute(GenericEvent $event, $eventName)
 {
     // Avoid infinite loop, a listener instance can be called only one time
     if ($this->called) {
         return false;
     }
     $data = $event->getAll();
     $executable = $this->isExecutable($data, $eventName);
     $executed = false;
     if ($executable) {
         $this->called = true;
         $executed = $this->doAction($data);
     }
     $this->logger->debug($this . ' [' . $eventName . '] => executable=' . var_export($executable, true) . ' exec_success=' . var_export($executed, true));
     return $executed;
 }
 public function onCommentCreatedWithUser(GenericEvent $event)
 {
     $data = $event->getAll();
     $this->assertEquals(1, $data['project_id']);
     $this->assertEquals(1, $data['task_id']);
     $this->assertEquals(2, $data['user_id']);
     $this->assertEquals(3972168, $data['reference']);
     $this->assertEquals("Super comment! ![My image 1](https://gitlab.com/kanboard/test-webhook/uploads/1a4d374af5ba51d8246b589f8932de66/img1.jpg)\n\n[By @kanboard on Gitlab](https://gitlab.com/kanboard/test-webhook/issues/5#note_3972168)", $data['comment']);
 }
Beispiel #6
0
 /**
  * Execute the action
  *
  * @access public
  * @param  \Kanboard\Event\GenericEvent   $event
  * @param  string                         $eventName
  * @return bool
  */
 public function execute(GenericEvent $event, $eventName)
 {
     // Avoid infinite loop, a listener instance can be called only one time
     if ($this->called) {
         return false;
     }
     $data = $event->getAll();
     $result = false;
     if ($this->isExecutable($data, $eventName)) {
         $this->called = true;
         $result = $this->doAction($data);
     }
     $this->logger->debug('AutomaticAction ' . $this->getName() . ' => ' . ($result ? 'true' : 'false'));
     return $result;
 }
Beispiel #7
0
 /**
  * Execute the action
  *
  * @access public
  * @param  \Event\GenericEvent   $event   Event data dictionary
  * @return bool                           True if the action was executed or false when not executed
  */
 public function execute(GenericEvent $event)
 {
     // Avoid infinite loop, a listener instance can be called only one time
     if ($this->called) {
         return false;
     }
     $data = $event->getAll();
     $result = false;
     if ($this->isExecutable($data)) {
         $this->called = true;
         $result = $this->doAction($data);
     }
     if (DEBUG) {
         $this->logger->debug(get_called_class() . ' => ' . ($result ? 'true' : 'false'));
     }
     return $result;
 }