-
-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support more layouts + Timeline in albums/album (#2679)
- Loading branch information
Showing
53 changed files
with
1,171 additions
and
181 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace App\Contracts\Http\Requests; | ||
|
||
use App\Enum\TimelineAlbumGranularity; | ||
|
||
interface HasTimelineAlbum | ||
{ | ||
/** | ||
* @return TimelineAlbumGranularity|null | ||
*/ | ||
public function album_timeline(): ?TimelineAlbumGranularity; | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace App\Contracts\Http\Requests; | ||
|
||
use App\Enum\TimelinePhotoGranularity; | ||
|
||
interface HasTimelinePhoto | ||
{ | ||
/** | ||
* @return TimelinePhotoGranularity|null | ||
*/ | ||
public function photo_timeline(): ?TimelinePhotoGranularity; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace App\Enum; | ||
|
||
/** | ||
* Defines the possible granularities for album timelines. | ||
*/ | ||
enum TimelineAlbumGranularity: string | ||
{ | ||
case DEFAULT = 'default'; | ||
case DISABLED = 'disabled'; | ||
case YEAR = 'year'; | ||
case MONTH = 'month'; | ||
case DAY = 'day'; | ||
} |
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,16 @@ | ||
<?php | ||
|
||
namespace App\Enum; | ||
|
||
/** | ||
* Defines the possible granularities for photo timelines. | ||
*/ | ||
enum TimelinePhotoGranularity: string | ||
{ | ||
case DEFAULT = 'default'; | ||
case DISABLED = 'disabled'; | ||
case YEAR = 'year'; | ||
case MONTH = 'month'; | ||
case DAY = 'day'; | ||
case HOUR = 'hour'; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
// app/Http/Middleware/CacheControlMiddleware.php | ||
|
||
namespace App\Http\Middleware; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\DB; | ||
|
||
/** | ||
* Small update of the database to avoid sneaky people setting all the levels to 0 and thus skipping some checks... | ||
*/ | ||
class ConfigIntegrity | ||
{ | ||
private const SE_FIELDS = [ | ||
'default_user_quota', | ||
'timeline_photos_granularity', | ||
'timeline_albums_granularity', | ||
'timeline_left_border_enabled', | ||
'timeline_photo_date_format_year', | ||
'timeline_photo_date_format_month', | ||
'timeline_photo_date_format_day', | ||
'timeline_photo_date_format_hour', | ||
'timeline_album_date_format_year', | ||
'timeline_album_date_format_month', | ||
'timeline_album_date_format_day', | ||
]; | ||
|
||
/** | ||
* Handle an incoming request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next | ||
* | ||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse | ||
*/ | ||
public function handle(Request $request, \Closure $next) | ||
{ | ||
try { | ||
DB::table('configs')->whereIn('key', self::SE_FIELDS)->update(['level' => 1]); | ||
} catch (\Exception $e) { | ||
// Do nothing: we are not installed yet, so we fail silently. | ||
} | ||
|
||
return $next($request); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests\Traits; | ||
|
||
use App\Enum\TimelineAlbumGranularity; | ||
|
||
trait HasTimelineAlbumTrait | ||
{ | ||
protected ?TimelineAlbumGranularity $album_timeline = null; | ||
|
||
/** | ||
* @return TimelineAlbumGranularity|null | ||
*/ | ||
public function album_timeline(): ?TimelineAlbumGranularity | ||
{ | ||
return $this->album_timeline; | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests\Traits; | ||
|
||
use App\Enum\TimelinePhotoGranularity; | ||
|
||
trait HasTimelinePhotoTrait | ||
{ | ||
protected ?TimelinePhotoGranularity $photo_timeline = null; | ||
|
||
/** | ||
* @return TimelinePhotoGranularity|null | ||
*/ | ||
public function photo_timeline(): ?TimelinePhotoGranularity | ||
{ | ||
return $this->photo_timeline; | ||
} | ||
} |
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
Oops, something went wrong.