From 6ce32da296cdab00477b3e6fd60dcb4abf774651 Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Tue, 30 Jul 2024 13:23:15 -0100 Subject: [PATCH] update members displayname on direct changes Signed-off-by: Maxence Lange --- lib/AppInfo/Application.php | 2 ++ lib/Listeners/AccountUpdated.php | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index fcd7d9fe0..505044beb 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -80,6 +80,7 @@ use OCP\Group\Events\UserAddedEvent; use OCP\Group\Events\UserRemovedEvent; use OCP\IServerContainer; +use OCP\User\Events\UserChangedEvent; use OCP\User\Events\UserCreatedEvent; use OCP\User\Events\UserDeletedEvent; use Throwable; @@ -115,6 +116,7 @@ public function register(IRegistrationContext $context): void { // User Events $context->registerEventListener(UserCreatedEvent::class, UserCreated::class); $context->registerEventListener(UserUpdatedEvent::class, AccountUpdated::class); + $context->registerEventListener(UserChangedEvent::class, AccountUpdated::class); $context->registerEventListener(UserDeletedEvent::class, UserDeleted::class); // Group Events diff --git a/lib/Listeners/AccountUpdated.php b/lib/Listeners/AccountUpdated.php index ac050c235..af8f09ee9 100644 --- a/lib/Listeners/AccountUpdated.php +++ b/lib/Listeners/AccountUpdated.php @@ -40,6 +40,7 @@ use OCP\Accounts\UserUpdatedEvent; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; +use OCP\User\Events\UserChangedEvent; use Psr\Log\LoggerInterface; class AccountUpdated implements IEventListener { @@ -57,7 +58,7 @@ public function __construct( * @param Event $event */ public function handle(Event $event): void { - if (!($event instanceof UserUpdatedEvent)) { + if (!($event instanceof UserUpdatedEvent) && !($event instanceof UserChangedEvent)) { return; }