From b5acca89d72a43f42fb81a4bf06e8b7c3da0b93b Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 14 Aug 2020 16:02:15 -0700 Subject: [PATCH] Check for admin for slack notifications --- app/Notifications/CheckinLicenseNotification.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/Notifications/CheckinLicenseNotification.php b/app/Notifications/CheckinLicenseNotification.php index f8a52ccf3..a0327f6fa 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', + ]; + } +