summaryrefslogtreecommitdiffstats
path: root/apps/user_status/lib/Dashboard/UserStatusWidget.php
diff options
context:
space:
mode:
authorJulien Veyssier <eneiluj@posteo.net>2022-09-07 13:11:44 +0200
committerJulien Veyssier <eneiluj@posteo.net>2022-09-15 18:06:21 +0200
commit500ba958f3ddfb203fae5638069e6631e054f084 (patch)
tree2ab9226e388c88a09d48a4654d1951852f3b8bf4 /apps/user_status/lib/Dashboard/UserStatusWidget.php
parent8e2e3b4a9f243b0a3d02b5dcdc9e7ef02d9c3d35 (diff)
downloadnextcloud-server-500ba958f3ddfb203fae5638069e6631e054f084.tar.gz
nextcloud-server-500ba958f3ddfb203fae5638069e6631e054f084.zip
implement IButtonWidget and IIconWidget in user_status
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'apps/user_status/lib/Dashboard/UserStatusWidget.php')
-rw-r--r--apps/user_status/lib/Dashboard/UserStatusWidget.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/apps/user_status/lib/Dashboard/UserStatusWidget.php b/apps/user_status/lib/Dashboard/UserStatusWidget.php
index 112e957cbcc..0e2ecbe54bf 100644
--- a/apps/user_status/lib/Dashboard/UserStatusWidget.php
+++ b/apps/user_status/lib/Dashboard/UserStatusWidget.php
@@ -30,6 +30,8 @@ use OCA\UserStatus\Db\UserStatus;
use OCA\UserStatus\Service\StatusService;
use OCP\AppFramework\Services\IInitialState;
use OCP\Dashboard\IAPIWidget;
+use OCP\Dashboard\IButtonWidget;
+use OCP\Dashboard\IIconWidget;
use OCP\Dashboard\Model\WidgetItem;
use OCP\IDateTimeFormatter;
use OCP\IL10N;
@@ -44,7 +46,7 @@ use OCP\Util;
*
* @package OCA\UserStatus
*/
-class UserStatusWidget implements IAPIWidget {
+class UserStatusWidget implements IAPIWidget, IButtonWidget, IIconWidget {
private IL10N $l10n;
private IDateTimeFormatter $dateTimeFormatter;
private IURLGenerator $urlGenerator;
@@ -111,6 +113,15 @@ class UserStatusWidget implements IAPIWidget {
/**
* @inheritDoc
*/
+ public function getIconUrl(): string {
+ return $this->urlGenerator->getAbsoluteURL(
+ $this->urlGenerator->imagePath(Application::APP_ID, 'app.svg')
+ );
+ }
+
+ /**
+ * @inheritDoc
+ */
public function getUrl(): ?string {
return null;
}
@@ -123,7 +134,7 @@ class UserStatusWidget implements IAPIWidget {
$currentUser = $this->userSession->getUser();
if ($currentUser === null) {
- $this->initialStateService->provideInitialState(Application::APP_ID, 'dashboard_data', []);
+ $this->initialStateService->provideInitialState('dashboard_data', []);
return;
}
$currentUserId = $currentUser->getUID();
@@ -175,7 +186,7 @@ class UserStatusWidget implements IAPIWidget {
$formattedDate = $this->dateTimeFormatter->formatTimeSpan($widgetData['timestamp']);
return new WidgetItem(
$widgetData['displayName'],
- $widgetData['icon'] . ' ' . $widgetData['message'] . ', ' . $formattedDate,
+ $widgetData['icon'] . ($widgetData['icon'] ? ' ' : '') . $widgetData['message'] . ', ' . $formattedDate,
// https://nextcloud.local/index.php/u/julien
$this->urlGenerator->getAbsoluteURL(
$this->urlGenerator->linkToRoute('core.ProfilePage.index', ['targetUserId' => $widgetData['userId']])
@@ -187,4 +198,11 @@ class UserStatusWidget implements IAPIWidget {
);
}, $widgetItemsData);
}
+
+ /**
+ * @inheritDoc
+ */
+ public function getWidgetButtons(string $userId): array {
+ return [];
+ }
}