Skip to content

Commit

Permalink
displayname switch to eventdispatcher
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Biller <s.biller@tu-braunschweig.de>
  • Loading branch information
Superjamp authored and juliushaertl committed Feb 24, 2022
1 parent fbccb70 commit b7451a8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/UserBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
use OCP\IURLGenerator;
use OCP\ISession;
use Symfony\Component\EventDispatcher\GenericEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\User\Events\UserChangedEvent;

class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
/** @var IConfig */
Expand Down Expand Up @@ -640,13 +642,8 @@ public function updateAttributes($uid,
$currentDisplayname = (string)$this->getDisplayName($uid);
if ($newDisplayname !== null
&& $currentDisplayname !== $newDisplayname) {
\OC_Hook::emit('OC_User', 'changeUser',
[
'user' => $user,
'feature' => 'displayName',
'value' => $newDisplayname
]
);
$dispatcher = \OC::$server->get(IEventDispatcher::class);
$dispatcher->dispatchTyped(new UserChangedEvent($user, 'displayName', $newDisplayname, $currentDisplayname));
$this->setDisplayName($uid, $newDisplayname);
}

Expand Down

0 comments on commit b7451a8

Please sign in to comment.