Skip to content

Commit

Permalink
adjustments in dashboard widget declaration
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
  • Loading branch information
Julien Veyssier committed Sep 13, 2022
1 parent e0c1128 commit 1c5835a
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/Dashboard/ActivityWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,6 @@ class ActivityWidget implements IAPIWidget, IButtonWidget, IIconWidget {
private IDateTimeFormatter $dateTimeFormatter;
private IURLGenerator $urlGenerator;

/**
* ActivityWidget constructor.
* @param IL10N $l10n
* @param Data $data
* @param GroupHelper $helper
* @param UserSettings $settings
* @param IURLGenerator $urlGenerator
* @param IDateTimeFormatter $dateTimeFormatter
*/
public function __construct(IL10N $l10n,
Data $data,
GroupHelper $helper,
Expand Down Expand Up @@ -125,6 +116,8 @@ public function load(): void {
* @inheritDoc
*/
public function getItems(string $userId, ?string $since = null, int $limit = 7): array {
// we set the limit to 50 here because data->get might return less activity entries
// in the end we take the first 7 of'em
$activities = $this->data->get(
$this->helper,
$this->settings,
Expand All @@ -141,9 +134,7 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7):
$activity['subject'],
$this->dateTimeFormatter->formatTimeSpan($activity['timestamp']),
$activity['link'],
$this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->linkToRoute('core.avatar.getAvatar', ['userId' => $activity['affecteduser'], 'size' => 44])
),
$activity['icon'],
(string) $activity['activity_id']
);
}, array_slice($activities['data'], 0, $limit));
Expand Down

0 comments on commit 1c5835a

Please sign in to comment.