diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 6c43fec05a..d70d169be2 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -16,6 +16,7 @@ use Illuminate\Support\Facades\Crypt; use Illuminate\Contracts\Encryption\DecryptException; use Carbon\Carbon; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Str; use Intervention\Image\ImageManagerStatic as Image; use Illuminate\Support\Facades\Session; @@ -708,6 +709,23 @@ class Helper return $randomString; } + /** + * A method to be used to handle deprecations and giving notifications, currently handling MS Teams. more can be added when needed. + * + * + * @author [Godfrey Martinez] + * @since [v7.0.14] + * @return array + */ + public static function deprecationCheck(){ + $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 your webhook URL'), + ]; + + return $deprecations; + } /** * This nasty little method gets the low inventory info for the diff --git a/app/Livewire/SlackSettingsForm.php b/app/Livewire/SlackSettingsForm.php index 57f811c3d1..3be8aa627e 100644 --- a/app/Livewire/SlackSettingsForm.php +++ b/app/Livewire/SlackSettingsForm.php @@ -81,15 +81,17 @@ class SlackSettingsForm extends Component $this->webhook_channel = $this->setting->webhook_channel; $this->webhook_botname = $this->setting->webhook_botname; $this->webhook_options = $this->setting->webhook_selected; - if($this->webhook_selected == 'microsoft' || $this->webhook_selected == 'google'){ + $this->teams_webhook_deprecated = Str::contains($this->webhook_endpoint, 'workflows'); + if($this->webhook_selected === 'microsoft' || $this->webhook_selected === 'google'){ $this->webhook_channel = '#NA'; } - if($this->setting->webhook_endpoint != null && $this->setting->webhook_channel != null){ $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.'); + } } public function updated($field) { @@ -111,7 +113,6 @@ class SlackSettingsForm extends Component if($this->webhook_selected == 'microsoft' || $this->webhook_selected == 'google'){ $this->webhook_channel = '#NA'; } - } private function isButtonDisabled() { @@ -128,7 +129,9 @@ class SlackSettingsForm extends Component public function render() { $this->isButtonDisabled(); + return view('livewire.slack-settings-form'); + } public function testWebhook(){ @@ -237,7 +240,7 @@ class SlackSettingsForm extends Component } } public function msTeamTestWebhook(){ - $this->teams_webhook_deprecated = !Str::contains($this->webhook_endpoint, 'workflows'); + try { if($this->teams_webhook_deprecated){ diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index 1bf7db6f65..46341f70cc 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -268,17 +268,20 @@ dir="{{ Helper::determineLanguageDirection() }}"> @can('admin') @if ($snipeSettings->show_alerts_in_menu=='1') - +