diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index e54908a41..102c1a901 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -424,7 +424,7 @@ class AdminController extends Controller public function customEmojiHome(Request $request) { - if(!config('federation.custom_emoji.enabled')) { + if(!(bool) config_cache('federation.custom_emoji.enabled')) { return view('admin.custom-emoji.not-enabled'); } $this->validate($request, [ @@ -497,7 +497,7 @@ class AdminController extends Controller public function customEmojiToggleActive(Request $request, $id) { - abort_unless(config('federation.custom_emoji.enabled'), 404); + abort_unless((bool) config_cache('federation.custom_emoji.enabled'), 404); $emoji = CustomEmoji::findOrFail($id); $emoji->disabled = !$emoji->disabled; $emoji->save(); @@ -508,13 +508,13 @@ class AdminController extends Controller public function customEmojiAdd(Request $request) { - abort_unless(config('federation.custom_emoji.enabled'), 404); + abort_unless((bool) config_cache('federation.custom_emoji.enabled'), 404); return view('admin.custom-emoji.add'); } public function customEmojiStore(Request $request) { - abort_unless(config('federation.custom_emoji.enabled'), 404); + abort_unless((bool) config_cache('federation.custom_emoji.enabled'), 404); $this->validate($request, [ 'shortcode' => [ 'required', @@ -545,7 +545,7 @@ class AdminController extends Controller public function customEmojiDelete(Request $request, $id) { - abort_unless(config('federation.custom_emoji.enabled'), 404); + abort_unless((bool) config_cache('federation.custom_emoji.enabled'), 404); $emoji = CustomEmoji::findOrFail($id); Storage::delete("public/{$emoji->media_path}"); Cache::forget('pf:custom_emoji'); @@ -555,7 +555,7 @@ class AdminController extends Controller public function customEmojiShowDuplicates(Request $request, $id) { - abort_unless(config('federation.custom_emoji.enabled'), 404); + abort_unless((bool) config_cache('federation.custom_emoji.enabled'), 404); $emoji = CustomEmoji::orderBy('id')->whereDisabled(false)->whereShortcode($id)->firstOrFail(); $emojis = CustomEmoji::whereShortcode($id)->where('id', '!=', $emoji->id)->cursorPaginate(10); return view('admin.custom-emoji.duplicates', compact('emoji', 'emojis')); diff --git a/app/Models/CustomEmoji.php b/app/Models/CustomEmoji.php index 1ff026a19..47aa0d1a8 100644 --- a/app/Models/CustomEmoji.php +++ b/app/Models/CustomEmoji.php @@ -18,7 +18,7 @@ class CustomEmoji extends Model public static function scan($text, $activitypub = false) { - if(config('federation.custom_emoji.enabled') == false) { + if((bool) config_cache('federation.custom_emoji.enabled') == false) { return []; } diff --git a/app/Services/ConfigCacheService.php b/app/Services/ConfigCacheService.php index 8205dc3bd..7e60942ca 100644 --- a/app/Services/ConfigCacheService.php +++ b/app/Services/ConfigCacheService.php @@ -97,6 +97,7 @@ class ConfigCacheService 'captcha.active.register', 'captcha.triggers.login.enabled', 'captcha.triggers.login.attempts', + 'federation.custom_emoji.enabled', // 'system.user_mode' ]; diff --git a/app/Services/CustomEmojiService.php b/app/Services/CustomEmojiService.php index a95c93a2a..468772b5f 100644 --- a/app/Services/CustomEmojiService.php +++ b/app/Services/CustomEmojiService.php @@ -13,7 +13,7 @@ class CustomEmojiService { public static function get($shortcode) { - if(config('federation.custom_emoji.enabled') == false) { + if((bool) config_cache('federation.custom_emoji.enabled') == false) { return; } @@ -22,7 +22,7 @@ class CustomEmojiService public static function import($url, $id = false) { - if(config('federation.custom_emoji.enabled') == false) { + if((bool) config_cache('federation.custom_emoji.enabled') == false) { return; } diff --git a/resources/views/admin/diagnostics/home.blade.php b/resources/views/admin/diagnostics/home.blade.php index db44a2332..204f6ce67 100644 --- a/resources/views/admin/diagnostics/home.blade.php +++ b/resources/views/admin/diagnostics/home.blade.php @@ -358,7 +358,7 @@