mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-23 12:44:12 -08:00
fix: slack channel
This commit is contained in:
parent
ff480a7247
commit
ad8c36a51a
|
@ -23,6 +23,7 @@ class AuditNotification extends Notification
|
|||
public function __construct($params)
|
||||
{
|
||||
//
|
||||
$this->settings = Setting::getSettings();
|
||||
$this->params = $params;
|
||||
}
|
||||
|
||||
|
@ -43,9 +44,12 @@ class AuditNotification extends Notification
|
|||
|
||||
public function toSlack()
|
||||
{
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
return (new SlackMessage)
|
||||
->success()
|
||||
->content(class_basename(get_class($this->params['item'])).' Audited')
|
||||
->from(($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot')
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) {
|
||||
$item = $this->params['item'];
|
||||
$admin_user = $this->params['admin'];
|
||||
|
|
|
@ -92,6 +92,7 @@ class CheckinAccessoryNotification extends Notification
|
|||
$item = $this->item;
|
||||
$note = $this->note;
|
||||
$botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
|
@ -101,6 +102,7 @@ class CheckinAccessoryNotification extends Notification
|
|||
return (new SlackMessage)
|
||||
->content(':arrow_down: :keyboard: '.trans('mail.Accessory_Checkin_Notification'))
|
||||
->from($botname)
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
|
||||
$attachment->title(htmlspecialchars_decode($item->present()->name), $item->present()->viewUrl())
|
||||
->fields($fields)
|
||||
|
|
|
@ -65,6 +65,7 @@ class CheckinAssetNotification extends Notification
|
|||
$item = $this->item;
|
||||
$note = $this->note;
|
||||
$botname = ($this->settings->webhook_botname != '') ? $this->settings->webhook_botname : 'Snipe-Bot';
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
trans('general.administrator') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
|
||||
|
@ -75,6 +76,7 @@ class CheckinAssetNotification extends Notification
|
|||
return (new SlackMessage)
|
||||
->content(':arrow_down: :computer: '.trans('mail.Asset_Checkin_Notification'))
|
||||
->from($botname)
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
|
||||
$attachment->title(htmlspecialchars_decode($item->present()->name), $item->present()->viewUrl())
|
||||
->fields($fields)
|
||||
|
|
|
@ -63,6 +63,7 @@ class CheckinLicenseSeatNotification extends Notification
|
|||
$item = $this->item;
|
||||
$note = $this->note;
|
||||
$botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
if ($admin) {
|
||||
$fields = [
|
||||
|
@ -79,6 +80,7 @@ class CheckinLicenseSeatNotification extends Notification
|
|||
return (new SlackMessage)
|
||||
->content(':arrow_down: :floppy_disk: '.trans('mail.License_Checkin_Notification'))
|
||||
->from($botname)
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
|
||||
$attachment->title(htmlspecialchars_decode($item->present()->name), $item->present()->viewUrl())
|
||||
->fields($fields)
|
||||
|
|
|
@ -79,6 +79,7 @@ class CheckoutAccessoryNotification extends Notification
|
|||
$item = $this->item;
|
||||
$note = $this->note;
|
||||
$botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
|
@ -88,6 +89,7 @@ class CheckoutAccessoryNotification extends Notification
|
|||
return (new SlackMessage)
|
||||
->content(':arrow_up: :keyboard: Accessory Checked Out')
|
||||
->from($botname)
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
|
||||
$attachment->title(htmlspecialchars_decode($item->present()->name), $item->present()->viewUrl())
|
||||
->fields($fields)
|
||||
|
|
|
@ -96,6 +96,7 @@ class CheckoutAssetNotification extends Notification
|
|||
$item = $this->item;
|
||||
$note = $this->note;
|
||||
$botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
|
@ -109,6 +110,7 @@ class CheckoutAssetNotification extends Notification
|
|||
return (new SlackMessage)
|
||||
->content(':arrow_up: :computer: '.trans('mail.Asset_Checkout_Notification'))
|
||||
->from($botname)
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
|
||||
$attachment->title(htmlspecialchars_decode($item->present()->name), $item->present()->viewUrl())
|
||||
->fields($fields)
|
||||
|
|
|
@ -85,6 +85,7 @@ class CheckoutConsumableNotification extends Notification
|
|||
$item = $this->item;
|
||||
$note = $this->note;
|
||||
$botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
|
@ -94,6 +95,7 @@ class CheckoutConsumableNotification extends Notification
|
|||
return (new SlackMessage)
|
||||
->content(':arrow_up: :paperclip: Consumable Checked Out')
|
||||
->from($botname)
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
|
||||
$attachment->title(htmlspecialchars_decode($item->present()->name), $item->present()->viewUrl())
|
||||
->fields($fields)
|
||||
|
|
|
@ -85,6 +85,7 @@ class CheckoutLicenseSeatNotification extends Notification
|
|||
$item = $this->item;
|
||||
$note = $this->note;
|
||||
$botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
|
@ -94,6 +95,7 @@ class CheckoutLicenseSeatNotification extends Notification
|
|||
return (new SlackMessage)
|
||||
->content(':arrow_up: :floppy_disk: License Checked Out')
|
||||
->from($botname)
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) use ($item, $note, $admin, $fields) {
|
||||
$attachment->title(htmlspecialchars_decode($item->present()->name), $item->present()->viewUrl())
|
||||
->fields($fields)
|
||||
|
|
|
@ -74,6 +74,7 @@ class RequestAssetCancelation extends Notification
|
|||
$note = $this->note;
|
||||
$qty = $this->item_quantity;
|
||||
$botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
'QTY' => $qty,
|
||||
|
@ -87,6 +88,7 @@ class RequestAssetCancelation extends Notification
|
|||
return (new SlackMessage)
|
||||
->content(trans('mail.a_user_canceled'))
|
||||
->from($botname)
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) use ($item, $note, $fields) {
|
||||
$attachment->title(htmlspecialchars_decode($item->present()->name), $item->present()->viewUrl())
|
||||
->fields($fields)
|
||||
|
|
|
@ -74,6 +74,7 @@ class RequestAssetNotification extends Notification
|
|||
$item = $this->item;
|
||||
$note = $this->note;
|
||||
$botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
'QTY' => $qty,
|
||||
|
@ -83,6 +84,7 @@ class RequestAssetNotification extends Notification
|
|||
return (new SlackMessage)
|
||||
->content(trans('mail.Item_Requested'))
|
||||
->from($botname)
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) use ($item, $note, $fields) {
|
||||
$attachment->title(htmlspecialchars_decode($item->present()->name), $item->present()->viewUrl())
|
||||
->fields($fields)
|
||||
|
|
Loading…
Reference in a new issue