aboutsummaryrefslogtreecommitdiffstats
path: root/apps/user_status/lib
diff options
context:
space:
mode:
authorAnna Larch <anna@nextcloud.com>2024-08-13 16:27:51 +0200
committerRichard Steinmetz <richard@steinmetz.cloud>2024-08-14 09:44:26 +0200
commit0634aa710c6b7fa1e006e0aca56c5db48d77cd38 (patch)
tree4a264fba65b7b0867865f422c6dd9156beb7c40f /apps/user_status/lib
parentcee227ae993f02cf0c72ebcb103db4223b1b07a8 (diff)
downloadnextcloud-server-0634aa710c6b7fa1e006e0aca56c5db48d77cd38.tar.gz
nextcloud-server-0634aa710c6b7fa1e006e0aca56c5db48d77cd38.zip
fix(userstatus): run user status automation job for start and end events
Signed-off-by: Anna Larch <anna@nextcloud.com> Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
Diffstat (limited to 'apps/user_status/lib')
-rw-r--r--apps/user_status/lib/AppInfo/Application.php4
-rw-r--r--apps/user_status/lib/Listener/OutOfOfficeStatusListener.php9
2 files changed, 11 insertions, 2 deletions
diff --git a/apps/user_status/lib/AppInfo/Application.php b/apps/user_status/lib/AppInfo/Application.php
index 31b7342e40b..5199c3fdbf0 100644
--- a/apps/user_status/lib/AppInfo/Application.php
+++ b/apps/user_status/lib/AppInfo/Application.php
@@ -23,7 +23,9 @@ use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent;
use OCP\IConfig;
use OCP\User\Events\OutOfOfficeChangedEvent;
use OCP\User\Events\OutOfOfficeClearedEvent;
+use OCP\User\Events\OutOfOfficeEndedEvent;
use OCP\User\Events\OutOfOfficeScheduledEvent;
+use OCP\User\Events\OutOfOfficeStartedEvent;
use OCP\User\Events\UserDeletedEvent;
use OCP\User\Events\UserLiveStatusEvent;
use OCP\UserStatus\IManager;
@@ -61,6 +63,8 @@ class Application extends App implements IBootstrap {
$context->registerEventListener(OutOfOfficeChangedEvent::class, OutOfOfficeStatusListener::class);
$context->registerEventListener(OutOfOfficeScheduledEvent::class, OutOfOfficeStatusListener::class);
$context->registerEventListener(OutOfOfficeClearedEvent::class, OutOfOfficeStatusListener::class);
+ $context->registerEventListener(OutOfOfficeStartedEvent::class, OutOfOfficeStatusListener::class);
+ $context->registerEventListener(OutOfOfficeEndedEvent::class, OutOfOfficeStatusListener::class);
$config = $this->getContainer()->query(IConfig::class);
$shareeEnumeration = $config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes';
diff --git a/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php b/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php
index 7b1a91ead8c..7fe08e9719b 100644
--- a/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php
+++ b/apps/user_status/lib/Listener/OutOfOfficeStatusListener.php
@@ -15,14 +15,16 @@ use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\User\Events\OutOfOfficeChangedEvent;
use OCP\User\Events\OutOfOfficeClearedEvent;
+use OCP\User\Events\OutOfOfficeEndedEvent;
use OCP\User\Events\OutOfOfficeScheduledEvent;
+use OCP\User\Events\OutOfOfficeStartedEvent;
use OCP\UserStatus\IManager;
use OCP\UserStatus\IUserStatus;
/**
* Class UserDeletedListener
*
- * @template-implements IEventListener<OutOfOfficeScheduledEvent|OutOfOfficeChangedEvent|OutOfOfficeClearedEvent>
+ * @template-implements IEventListener<OutOfOfficeScheduledEvent|OutOfOfficeChangedEvent|OutOfOfficeClearedEvent|OutOfOfficeStartedEvent|OutOfOfficeEndedEvent>
*
*/
class OutOfOfficeStatusListener implements IEventListener {
@@ -42,7 +44,10 @@ class OutOfOfficeStatusListener implements IEventListener {
}
if ($event instanceof OutOfOfficeScheduledEvent
- || $event instanceof OutOfOfficeChangedEvent) {
+ || $event instanceof OutOfOfficeChangedEvent
+ || $event instanceof OutOfOfficeStartedEvent
+ || $event instanceof OutOfOfficeEndedEvent
+ ) {
// This might be overwritten by the office hours automation, but that is ok. This is just in case no office hours are set
$this->jobsList->scheduleAfter(UserStatusAutomation::class, $this->time->getTime(), ['userId' => $event->getData()->getUser()->getUID()]);
}