Skip to content

A free open source IT asset/license management system

Update slack_* properties to webhook_*

Marcus Moorefe6295a5e43d
diff --git a/app/Models/Setting.php b/app/Models/Setting.php
index fd02992f75..ecac183356 100755
--- a/app/Models/Setting.php
+++ b/app/Models/Setting.php
@@ -83,9 +83,9 @@ class Setting extends Model
'email_domain',
'email_format',
'username_format',
- 'slack_endpoint',
- 'slack_channel',
- 'slack_botname',
+ 'webhook_endpoint',
+ 'webhook_channel',
+ 'webhook_botname',
];
/**
@@ -265,7 +265,7 @@ class Setting extends Model
{
// At this point the endpoint is the same for everything.
// In the future this may want to be adapted for individual notifications.
- return self::getSettings()->slack_endpoint;
+ return self::getSettings()->webhook_endpoint;
}
/**
diff --git a/app/Models/User.php b/app/Models/User.php
index 0e9d839a51..bf40982db3 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -272,7 +272,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
{
// At this point the endpoint is the same for everything.
// In the future this may want to be adapted for individual notifications.
- $this->endpoint = \App\Models\Setting::getSettings()->slack_endpoint;
+ $this->endpoint = \App\Models\Setting::getSettings()->webhook_endpoint;
return $this->endpoint;
}
diff --git a/app/Notifications/AuditNotification.php b/app/Notifications/AuditNotification.php
index 84f1753767..9f5ae96687 100644
--- a/app/Notifications/AuditNotification.php
+++ b/app/Notifications/AuditNotification.php
@@ -34,7 +34,7 @@ class AuditNotification extends Notification
public function via()
{
$notifyBy = [];
- if (Setting::getSettings()->slack_endpoint) {
+ if (Setting::getSettings()->webhook_endpoint) {
$notifyBy[] = 'slack';
}
diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.php
index f9abba59f9..a375f37ad3 100644
--- a/app/Notifications/CheckinAccessoryNotification.php
+++ b/app/Notifications/CheckinAccessoryNotification.php
@@ -39,11 +39,7 @@ class CheckinAccessoryNotification extends Notification
\Log::debug('via called');
$notifyBy = [];
- if (Setting::getSettings()->slack_endpoint) {
- $notifyBy[] = 'slack';
- }
-
- if (Setting::getSettings()->slack_endpoint != '') {
+ if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack';
}
@@ -95,7 +91,7 @@ class CheckinAccessoryNotification extends Notification
$admin = $this->admin;
$item = $this->item;
$note = $this->note;
- $botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot';
+ $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
diff --git a/app/Notifications/CheckinAssetNotification.php b/app/Notifications/CheckinAssetNotification.php
index 9868ad1b4d..e8fdcf678b 100644
--- a/app/Notifications/CheckinAssetNotification.php
+++ b/app/Notifications/CheckinAssetNotification.php
@@ -43,9 +43,8 @@ class CheckinAssetNotification extends Notification
public function via()
{
$notifyBy = [];
-
- if (Setting::getSettings()->slack_endpoint != '') {
- \Log::debug('use slack');
+ if (Setting::getSettings()->webhook_endpoint != '') {
+ \Log::debug('use webhook');
$notifyBy[] = 'slack';
}
@@ -65,7 +64,7 @@ class CheckinAssetNotification extends Notification
$admin = $this->admin;
$item = $this->item;
$note = $this->note;
- $botname = ($this->settings->slack_botname != '') ? $this->settings->slack_botname : 'Snipe-Bot';
+ $botname = ($this->settings->webhook_botname != '') ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [
trans('general.administrator') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
diff --git a/app/Notifications/CheckinLicenseSeatNotification.php b/app/Notifications/CheckinLicenseSeatNotification.php
index faeafecb1b..a68930a683 100644
--- a/app/Notifications/CheckinLicenseSeatNotification.php
+++ b/app/Notifications/CheckinLicenseSeatNotification.php
@@ -41,7 +41,7 @@ class CheckinLicenseSeatNotification extends Notification
{
$notifyBy = [];
- if (Setting::getSettings()->slack_endpoint != '') {
+ if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack';
}
@@ -62,7 +62,7 @@ class CheckinLicenseSeatNotification extends Notification
$admin = $this->admin;
$item = $this->item;
$note = $this->note;
- $botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot';
+ $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
if ($admin) {
$fields = [
diff --git a/app/Notifications/CheckoutAccessoryNotification.php b/app/Notifications/CheckoutAccessoryNotification.php
index 5882fdf275..982fd863c5 100644
--- a/app/Notifications/CheckoutAccessoryNotification.php
+++ b/app/Notifications/CheckoutAccessoryNotification.php
@@ -37,7 +37,7 @@ class CheckoutAccessoryNotification extends Notification
{
$notifyBy = [];
- if (Setting::getSettings()->slack_endpoint != '') {
+ if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack';
}
@@ -78,7 +78,7 @@ class CheckoutAccessoryNotification extends Notification
$admin = $this->admin;
$item = $this->item;
$note = $this->note;
- $botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot';
+ $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
diff --git a/app/Notifications/CheckoutAssetNotification.php b/app/Notifications/CheckoutAssetNotification.php
index c56c1a3711..303fc08f18 100644
--- a/app/Notifications/CheckoutAssetNotification.php
+++ b/app/Notifications/CheckoutAssetNotification.php
@@ -53,8 +53,8 @@ class CheckoutAssetNotification extends Notification
{
$notifyBy = [];
- if ((Setting::getSettings()) && (Setting::getSettings()->slack_endpoint != '')) {
- \Log::debug('use slack');
+ if ((Setting::getSettings()) && (Setting::getSettings()->webhook_endpoint != '')) {
+ \Log::debug('use webhook');
$notifyBy[] = 'slack';
}
@@ -95,7 +95,7 @@ class CheckoutAssetNotification extends Notification
$admin = $this->admin;
$item = $this->item;
$note = $this->note;
- $botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot';
+ $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
diff --git a/app/Notifications/CheckoutConsumableNotification.php b/app/Notifications/CheckoutConsumableNotification.php
index bfebe2c7d5..84e52fea77 100644
--- a/app/Notifications/CheckoutConsumableNotification.php
+++ b/app/Notifications/CheckoutConsumableNotification.php
@@ -43,7 +43,7 @@ class CheckoutConsumableNotification extends Notification
{
$notifyBy = [];
- if (Setting::getSettings()->slack_endpoint != '') {
+ if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack';
}
@@ -84,7 +84,7 @@ class CheckoutConsumableNotification extends Notification
$admin = $this->admin;
$item = $this->item;
$note = $this->note;
- $botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot';
+ $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
diff --git a/app/Notifications/CheckoutLicenseSeatNotification.php b/app/Notifications/CheckoutLicenseSeatNotification.php
index 50d8313c09..d4741d9beb 100644
--- a/app/Notifications/CheckoutLicenseSeatNotification.php
+++ b/app/Notifications/CheckoutLicenseSeatNotification.php
@@ -43,7 +43,7 @@ class CheckoutLicenseSeatNotification extends Notification
{
$notifyBy = [];
- if (Setting::getSettings()->slack_endpoint != '') {
+ if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack';
}
@@ -84,7 +84,7 @@ class CheckoutLicenseSeatNotification extends Notification
$admin = $this->admin;
$item = $this->item;
$note = $this->note;
- $botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot';
+ $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
diff --git a/app/Notifications/RequestAssetCancelation.php b/app/Notifications/RequestAssetCancelation.php
index ea76056af3..905900de09 100644
--- a/app/Notifications/RequestAssetCancelation.php
+++ b/app/Notifications/RequestAssetCancelation.php
@@ -57,8 +57,8 @@ class RequestAssetCancelation extends Notification
{
$notifyBy = [];
- if (Setting::getSettings()->slack_endpoint != '') {
- \Log::debug('use slack');
+ if (Setting::getSettings()->webhook_endpoint != '') {
+ \Log::debug('use webhook');
$notifyBy[] = 'slack';
}
@@ -73,7 +73,7 @@ class RequestAssetCancelation extends Notification
$item = $this->item;
$note = $this->note;
$qty = $this->item_quantity;
- $botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot';
+ $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [
'QTY' => $qty,
diff --git a/app/Notifications/RequestAssetNotification.php b/app/Notifications/RequestAssetNotification.php
index 22a8f3d464..028719f168 100644
--- a/app/Notifications/RequestAssetNotification.php
+++ b/app/Notifications/RequestAssetNotification.php
@@ -58,7 +58,7 @@ class RequestAssetNotification extends Notification
{
$notifyBy = [];
- if (Setting::getSettings()->slack_endpoint != '') {
+ if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack';
}
@@ -73,7 +73,7 @@ class RequestAssetNotification extends Notification
$qty = $this->item_quantity;
$item = $this->item;
$note = $this->note;
- $botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot';
+ $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [
'QTY' => $qty,
diff --git a/resources/views/accessories/checkout.blade.php b/resources/views/accessories/checkout.blade.php
index 000df2652a..3463d5eff3 100755
--- a/resources/views/accessories/checkout.blade.php
+++ b/resources/views/accessories/checkout.blade.php
@@ -54,7 +54,7 @@
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to'])
- @if ($accessory->requireAcceptance() || $accessory->getEula() || ($snipeSettings->slack_endpoint!=''))
+ @if ($accessory->requireAcceptance() || $accessory->getEula() || ($snipeSettings->webhook_endpoint!=''))
<div class="form-group notification-callout">
<div class="col-md-8 col-md-offset-3">
<div class="callout callout-info">
@@ -71,9 +71,9 @@
<br>
@endif
- @if ($snipeSettings->slack_endpoint!='')
+ @if ($snipeSettings->webhook_endpoint!='')
<i class="fab fa-slack"></i>
- A slack message will be sent
+ {{ trans('general.webhook_msg_note') }}
@endif
</div>
</div>
diff --git a/resources/views/consumables/checkout.blade.php b/resources/views/consumables/checkout.blade.php
index 85cec320e2..bc17e893a1 100644
--- a/resources/views/consumables/checkout.blade.php
+++ b/resources/views/consumables/checkout.blade.php
@@ -41,7 +41,7 @@
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to', 'required'=> 'true'])
- @if ($consumable->requireAcceptance() || $consumable->getEula() || ($snipeSettings->slack_endpoint!=''))
+ @if ($consumable->requireAcceptance() || $consumable->getEula() || ($snipeSettings->webhook_endpoint!=''))
<div class="form-group notification-callout">
<div class="col-md-8 col-md-offset-3">
<div class="callout callout-info">
@@ -58,9 +58,9 @@
<br>
@endif
- @if ($snipeSettings->slack_endpoint!='')
+ @if ($snipeSettings->webhook_endpoint!='')
<i class="fab fa-slack"></i>
- {{ trans('general.slack_msg_note') }}
+ {{ trans('general.webhook_msg_note') }}
@endif
</div>
</div>
diff --git a/resources/views/hardware/checkout.blade.php b/resources/views/hardware/checkout.blade.php
index 98536c80f5..9f91dace17 100755
--- a/resources/views/hardware/checkout.blade.php
+++ b/resources/views/hardware/checkout.blade.php
@@ -114,7 +114,7 @@
</div>
</div>
- @if ($asset->requireAcceptance() || $asset->getEula() || ($snipeSettings->slack_endpoint!=''))
+ @if ($asset->requireAcceptance() || $asset->getEula() || ($snipeSettings->webhook_endpoint!=''))
<div class="form-group notification-callout">
<div class="col-md-8 col-md-offset-3">
<div class="callout callout-info">
@@ -131,9 +131,9 @@
<br>
@endif
- @if ($snipeSettings->slack_endpoint!='')
+ @if ($snipeSettings->webhook_endpoint!='')
<i class="fab fa-slack" aria-hidden="true"></i>
- {{ trans('general.slack_msg_note')}}
+ {{ trans('general.webhook_msg_note') }}
@endif
</div>
</div>
diff --git a/resources/views/licenses/checkout.blade.php b/resources/views/licenses/checkout.blade.php
index 77e58e2fdb..4d41d8c03b 100755
--- a/resources/views/licenses/checkout.blade.php
+++ b/resources/views/licenses/checkout.blade.php
@@ -65,7 +65,7 @@
</div>
- @if ($license->requireAcceptance() || $license->getEula() || ($snipeSettings->slack_endpoint!=''))
+ @if ($license->requireAcceptance() || $license->getEula() || ($snipeSettings->webhook_endpoint!=''))
<div class="form-group notification-callout">
<div class="col-md-8 col-md-offset-3">
<div class="callout callout-info">
@@ -88,9 +88,9 @@
<br>
@endif
- @if ($snipeSettings->slack_endpoint!='')
+ @if ($snipeSettings->webhook_endpoint!='')
<i class="fab fa-slack"></i>
- {{ trans('general.slack_msg_note') }}
+ {{ trans('general.webhook_msg_note') }}
@endif
</div>
</div>