#75: Reworked the way metadata is calculated so empty albums are not displayed as upgradable. Also improved the "no albums" message, as it's no longer accurate.
This commit is contained in:
parent
309d97cb75
commit
534c8f6090
@ -78,7 +78,6 @@ class DefaultController extends Controller
|
||||
|
||||
public function metadataUpgrade()
|
||||
{
|
||||
$albums = DbHelper::getAlbumsForCurrentUser();
|
||||
$albumIDs = DbHelper::getAlbumIDsForCurrentUser();
|
||||
|
||||
$photoMetadata = DB::table('photos')
|
||||
@ -90,14 +89,28 @@ class DefaultController extends Controller
|
||||
->groupBy('album_id')
|
||||
->get();
|
||||
|
||||
$resultingAlbumIDs = [];
|
||||
foreach ($photoMetadata as $metadata)
|
||||
{
|
||||
if (isset($metadata->min_metadata_version) && $metadata->min_metadata_version > 0)
|
||||
{
|
||||
$resultingAlbumIDs[$metadata->album_id] = $metadata->min_metadata_version;
|
||||
}
|
||||
}
|
||||
|
||||
// Now load the full album definitions
|
||||
$albumsQuery = DbHelper::getAlbumsForCurrentUser_NonPaged();
|
||||
$albumsQuery->whereIn('id', array_keys($resultingAlbumIDs));
|
||||
$albums = $albumsQuery->paginate(UserConfig::get('items_per_page'));
|
||||
|
||||
/** @var Album $album */
|
||||
foreach ($resultingAlbumIDs as $albumID => $metadataMinVersion)
|
||||
{
|
||||
foreach ($albums as $album)
|
||||
{
|
||||
if ($album->id == $metadata->album_id)
|
||||
if ($album->id == $albumID)
|
||||
{
|
||||
$album->min_metadata_version = $metadata->min_metadata_version;
|
||||
$album->min_metadata_version = $metadataMinVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -127,6 +127,7 @@ return [
|
||||
'is_uploading' => 'Uploading in progress...',
|
||||
'labels_intro' => 'Your labels are displayed below. The number in brackets indicates the number of photos linked to that label. Click a label to delete it.',
|
||||
'legend' => 'Legend/Key',
|
||||
'list_albums' => 'Go to your albums',
|
||||
'list_albums_intro' => 'Albums contain collections of individual photographs in the same way as a physical photo album or memory book.',
|
||||
'list_albums_title' => 'Albums',
|
||||
'list_groups_intro' => 'Organise your users into categories or types by using groups. You can assign permissions on albums to groups of users to make administration and management easier.',
|
||||
@ -140,6 +141,8 @@ return [
|
||||
'manage_widget' => [
|
||||
'panel_header' => 'Manage'
|
||||
],
|
||||
'metadata_no_albums_text' => 'You have no photo albums yet or all your albums are empty. Click the button below to list your albums or create a new album.',
|
||||
'metadata_no_albums_title' => 'No Albums or Photos',
|
||||
'metadata_upgrade' => [
|
||||
'can_be_upgraded' => 'Metadata can be updated (version :version_from » :version_to)',
|
||||
'confirm' => 'Are you sure you want to update the metadata of the :name album?',
|
||||
|
@ -18,10 +18,10 @@
|
||||
|
||||
@if (count($albums) == 0)
|
||||
<div class="text-center mt-5">
|
||||
<h4 class="text-danger"><b>@lang('admin.no_albums_title')</b></h4>
|
||||
<p>@lang('admin.no_albums_text')</p>
|
||||
<h4 class="text-danger"><b>@lang('admin.metadata_no_albums_title')</b></h4>
|
||||
<p>@lang('admin.metadata_no_albums_text')</p>
|
||||
<p style="margin-top: 40px;">
|
||||
<a href="{{ route('albums.create') }}" class="btn btn-lg btn-success"><i class="fa fa-fw fa-plus"></i> @lang('admin.create_album')</a>
|
||||
<a href="{{ route('albums.index') }}" class="btn btn-lg btn-success"><i class="fa fa-fw fa-plus"></i> @lang('admin.list_albums')</a>
|
||||
</p>
|
||||
</div>
|
||||
@else
|
||||
|
@ -13,7 +13,11 @@
|
||||
<p>{{ $album->description }}</p>
|
||||
<p style="margin-bottom: 0;">
|
||||
<b>{{ $album->photos_count }}</b> {{ trans_choice('admin.stats_widget.photos', $album->photos_count) }} ·
|
||||
@if ($album->min_metadata_version < $current_metadata_version)
|
||||
@if (
|
||||
isset($album->min_metadata_version) &&
|
||||
intval($album->min_metadata_version) > 0 &&
|
||||
intval($album->min_metadata_version) < $current_metadata_version
|
||||
)
|
||||
<span class="text-danger">@lang('admin.metadata_upgrade.can_be_upgraded', ['version_from' => $album->min_metadata_version, 'version_to' => $current_metadata_version])</span>
|
||||
@else
|
||||
<span class="text-success">@lang('admin.metadata_upgrade.is_up_to_date')</span>
|
||||
|
Loading…
Reference in New Issue
Block a user