Skip to content

Commit 07a3cbe

Browse files
author
Julien Veyssier
committed
adjustments in dashboard widget declaration
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
1 parent e0c1128 commit 07a3cbe

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

lib/Dashboard/ActivityWidget.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ class ActivityWidget implements IAPIWidget, IButtonWidget, IIconWidget {
4747
private IDateTimeFormatter $dateTimeFormatter;
4848
private IURLGenerator $urlGenerator;
4949

50-
/**
51-
* ActivityWidget constructor.
52-
* @param IL10N $l10n
53-
* @param Data $data
54-
* @param GroupHelper $helper
55-
* @param UserSettings $settings
56-
* @param IURLGenerator $urlGenerator
57-
* @param IDateTimeFormatter $dateTimeFormatter
58-
*/
5950
public function __construct(IL10N $l10n,
6051
Data $data,
6152
GroupHelper $helper,
@@ -111,7 +102,9 @@ public function getIconUrl(): string {
111102
* @inheritDoc
112103
*/
113104
public function getUrl(): ?string {
114-
return null;
105+
return $this->urlGenerator->getAbsoluteURL(
106+
$this->urlGenerator->linkToRoute(Application::APP_ID . '.Activities.showList')
107+
);
115108
}
116109

117110
/**
@@ -125,6 +118,8 @@ public function load(): void {
125118
* @inheritDoc
126119
*/
127120
public function getItems(string $userId, ?string $since = null, int $limit = 7): array {
121+
// we set the limit to 50 here because data->get might return less activity entries
122+
// in the end we take the first 7 of'em
128123
$activities = $this->data->get(
129124
$this->helper,
130125
$this->settings,
@@ -141,9 +136,7 @@ public function getItems(string $userId, ?string $since = null, int $limit = 7):
141136
$activity['subject'],
142137
$this->dateTimeFormatter->formatTimeSpan($activity['timestamp']),
143138
$activity['link'],
144-
$this->urlGenerator->getAbsoluteURL(
145-
$this->urlGenerator->linkToRoute('core.avatar.getAvatar', ['userId' => $activity['affecteduser'], 'size' => 44])
146-
),
139+
$activity['icon'],
147140
(string) $activity['activity_id']
148141
);
149142
}, array_slice($activities['data'], 0, $limit));

0 commit comments

Comments
 (0)