Skip to content

Commit

Permalink
Fix wrong config in album (#2741)
Browse files Browse the repository at this point in the history
  • Loading branch information
ildyria authored Nov 26, 2024
1 parent 002769b commit 701c785
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/Http/Resources/Models/SmartAlbumResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(BaseSmartAlbum $smartAlbum)
$this->prepPhotosCollection();

// setup timeline data
$photo_granularity = Configs::getValueAsEnum('timeline_photo_granularity', TimelinePhotoGranularity::class);
$photo_granularity = Configs::getValueAsEnum('timeline_photos_granularity', TimelinePhotoGranularity::class);
$this->photos = TimelineData::setTimeLineDataForPhotos($this->photos, $photo_granularity);
}

Expand Down
6 changes: 3 additions & 3 deletions app/Http/Resources/Traits/HasTimelineData.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ private function getAlbumTimeline(?TimelineAlbumGranularity $candidate): Timelin

private function getPhotoTimeline(?TimelinePhotoGranularity $candidate): TimelinePhotoGranularity
{
$default_timeline_photo_granularity = Configs::getValueAsEnum('timeline_photos_granularity', TimelinePhotoGranularity::class);
$default_timeline_photos_granularity = Configs::getValueAsEnum('timeline_photos_granularity', TimelinePhotoGranularity::class);

if ($candidate === TimelinePhotoGranularity::DEFAULT || $candidate === TimelinePhotoGranularity::DISABLED) {
return $default_timeline_photo_granularity;
return $default_timeline_photos_granularity;
}

return $candidate ?? $default_timeline_photo_granularity;
return $candidate ?? $default_timeline_photos_granularity;
}
}
25 changes: 25 additions & 0 deletions database/migrations/2024_11_26_125145_improve_info_timeline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class() extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
DB::table('configs')->where('key', '=', 'timeline_photos_layout')->update(['details' => "<span class='italic'>Not available yet.</span>"]);
DB::table('configs')->where('key', '=', 'timeline_photos_pagination_limit')->update(['details' => "<span class='italic'>Not available yet.</span>"]);
DB::table('configs')->where('key', '=', 'timeline_photos_enabled')->update(['details' => 'Globally enable photo timelines in each albums. This can also be disabled/enabled per album.']);
DB::table('configs')->where('key', '=', 'timeline_albums_enabled')->update(['details' => 'Globally enable albums timelines in each albums (and root). This can also be disabled/enabled per album.']);
}

/**
* Reverse the migrations.
*/
public function down(): void
{
DB::table('configs')->whereIn('key', ['timeline_photos_layout', 'timeline_photos_pagination_limit', 'timeline_photos_enabled', 'timeline_albums_enabled'])->update(['details' => '']);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</Select>
</div>
</div>
<div v-if="props.config.details" class="w-full text-muted-color text-sm -mt-4" v-html="props.config.details" />
</template>

<script setup lang="ts" generic="T extends string">
Expand Down
2 changes: 0 additions & 2 deletions resources/js/views/gallery-panels/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ const configForMenu = computed<App.Http.Resources.GalleryConfigs.AlbumConfig>(()
is_nsfw_warning_visible: false,
album_thumb_css_aspect_ratio: "aspect-square",
photo_layout: "justified",
timeline_album_granularity: "year",
timeline_photo_granularity: "day",
is_album_timeline_enabled: false,
is_photo_timeline_enabled: false,
};
Expand Down

0 comments on commit 701c785

Please sign in to comment.