From 29d0380db3f58e1e975d3b6d4e2c5884f99c2025 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 1 Apr 2025 11:53:32 -0700 Subject: [PATCH 1/4] reword warning messages, remove warning if webhook cleared and saved, deprecations only for superadmins --- app/Helpers/Helper.php | 4 +- app/Livewire/SlackSettingsForm.php | 15 +++---- resources/views/layouts/default.blade.php | 48 ++++++++++++----------- 3 files changed, 35 insertions(+), 32 deletions(-) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 216245a3dbae..c63ae21b261b 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -721,8 +721,8 @@ public static function deprecationCheck() : array { // The check and message that the user is still using the deprecated version $deprecations = [ 'ms_teams_deprecated' => array( - 'check' => !Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows'), - 'message' => 'The Microsoft Teams webhook URL being used will be deprecated Jan 31st, 2025. Change webhook endpoint'), + 'check' => !Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows') && (Setting::getSettings()->webhook_selected === 'microsoft'), + 'message' => 'The Microsoft Teams webhook URL being used will be deprecated Dec 31st, 2025. Change webhook endpoint'), ]; // if item of concern is being used and its being used with the deprecated values return the notification array. diff --git a/app/Livewire/SlackSettingsForm.php b/app/Livewire/SlackSettingsForm.php index 7487f30961b5..0610f4b8a43d 100644 --- a/app/Livewire/SlackSettingsForm.php +++ b/app/Livewire/SlackSettingsForm.php @@ -71,12 +71,12 @@ public function mount() { $this->setting = Setting::getSettings(); $this->save_button = trans('general.save'); - $this->webhook_selected = $this->setting->webhook_selected; - $this->webhook_name = $this->webhook_text[$this->setting->webhook_selected]["name"]; - $this->webhook_icon = $this->webhook_text[$this->setting->webhook_selected]["icon"]; - $this->webhook_placeholder = $this->webhook_text[$this->setting->webhook_selected]["placeholder"]; - $this->webhook_link = $this->webhook_text[$this->setting->webhook_selected]["link"]; - $this->webhook_test = $this->webhook_text[$this->setting->webhook_selected]["test"]; + $this->webhook_selected = $this->setting->webhook_selected ?? 'slack'; + $this->webhook_name = $this->webhook_text[$this->setting->webhook_selected]["name"] ?? $this->webhook_text['slack']["name"]; + $this->webhook_icon = $this->webhook_text[$this->setting->webhook_selected]["icon"] ?? $this->webhook_text['slack']["icon"]; + $this->webhook_placeholder = $this->webhook_text[$this->setting->webhook_selected]["placeholder"] ?? $this->webhook_text['slack']["placeholder"]; + $this->webhook_link = $this->webhook_text[$this->setting->webhook_selected]["link"] ?? $this->webhook_text['slack']["link"]; + $this->webhook_test = $this->webhook_text[$this->setting->webhook_selected]["test"] ?? $this->webhook_text['slack']["test"]; $this->webhook_endpoint = $this->setting->webhook_endpoint; $this->webhook_channel = $this->setting->webhook_channel; $this->webhook_botname = $this->setting->webhook_botname; @@ -90,7 +90,7 @@ public function mount() { $this->isDisabled= ''; } if($this->webhook_selected === 'microsoft' && $this->teams_webhook_deprecated) { - session()->flash('warning', 'The selected Microsoft Teams webhook URL will be deprecated Jan 31st, 2025. Please use a workflow URL. Microsofts Documentation on creating a workflow can be found here.'); + session()->flash('warning', 'The selected Microsoft Teams webhook URL will be deprecated Dec 31st, 2025. Please use a workflow URL. Microsoft\'s documentation on creating a workflow can be found here.'); } } public function updated($field) { @@ -191,6 +191,7 @@ public function clearSettings(){ $this->setting->webhook_endpoint = ''; $this->setting->webhook_channel = ''; $this->setting->webhook_botname = ''; + $this->setting->webhook_selected = ''; $this->setting->save(); diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index 82f7eca50163..721b636a9a86 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -266,19 +266,20 @@ @endcan @can('admin') - @if ($snipeSettings->show_alerts_in_menu=='1') - - - - + @endcan From 4ef161214d50a60811dc0cc57636c477b1dd5cfc Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Tue, 1 Apr 2025 12:01:35 -0700 Subject: [PATCH 2/4] notification icon only appears when there are notifications --- resources/views/layouts/default.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index 721b636a9a86..c021d7403158 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -270,13 +270,12 @@ show_alerts_in_menu=='1') ? Helper::checkLowInventory() : []; $deprecations = Helper::deprecationCheck()?> + @if (count($alert_items) || count($deprecations)) + @endif @endcan From 4b6437854c433fb4f561300c16c76f890594e810 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 5 May 2025 09:31:23 -0700 Subject: [PATCH 3/4] swapped out hard coded text with translation --- app/Livewire/SlackSettingsForm.php | 2 +- resources/lang/en-US/admin/settings/message.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Livewire/SlackSettingsForm.php b/app/Livewire/SlackSettingsForm.php index 0610f4b8a43d..8bc775a27acc 100644 --- a/app/Livewire/SlackSettingsForm.php +++ b/app/Livewire/SlackSettingsForm.php @@ -90,7 +90,7 @@ public function mount() { $this->isDisabled= ''; } if($this->webhook_selected === 'microsoft' && $this->teams_webhook_deprecated) { - session()->flash('warning', 'The selected Microsoft Teams webhook URL will be deprecated Dec 31st, 2025. Please use a workflow URL. Microsoft\'s documentation on creating a workflow can be found here.'); + session()->flash('warning', trans('admin/settings/message.webhook.ms_teams_deprecation')); } } public function updated($field) { diff --git a/resources/lang/en-US/admin/settings/message.php b/resources/lang/en-US/admin/settings/message.php index 9be29017472e..cc812485c158 100644 --- a/resources/lang/en-US/admin/settings/message.php +++ b/resources/lang/en-US/admin/settings/message.php @@ -49,6 +49,7 @@ 'error_redirect' => 'ERROR: 301/302 :endpoint returns a redirect. For security reasons, we don’t follow redirects. Please use the actual endpoint.', 'error_misc' => 'Something went wrong. :( ', 'webhook_fail' => ' webhook notification failed: Check to make sure the URL is still valid.', - 'webhook_channel_not_found' => ' webhook channel not found.' + 'webhook_channel_not_found' => ' webhook channel not found.', + 'ms_teams_deprecation' => 'The selected Microsoft Teams webhook URL will be deprecated Dec 31st, 2025. Please use a workflow URL. Microsoft\'s documentation on creating a workflow can be found here.', ] ]; From e3a2397b745df0e4ebdc7d9f2ecee7cfad536a90 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 5 May 2025 10:28:08 -0700 Subject: [PATCH 4/4] removed hiding the notifications icon --- resources/views/layouts/default.blade.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index 26a39fb88976..47b0fd2c4fae 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -268,14 +268,16 @@ @can('admin') show_alerts_in_menu=='1') ? Helper::checkLowInventory() : []; - $deprecations = Helper::deprecationCheck()?> + $deprecations = Helper::deprecationCheck() + ?> - @if (count($alert_items) || count($deprecations)) - @endif @endcan