-
-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to disable smart albums individually. (#2468)
--------- Co-authored-by: Martin Stone <[email protected]>
- Loading branch information
Showing
7 changed files
with
186 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
database/migrations/2024_06_17_171051_disable_per_smart_album_config.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
use App\Models\Extensions\BaseConfigMigration; | ||
|
||
return new class() extends BaseConfigMigration { | ||
public const SMART_ALBUMS = 'Smart Albums'; | ||
public const BOOL = '0|1'; | ||
|
||
public function getConfigs(): array | ||
{ | ||
return [ | ||
[ | ||
'key' => 'enable_unsorted', | ||
'value' => '1', | ||
'is_secret' => false, | ||
'cat' => self::SMART_ALBUMS, | ||
'type_range' => self::BOOL, | ||
'description' => 'Enable Unsorted smart album. Warning! Disabling this will make pictures without an album invisible.', | ||
], | ||
[ | ||
'key' => 'enable_starred', | ||
'value' => '1', | ||
'is_secret' => false, | ||
'cat' => self::SMART_ALBUMS, | ||
'type_range' => self::BOOL, | ||
'description' => 'Enable Starred smart album.', | ||
], | ||
[ | ||
'key' => 'enable_recent', | ||
'value' => '1', | ||
'is_secret' => false, | ||
'cat' => self::SMART_ALBUMS, | ||
'type_range' => self::BOOL, | ||
'description' => 'Enable Recent uploads smart album.', | ||
], | ||
[ | ||
'key' => 'enable_on_this_day', | ||
'value' => '1', | ||
'is_secret' => false, | ||
'cat' => self::SMART_ALBUMS, | ||
'type_range' => self::BOOL, | ||
'description' => 'Enable On this day smart album.', | ||
], | ||
]; | ||
} | ||
}; |
46 changes: 46 additions & 0 deletions
46
database/migrations/2024_06_17_172448_remove_global_disable_smart_albums.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
return new class() extends Migration { | ||
public const SMART_ALBUMS = 'Smart Albums'; | ||
public const BOOL = '0|1'; | ||
public const TABLE = 'configs'; | ||
public const SA = 'SA_enabled'; | ||
public const UNSORTED = 'enable_unsorted'; | ||
public const STARRED = 'enable_starred'; | ||
public const RECENT = 'enable_recent'; | ||
public const ON_THIS_DAY = 'enable_on_this_day'; | ||
|
||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
$val = DB::table(self::TABLE)->select('value')->where('key', '=', self::SA)->first()->value; | ||
DB::table(self::TABLE)->whereIn('key', [ | ||
self::UNSORTED, | ||
self::STARRED, | ||
self::RECENT, | ||
self::ON_THIS_DAY, ])->update(['value' => $val]); | ||
DB::table(self::TABLE)->where('key', '=', self::SA)->delete(); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
DB::table(self::TABLE)->insert([ | ||
[ | ||
'key' => 'SA_enabled', | ||
'value' => '1', | ||
'is_secret' => false, | ||
'cat' => self::SMART_ALBUMS, | ||
'type_range' => self::BOOL, | ||
'description' => 'Enable Smart Albums.', | ||
], | ||
]); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters