Skip to content

A free open source IT asset/license management system

Check for admin for slack notifications

snipeb5acca89d72a
diff --git a/app/Notifications/CheckinLicenseNotification.php b/app/Notifications/CheckinLicenseNotification.php
index f8a52ccf3c..a0327f6faf 100644
--- a/app/Notifications/CheckinLicenseNotification.php
+++ b/app/Notifications/CheckinLicenseNotification.php
@@ -76,10 +76,18 @@ class CheckinLicenseNotification extends Notification
$botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot' ;
- $fields = [
- 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
- 'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
- ];
+ if ($admin) {
+ $fields = [
+ 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
+ 'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
+ ];
+ } else {
+ $fields = [
+ 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
+ 'By' => 'CLI tool',
+ ];
+ }
+