From aa9bb868dd6ce159a775113b55be85beebfe7beb Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 30 Aug 2026 11:37:47 +0930 Subject: [PATCH] fix: emoji admin URLs and cloud-migration guard Two issues prevented emoji from serving/migrating correctly on cloud: - Admin custom-emoji views hardcoded url('storage/'.media_path), so they always showed local URLs and bypassed cloud resolution. Use $emoji->url(). - The migration/command guard relied solely on config_cache('pixelfed.cloud_storage'), which is DB/12h-cached and can read stale-false right after cloud is enabled, causing the migration to silently no-op. Treat cloud as enabled when either live config() or config_cache() is true. --- .../Commands/Admin/EmojiMoveStorageLocalToCloud.php | 7 ++++++- .../2026_08_30_050000_migrate_local_emoji_to_cloud.php | 6 +++++- resources/views/admin/custom-emoji/duplicates.blade.php | 4 ++-- resources/views/admin/custom-emoji/home.blade.php | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/Admin/EmojiMoveStorageLocalToCloud.php b/app/Console/Commands/Admin/EmojiMoveStorageLocalToCloud.php index 22e53a933..535a95130 100644 --- a/app/Console/Commands/Admin/EmojiMoveStorageLocalToCloud.php +++ b/app/Console/Commands/Admin/EmojiMoveStorageLocalToCloud.php @@ -36,7 +36,12 @@ class EmojiMoveStorageLocalToCloud extends Command public function handle(): int { - if (! (bool) config_cache('pixelfed.cloud_storage')) { + // Consider cloud enabled if either the live config or the (possibly + // 12h-cached) config_cache value says so, so a stale cache can't make + // this silently no-op right after cloud is turned on. + $cloudEnabled = (bool) config('pixelfed.cloud_storage') || (bool) config_cache('pixelfed.cloud_storage'); + + if (! $cloudEnabled) { $this->error('Cloud storage is not enabled (pixelfed.cloud_storage is false).'); return self::FAILURE; diff --git a/database/migrations/2026_08_30_050000_migrate_local_emoji_to_cloud.php b/database/migrations/2026_08_30_050000_migrate_local_emoji_to_cloud.php index 68be1c270..8df4910e4 100644 --- a/database/migrations/2026_08_30_050000_migrate_local_emoji_to_cloud.php +++ b/database/migrations/2026_08_30_050000_migrate_local_emoji_to_cloud.php @@ -15,7 +15,11 @@ return new class extends Migration */ public function up(): void { - if (! (bool) config_cache('pixelfed.cloud_storage')) { + // Consider cloud enabled if either the live config or the (possibly + // cached) config_cache value says so; the command guards again anyway. + $cloudEnabled = (bool) config('pixelfed.cloud_storage') || (bool) config_cache('pixelfed.cloud_storage'); + + if (! $cloudEnabled) { return; } diff --git a/resources/views/admin/custom-emoji/duplicates.blade.php b/resources/views/admin/custom-emoji/duplicates.blade.php index 51ff3a714..678175e94 100644 --- a/resources/views/admin/custom-emoji/duplicates.blade.php +++ b/resources/views/admin/custom-emoji/duplicates.blade.php @@ -28,7 +28,7 @@
- +

{{ $emoji->shortcode }}

@@ -62,7 +62,7 @@ @foreach($emojis as $emoji)
- +

{{ $emoji->shortcode }}

diff --git a/resources/views/admin/custom-emoji/home.blade.php b/resources/views/admin/custom-emoji/home.blade.php index 54ac5886e..cfd746a35 100644 --- a/resources/views/admin/custom-emoji/home.blade.php +++ b/resources/views/admin/custom-emoji/home.blade.php @@ -105,7 +105,7 @@ @foreach($emojis as $emoji)
- +

{{ $emoji->shortcode }}