diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-04-07 19:20:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 19:20:43 +0300 |
commit | 0f924e086aa5581ded9f29286e776f60e280ac78 (patch) | |
tree | 6ad52f65454b09d8fb1520c2375493d3df90a031 /lib | |
parent | d7e094836bc172b98cbc5b047b542486344093f4 (diff) | |
parent | 1dbe7dafe26f4a11af610f3ce0dea59c31227d78 (diff) |
Merge pull request #31850 from nextcloud/performance/heartbeat-fetch-status-once
Fetch status in heartbeat controller only once
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/User/Events/UserLiveStatusEvent.php | 31 |
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; + } } |