Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-04-05 21:21:02 +0300
committerCarl Schwan <carl@carlschwan.eu>2022-04-07 16:16:34 +0300
commit1dbe7dafe26f4a11af610f3ce0dea59c31227d78 (patch)
treed3d23bb86d3b4434c19dd925a97a53db704c8871 /lib
parent9c84aa5870204a871024ca18b4994ed40defdd9b (diff)
Fetch status in heartbeat controller only once
Store the user status inside the event instead of fetching it again Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'lib')
-rw-r--r--lib/public/User/Events/UserLiveStatusEvent.php31
1 files changed, 20 insertions, 11 deletions
diff --git a/lib/public/User/Events/UserLiveStatusEvent.php b/lib/public/User/Events/UserLiveStatusEvent.php
index dd90400cb3b..4bba71f95b9 100644
--- a/lib/public/User/Events/UserLiveStatusEvent.php
+++ b/lib/public/User/Events/UserLiveStatusEvent.php
@@ -27,6 +27,7 @@ namespace OCP\User\Events;
use OCP\EventDispatcher\Event;
use OCP\IUser;
+use OCP\UserStatus\IUserStatus;
/**
* @since 20.0.0
@@ -51,19 +52,12 @@ class UserLiveStatusEvent extends Event {
*/
public const STATUS_OFFLINE = 'offline';
- /** @var IUser */
- private $user;
-
- /** @var string */
- private $status;
-
- /** @var int */
- private $timestamp;
+ private IUser $user;
+ private string $status;
+ private int $timestamp;
+ private ?IUserStatus $userStatus = null;
/**
- * @param IUser $user
- * @param string $status
- * @param int $timestamp
* @since 20.0.0
*/
public function __construct(IUser $user,
@@ -98,4 +92,19 @@ class UserLiveStatusEvent extends Event {
public function getTimestamp(): int {
return $this->timestamp;
}
+
+ /**
+ * Get the user status that might be available after processing the event
+ * @since 24.0.0
+ */
+ public function getUserStatus(): ?IUserStatus {
+ return $this->userStatus;
+ }
+
+ /**
+ * @since 24.0.0
+ */
+ public function setUserStatus(IUserStatus $userStatus) {
+ $this->userStatus = $userStatus;
+ }
}