-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
307 additions
and
770 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
File renamed without changes
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
28 changes: 28 additions & 0 deletions
28
src/migrations/Migration202406130001SetAutoloadModalToShowcaseReading.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,28 @@ | ||
<?php | ||
|
||
namespace App\migrations; | ||
|
||
class Migration202406130001SetAutoloadModalToShowcaseReading | ||
{ | ||
public function migrate(): bool | ||
{ | ||
$database = \Minz\Database::get(); | ||
|
||
$database->exec(<<<'SQL' | ||
UPDATE users SET autoload_modal = 'showcase reading'; | ||
SQL); | ||
|
||
return true; | ||
} | ||
|
||
public function rollback(): bool | ||
{ | ||
$database = \Minz\Database::get(); | ||
|
||
$database->exec(<<<'SQL' | ||
UPDATE users SET autoload_modal = ''; | ||
SQL); | ||
|
||
return true; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -10,9 +10,6 @@ | |
* | ||
* @phpstan-type Options array{ | ||
* 'number_links': int, | ||
* 'min_duration': ?int, | ||
* 'max_duration': ?int, | ||
* 'from': string, | ||
* } | ||
* | ||
* @author Marien Fressinaud <[email protected]> | ||
|
@@ -22,9 +19,6 @@ class NewsPicker | |
{ | ||
private const DEFAULT_OPTIONS = [ | ||
'number_links' => 9, | ||
'min_duration' => null, | ||
'max_duration' => null, | ||
'from' => 'bookmarks', | ||
]; | ||
|
||
private models\User $user; | ||
|
@@ -35,12 +29,9 @@ class NewsPicker | |
/** | ||
* @param array{ | ||
* 'number_links'?: int, | ||
* 'min_duration'?: ?int, | ||
* 'max_duration'?: ?int, | ||
* 'from'?: string, | ||
* } $options | ||
*/ | ||
public function __construct(models\User $user, array $options) | ||
public function __construct(models\User $user, array $options = []) | ||
{ | ||
$this->user = $user; | ||
$this->options = array_merge(self::DEFAULT_OPTIONS, $options); | ||
|
@@ -53,20 +44,7 @@ public function __construct(models\User $user, array $options) | |
*/ | ||
public function pick(): array | ||
{ | ||
if ($this->options['from'] === 'bookmarks') { | ||
$links = models\Link::listFromBookmarksForNews( | ||
$this->user->id, | ||
$this->options['min_duration'], | ||
$this->options['max_duration'], | ||
); | ||
} else { | ||
$links = models\Link::listFromFollowedCollectionsForNews( | ||
$this->user->id, | ||
$this->options['min_duration'], | ||
$this->options['max_duration'], | ||
); | ||
} | ||
|
||
$links = models\Link::listFromFollowedCollectionsForNews($this->user->id); | ||
$links = $this->mergeByUrl($links); | ||
return array_slice($links, 0, $this->options['number_links']); | ||
} | ||
|
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
Oops, something went wrong.