Skip to content

Commit

Permalink
fix(DigestSender): Do not add and 1 more in digest mail but simply …
Browse files Browse the repository at this point in the history
…include it

1 more makes no sense as we can simply show that additional activity,
so instead show it if there is only one more activity.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Jul 11, 2024
1 parent 91b0768 commit e30344a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/DigestSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,26 @@ public function sendDigestForUser(string $uid, int $now, string $timezone, strin
return;
}

$activitiesLimit = self::ACTIVITY_LIMIT;
if ($count === $activitiesLimit + 1) {
// it makes no sense to have a "and 1 more" entry as it takes exactly the same space as the one entry more
$activitiesLimit += 1;
}

/** @var IEvent[] $activities */
$activities = $this->data->get(
$this->groupHelper,
$this->userSettings,
$uid,
$lastSend,
self::ACTIVITY_LIMIT,
$activitiesLimit,
'asc',
'by',
'',
0,
true
);
$skippedCount = max(0, $count - self::ACTIVITY_LIMIT);
$skippedCount = max(0, $count - $activitiesLimit);

$template = $this->mailer->createEMailTemplate('activity.Notification', [
'displayname' => $user->getDisplayName(),
Expand Down

0 comments on commit e30344a

Please sign in to comment.