Skip to content

Commit

Permalink
Merge pull request #11 from TeraDox/develop
Browse files Browse the repository at this point in the history
Added raw option for slack adapter to send without formatting text
  • Loading branch information
Ryo Ikeda authored Apr 14, 2017
2 parents 4e6bf63 + dc8cd5d commit 3b415ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Adapters/MailAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function __construct($options)
/**
* Send content with specified options via email.
* If there is no options specified, use one that is already specified. (at least default)
* @param $content content that is going to be sent
* @param $options array of options. keys = ['from', 'to', 'subject, 'fields', 'max_retry', 'force']
* @param mixed $content content that is going to be sent
* @param array $options array of options. keys = ['from', 'to', 'subject, 'fields', 'max_retry', 'force']
* @throws NotifyException
*/
function send($content, $options)
Expand All @@ -55,7 +55,7 @@ function send($content, $options)
}
} else {
// text message
// if text is greater than 3000 chars, cut them at 3000 chars.
// if text is greater than 3500 chars, cut them at 3500 chars.
if (strlen($content) > 3500) {
$content = substr($content, 0, 3500);
$content = $content . " ... ----- TEXT IS LIMITED TO 3500 CHARS-----";
Expand Down
5 changes: 4 additions & 1 deletion src/Adapters/SlackAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ function send($content, $options)
if (isset($options['mention'])) {
$mention = $options['mention'] . " ";
}
$message->setText($mention . "```" . $content . "```");

$content = (isset($options['raw']) && $options['raw']) ? $content : "```" . $content . "```";

$message->setText($mention . $content);
}

$message->from($options['from']);
Expand Down

0 comments on commit 3b415ec

Please sign in to comment.