From 41eb2464e2d9d4ce279bcaf1edbf1ea2e0bcba3b Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 21 Mar 2023 21:21:01 -0700 Subject: [PATCH 1/4] Forgot the static method declaration - derp Signed-off-by: snipe --- app/Helpers/Helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 541d4070ff..89704242ba 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -1163,7 +1163,7 @@ class Helper * } * @todo - use this everywhere else in the app where we have very long if/else config('app.lock_passwords') stuff */ - public function isDemoMode() { + public static function isDemoMode() { if (config('app.lock_passwords') === true) { return true; \Log::debug('app locked!'); @@ -1177,7 +1177,7 @@ class Helper * I know it's gauche to return a shitty HTML string, but this is just a helper and since it will be the same every single time, * it seemed pretty safe to do here. Don't you judge me. */ - public function showDemoModeFieldWarning() { + public static function showDemoModeFieldWarning() { if (Helper::isDemoMode()) { return "

" . trans('general.feature_disabled') . "

"; } From 76425ca2a5c8ef8231cf9a87b16034eeffd1de53 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 21 Mar 2023 21:59:17 -0700 Subject: [PATCH 2/4] Fixes back-in-time Slack v slack migration Signed-off-by: snipe --- ...2023_03_21_215218_update_slack_setting.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 database/migrations/2023_03_21_215218_update_slack_setting.php diff --git a/database/migrations/2023_03_21_215218_update_slack_setting.php b/database/migrations/2023_03_21_215218_update_slack_setting.php new file mode 100644 index 0000000000..d6d02b4a48 --- /dev/null +++ b/database/migrations/2023_03_21_215218_update_slack_setting.php @@ -0,0 +1,37 @@ +get(); + + foreach($settings as $setting){ + $setting->update(['webhook_selected' => 'slack']); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} From 4efac7827bf01ddd421688c69e5ba362901d9942 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 21 Mar 2023 22:10:30 -0700 Subject: [PATCH 3/4] Trying other save method, I guess? Signed-off-by: snipe --- database/migrations/2023_03_21_215218_update_slack_setting.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/database/migrations/2023_03_21_215218_update_slack_setting.php b/database/migrations/2023_03_21_215218_update_slack_setting.php index d6d02b4a48..e4fdf75600 100644 --- a/database/migrations/2023_03_21_215218_update_slack_setting.php +++ b/database/migrations/2023_03_21_215218_update_slack_setting.php @@ -21,7 +21,8 @@ class UpdateSlackSetting extends Migration $settings = Setting::where('webhook_selected', '=', 'Slack')->get(); foreach($settings as $setting){ - $setting->update(['webhook_selected' => 'slack']); + $setting->webhook_selected = 'slack'; + $setting->save(); } } From 1fa9f80c0318c4ca863a0eac237663000b092ec1 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 21 Mar 2023 22:18:42 -0700 Subject: [PATCH 4/4] Correctly disable the select2 in demo mode Signed-off-by: snipe --- resources/views/livewire/slack-settings-form.blade.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/views/livewire/slack-settings-form.blade.php b/resources/views/livewire/slack-settings-form.blade.php index a1df7ef242..4538e472bd 100644 --- a/resources/views/livewire/slack-settings-form.blade.php +++ b/resources/views/livewire/slack-settings-form.blade.php @@ -60,8 +60,11 @@
- {{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'style'=>'width:90%')) }} - + @if (Helper::isDemoMode()) + {{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'style'=>'width:90%', 'disabled')) }} + @else + {{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'style'=>'width:90%')) }} + @endif