Skip to content

Commit

Permalink
update members displayname on direct changes
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl committed Aug 8, 2024
1 parent 38b60d7 commit 62ff7b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion lib/Listeners/AccountUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
}

Expand Down

0 comments on commit 62ff7b3

Please sign in to comment.