diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2020-08-17 22:13:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 22:13:45 +0200 |
commit | 565ccb08cd520f0f194c452567f12691aa07043f (patch) | |
tree | 50e8ec01476dd3d228c6154c3ea45e086589c893 /apps/files_sharing/lib/Controller | |
parent | 667552880488cd829e071a19d68d1faa0e57a7d7 (diff) | |
parent | 40bf38aaeea302dcd92ec587df9052d14f8953e6 (diff) | |
download | nextcloud-server-565ccb08cd520f0f194c452567f12691aa07043f.tar.gz nextcloud-server-565ccb08cd520f0f194c452567f12691aa07043f.zip |
Merge pull request #22109 from nextcloud/feature/20931/followup-1
Diffstat (limited to 'apps/files_sharing/lib/Controller')
-rw-r--r-- | apps/files_sharing/lib/Controller/ShareAPIController.php | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php index c629860df23..9ae192ff5d6 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -70,6 +70,7 @@ use OCP\Share\Exceptions\GenericShareException; use OCP\Share\Exceptions\ShareNotFound; use OCP\Share\IManager; use OCP\Share\IShare; +use OCP\UserStatus\IManager as IUserStatusManager; /** * Class Share20OCS @@ -100,6 +101,8 @@ class ShareAPIController extends OCSController { private $appManager; /** @var IServerContainer */ private $serverContainer; + /** @var IUserStatusManager */ + private $userStatusManager; /** * Share20OCS constructor. @@ -116,6 +119,7 @@ class ShareAPIController extends OCSController { * @param IConfig $config * @param IAppManager $appManager * @param IServerContainer $serverContainer + * @param IUserStatusManager $userStatusManager */ public function __construct( string $appName, @@ -129,7 +133,8 @@ class ShareAPIController extends OCSController { IL10N $l10n, IConfig $config, IAppManager $appManager, - IServerContainer $serverContainer + IServerContainer $serverContainer, + IUserStatusManager $userStatusManager ) { parent::__construct($appName, $request); @@ -144,6 +149,7 @@ class ShareAPIController extends OCSController { $this->config = $config; $this->appManager = $appManager; $this->serverContainer = $serverContainer; + $this->userStatusManager = $userStatusManager; } /** @@ -220,6 +226,20 @@ class ShareAPIController extends OCSController { $sharedWith = $this->userManager->get($share->getSharedWith()); $result['share_with'] = $share->getSharedWith(); $result['share_with_displayname'] = $sharedWith !== null ? $sharedWith->getDisplayName() : $share->getSharedWith(); + $result['status'] = []; + + $userStatuses = $this->userStatusManager->getUserStatuses([$share->getSharedWith()]); + $userStatus = array_shift($userStatuses); + if ($userStatus) { + $result['status'] = [ + 'status' => $userStatus->getStatus(), + 'message' => $userStatus->getMessage(), + 'icon' => $userStatus->getIcon(), + 'clearAt' => $userStatus->getClearAt() + ? (int)$userStatus->getClearAt()->format('U') + : null, + ]; + } } elseif ($share->getShareType() === IShare::TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); $result['share_with'] = $share->getSharedWith(); |