aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-04-05 20:21:02 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-04-07 15:16:34 +0200
commit1dbe7dafe26f4a11af610f3ce0dea59c31227d78 (patch)
treed3d23bb86d3b4434c19dd925a97a53db704c8871 /lib/public
parent9c84aa5870204a871024ca18b4994ed40defdd9b (diff)
downloadnextcloud-server-1dbe7dafe26f4a11af610f3ce0dea59c31227d78.tar.gz
nextcloud-server-1dbe7dafe26f4a11af610f3ce0dea59c31227d78.zip
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/public')
-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;
+ }
}