Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp: Increase the default news period to 1 week #682

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified locales/fr_FR/LC_MESSAGES/main.mo
Binary file not shown.
14 changes: 7 additions & 7 deletions locales/fr_FR/LC_MESSAGES/main.po
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: Flus\n"
"POT-Creation-Date: 2024-06-13 15:29+0200\n"
"PO-Revision-Date: 2024-06-13 15:29+0200\n"
"POT-Creation-Date: 2024-06-27 14:28+0200\n"
"PO-Revision-Date: 2024-06-27 14:28+0200\n"
"Last-Translator: Marien Fressinaud <[email protected]>\n"
"Language-Team: \n"
"Language: fr_FR\n"
Expand Down Expand Up @@ -50,7 +50,7 @@ msgstr "Afficher"
#: controllers/Feeds.php:107 controllers/Groups.php:90
#: controllers/Links.php:270 controllers/Links.php:442
#: controllers/Mastodon.php:211 controllers/Mastodon.php:297
#: controllers/News.php:78 controllers/Passwords.php:89
#: controllers/News.php:77 controllers/Passwords.php:89
#: controllers/Passwords.php:192 controllers/Registrations.php:103
#: controllers/Sessions.php:85 controllers/Support.php:70
#: controllers/collections/Filters.php:105
Expand Down Expand Up @@ -870,11 +870,11 @@ msgstr "Normal"

#: views/collections/filters/edit.phtml:64
msgid ""
"You’ll receive the links published during the last 3 days (recommended for "
"most of the feeds)."
"You’ll receive the links published over the past week (recommended for most "
"of the feeds)."
msgstr ""
"Vous recevrez les liens publiés durant les 3 derniers jours (recommandé pour "
"la plupart des flux)."
"Vous recevrez les liens publiés au cours de la semaine passée (recommandé "
"pour la plupart des flux)."

#: views/collections/filters/edit.phtml:79
msgid "All"
Expand Down
4 changes: 2 additions & 2 deletions src/models/dao/links/NewsQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public static function listFromFollowedCollectionsForNews(string $user_id): arra
AND (
(fc.time_filter = 'strict' AND lc.created_at >= :until_strict) OR
(fc.time_filter = 'normal' AND lc.created_at >= :until_normal) OR
(fc.time_filter = 'all' AND lc.created_at >= fc.created_at - INTERVAL '3 days')
(fc.time_filter = 'all' AND lc.created_at >= fc.created_at - INTERVAL '1 week')
)
SQL;
$values[':until_strict'] = \Minz\Time::ago(1, 'day')->format(Database\Column::DATETIME_FORMAT);
$values[':until_normal'] = \Minz\Time::ago(3, 'days')->format(Database\Column::DATETIME_FORMAT);
$values[':until_normal'] = \Minz\Time::ago(1, 'week')->format(Database\Column::DATETIME_FORMAT);

$sql = <<<SQL
WITH excluded_links AS (
Expand Down
2 changes: 1 addition & 1 deletion src/views/collections/filters/edit.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</label>

<p class="form-group__caption form-group__caption--alt" id="time-filter-normal-caption">
<?= _('You’ll receive the links published during the last 3 days (recommended for most of the feeds).') ?>
<?= _('You’ll receive the links published over the past week (recommended for most of the feeds).') ?>
</p>
</div>

Expand Down
26 changes: 13 additions & 13 deletions tests/services/NewsPickerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testPickSelectsFromFollowed(): void
$now = $this->fake('dateTime');
$this->freeze($now);
/** @var int */
$days_ago = $this->fake('numberBetween', 0, 3);
$days_ago = $this->fake('numberBetween', 0, 7);
$published_at = \Minz\Time::ago($days_ago, 'days');
$news_picker = new NewsPicker($this->user);
$link = LinkFactory::create([
Expand Down Expand Up @@ -68,7 +68,7 @@ public function testPickSelectsHiddenLinkIfCollectionIsShared(): void
$now = $this->fake('dateTime');
$this->freeze($now);
/** @var int */
$days_ago = $this->fake('numberBetween', 0, 3);
$days_ago = $this->fake('numberBetween', 0, 7);
$published_at = \Minz\Time::ago($days_ago, 'days');
$news_picker = new NewsPicker($this->user);
$link = LinkFactory::create([
Expand Down Expand Up @@ -108,7 +108,7 @@ public function testPickSelectsFromPrivateCollectionIfShared(): void
$now = $this->fake('dateTime');
$this->freeze($now);
/** @var int */
$days_ago = $this->fake('numberBetween', 0, 3);
$days_ago = $this->fake('numberBetween', 0, 7);
$published_at = \Minz\Time::ago($days_ago, 'days');
$news_picker = new NewsPicker($this->user);
$link = LinkFactory::create([
Expand Down Expand Up @@ -148,11 +148,11 @@ public function testPickRespectsFromFollowedIfOldLinksButWithTimeFilterAll(): vo
$now = $this->fake('dateTime');
$this->freeze($now);
/** @var int */
$days_ago = $this->fake('numberBetween', 0, 9999);
$days_ago = $this->fake('numberBetween', 8, 9999);
$published_at = \Minz\Time::ago($days_ago, 'days');
// time_filter 'all' will search links until 3 days before the date
// time_filter 'all' will search links until 7 days before the date
// when the user started to follow the collection
$delta_followed_days = $this->fake('numberBetween', 0, 3);
$delta_followed_days = $this->fake('numberBetween', 0, 7);
$followed_at = \Minz\Time::ago($days_ago - $delta_followed_days, 'days');
$news_picker = new NewsPicker($this->user);
$link = LinkFactory::create([
Expand Down Expand Up @@ -190,7 +190,7 @@ public function testPickDoesNotPickFromFollowedIfTooOld(): void
$now = $this->fake('dateTime');
$this->freeze($now);
/** @var int */
$days_ago = $this->fake('numberBetween', 4, 9999);
$days_ago = $this->fake('numberBetween', 8, 9999);
$published_at = \Minz\Time::ago($days_ago, 'days');
$news_picker = new NewsPicker($this->user);
$link = LinkFactory::create([
Expand Down Expand Up @@ -257,7 +257,7 @@ public function testPickDoesNotSelectFromFollowedIfLinkIsHidden(): void
$now = $this->fake('dateTime');
$this->freeze($now);
/** @var int */
$days_ago = $this->fake('numberBetween', 0, 3);
$days_ago = $this->fake('numberBetween', 0, 7);
$published_at = \Minz\Time::ago($days_ago, 'days');
$news_picker = new NewsPicker($this->user);
$link = LinkFactory::create([
Expand Down Expand Up @@ -290,7 +290,7 @@ public function testPickDoesNotSelectFromFollowedIfCollectionIsPrivate(): void
$now = $this->fake('dateTime');
$this->freeze($now);
/** @var int */
$days_ago = $this->fake('numberBetween', 0, 3);
$days_ago = $this->fake('numberBetween', 0, 7);
$published_at = \Minz\Time::ago($days_ago, 'days');
$news_picker = new NewsPicker($this->user);
$link = LinkFactory::create([
Expand Down Expand Up @@ -323,7 +323,7 @@ public function testPickDoesNotSelectFromFollowedIfUrlInBookmarks(): void
$now = $this->fake('dateTime');
$this->freeze($now);
/** @var int */
$days_ago = $this->fake('numberBetween', 0, 3);
$days_ago = $this->fake('numberBetween', 0, 7);
$published_at = \Minz\Time::ago($days_ago, 'days');
$news_picker = new NewsPicker($this->user);
$bookmarks = $this->user->bookmarks();
Expand Down Expand Up @@ -368,7 +368,7 @@ public function testPickDoesNotSelectFromFollowedIfUrlInReadList(): void
$now = $this->fake('dateTime');
$this->freeze($now);
/** @var int */
$days_ago = $this->fake('numberBetween', 0, 3);
$days_ago = $this->fake('numberBetween', 0, 7);
$published_at = \Minz\Time::ago($days_ago, 'days');
$news_picker = new NewsPicker($this->user);
$read_list = $this->user->readList();
Expand Down Expand Up @@ -413,7 +413,7 @@ public function testPickDoesNotSelectFromFollowedIfUrlInNeverList(): void
$now = $this->fake('dateTime');
$this->freeze($now);
/** @var int */
$days_ago = $this->fake('numberBetween', 0, 3);
$days_ago = $this->fake('numberBetween', 0, 7);
$published_at = \Minz\Time::ago($days_ago, 'days');
$news_picker = new NewsPicker($this->user);
$never_list = $this->user->neverList();
Expand Down Expand Up @@ -463,7 +463,7 @@ public function testPickDoesNotSelectFromFollowedIfLinkIsOwned(): void
$now = $this->fake('dateTime');
$this->freeze($now);
/** @var int */
$days_ago = $this->fake('numberBetween', 0, 3);
$days_ago = $this->fake('numberBetween', 0, 7);
$published_at = \Minz\Time::ago($days_ago, 'days');
$news_picker = new NewsPicker($this->user);
$link = LinkFactory::create([
Expand Down
Loading