quicksilver-examples icon indicating copy to clipboard operation
quicksilver-examples copied to clipboard

Slack notifications not passing on commit details

Open imclean557 opened this issue 7 years ago • 5 comments

Using the example slack_notifications.php, the commit ID and message weren't being passed on to Slack. It looks like $fields array wasn't merged properly. To resolve, I changed the following from line 78:

    $fields += array(
      array(
        'title' => 'Commit',
        'value' => rtrim($hash),
        'short' => 'true'
      ),
      array(
        'title' => 'Commit Message',
        'value' => $message,
        'short' => 'false'
      )
    );

To this:

    $fields[] = array(
      'title' => 'Commit',
      'value' => rtrim($hash),
      'short' => 'true'
    );
    $fields[] = array(
      'title' => 'Commit Message',
      'value' => $message,
      'short' => 'false'     
    );

Possibly the numeric keys generated by PHP for the second array start at 0 so are ignored when using +=.

imclean557 avatar Nov 08 '16 00:11 imclean557