diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2020-09-26 12:02:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-26 12:02:54 +0300 |
commit | dce3f20b2ad43ee063d549f8c7236f95d9f9d88f (patch) | |
tree | 5e16508a1a318f24ac0d82b51d53b3b4b9b38845 /lib | |
parent | 36251541eb57de2f9ea844ef8a1cc676d41192d2 (diff) | |
parent | eea37cf12e65304535e06507e363c3102ba1e9ab (diff) |
Merge pull request #4214 from nextcloud/bugfix/noid/bump-user-status-when-mobile-client-pulls-room
Set the user status when a mobile client polls for messages
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/ChatController.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index 5777a1bd1..5c2dd2b59 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -42,9 +42,11 @@ use OCP\Collaboration\Collaborators\ISearchResult; use OCP\Comments\IComment; use OCP\Comments\MessageTooLongException; use OCP\Comments\NotFoundException; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IL10N; use OCP\IRequest; use OCP\IUserManager; +use OCP\User\Events\UserLiveStatusEvent; use OCP\UserStatus\IManager as IUserStatusManager; use OCP\UserStatus\IUserStatus; @@ -86,6 +88,9 @@ class ChatController extends AEnvironmentAwareController { /** @var ISearchResult */ private $searchResult; + /** @var IEventDispatcher */ + private $eventDispatcher; + /** @var IL10N */ private $l; /** @var ITimeFactory */ @@ -104,6 +109,7 @@ class ChatController extends AEnvironmentAwareController { IUserStatusManager $statusManager, SearchPlugin $searchPlugin, ISearchResult $searchResult, + IEventDispatcher $eventDispatcher, ITimeFactory $timeFactory, IL10N $l) { parent::__construct($appName, $request); @@ -119,6 +125,7 @@ class ChatController extends AEnvironmentAwareController { $this->statusManager = $statusManager; $this->searchPlugin = $searchPlugin; $this->searchResult = $searchResult; + $this->eventDispatcher = $eventDispatcher; $this->timeFactory = $timeFactory; $this->l = $l; } @@ -267,6 +274,16 @@ class ChatController extends AEnvironmentAwareController { ]); if ($isMobileApp && $this->participant->getInCallFlags() === Participant::FLAG_DISCONNECTED) { $this->room->ping($this->participant->getUser(), $this->participant->getSessionId(), $this->timeFactory->getTime()); + + if ($lookIntoFuture) { + // Bump the user status again + $event = new UserLiveStatusEvent( + $this->userManager->get($this->participant->getUser()), + IUserStatus::ONLINE, + $this->timeFactory->getTime() + ); + $this->eventDispatcher->dispatchTyped($event); + } } } |