@@ -64,10 +64,10 @@ class User implements IUser {
6464 /** @var UserInterface|null */
6565 private $ backend ;
6666 /** @var EventDispatcherInterface */
67- private $ dispatcher ;
67+ private $ legacyDispatcher ;
6868
6969 /** @var IEventDispatcher */
70- private $ newDispatcher ;
70+ private $ dispatcher ;
7171
7272 /** @var bool */
7373 private $ enabled ;
@@ -93,7 +93,7 @@ class User implements IUser {
9393 public function __construct (string $ uid , ?UserInterface $ backend , EventDispatcherInterface $ dispatcher , $ emitter = null , IConfig $ config = null , $ urlGenerator = null ) {
9494 $ this ->uid = $ uid ;
9595 $ this ->backend = $ backend ;
96- $ this ->dispatcher = $ dispatcher ;
96+ $ this ->legacyDispatcher = $ dispatcher ;
9797 $ this ->emitter = $ emitter ;
9898 if (is_null ($ config )) {
9999 $ config = \OC ::$ server ->getConfig ();
@@ -107,7 +107,7 @@ public function __construct(string $uid, ?UserInterface $backend, EventDispatche
107107 $ this ->urlGenerator = \OC ::$ server ->getURLGenerator ();
108108 }
109109 // TODO: inject
110- $ this ->newDispatcher = \OC ::$ server ->query (IEventDispatcher::class);
110+ $ this ->dispatcher = \OC ::$ server ->query (IEventDispatcher::class);
111111 }
112112
113113 /**
@@ -211,7 +211,7 @@ public function updateLastLoginTimestamp() {
211211 * @return bool
212212 */
213213 public function delete () {
214- $ this ->dispatcher ->dispatch (IUser::class . '::preDelete ' , new GenericEvent ($ this ));
214+ $ this ->legacyDispatcher ->dispatch (IUser::class . '::preDelete ' , new GenericEvent ($ this ));
215215 if ($ this ->emitter ) {
216216 $ this ->emitter ->emit ('\OC\User ' , 'preDelete ' , [$ this ]);
217217 }
@@ -227,9 +227,9 @@ public function delete() {
227227 foreach ($ groupManager ->getUserGroupIds ($ this ) as $ groupId ) {
228228 $ group = $ groupManager ->get ($ groupId );
229229 if ($ group ) {
230- $ this ->newDispatcher ->dispatchTyped (new BeforeUserRemovedEvent ($ group , $ this ));
230+ $ this ->dispatcher ->dispatchTyped (new BeforeUserRemovedEvent ($ group , $ this ));
231231 $ group ->removeUser ($ this );
232- $ this ->newDispatcher ->dispatchTyped (new UserRemovedEvent ($ group , $ this ));
232+ $ this ->dispatcher ->dispatchTyped (new UserRemovedEvent ($ group , $ this ));
233233 }
234234 }
235235 // Delete the user's keys in preferences
@@ -260,7 +260,7 @@ public function delete() {
260260 $ accountManager = \OC ::$ server ->query (AccountManager::class);
261261 $ accountManager ->deleteUser ($ this );
262262
263- $ this ->dispatcher ->dispatch (IUser::class . '::postDelete ' , new GenericEvent ($ this ));
263+ $ this ->legacyDispatcher ->dispatch (IUser::class . '::postDelete ' , new GenericEvent ($ this ));
264264 if ($ this ->emitter ) {
265265 $ this ->emitter ->emit ('\OC\User ' , 'postDelete ' , [$ this ]);
266266 }
@@ -276,7 +276,7 @@ public function delete() {
276276 * @return bool
277277 */
278278 public function setPassword ($ password , $ recoveryPassword = null ) {
279- $ this ->dispatcher ->dispatch (IUser::class . '::preSetPassword ' , new GenericEvent ($ this , [
279+ $ this ->legacyDispatcher ->dispatch (IUser::class . '::preSetPassword ' , new GenericEvent ($ this , [
280280 'password ' => $ password ,
281281 'recoveryPassword ' => $ recoveryPassword ,
282282 ]));
@@ -285,7 +285,7 @@ public function setPassword($password, $recoveryPassword = null) {
285285 }
286286 if ($ this ->backend ->implementsActions (Backend::SET_PASSWORD )) {
287287 $ result = $ this ->backend ->setPassword ($ this ->uid , $ password );
288- $ this ->dispatcher ->dispatch (IUser::class . '::postSetPassword ' , new GenericEvent ($ this , [
288+ $ this ->legacyDispatcher ->dispatch (IUser::class . '::postSetPassword ' , new GenericEvent ($ this , [
289289 'password ' => $ password ,
290290 'recoveryPassword ' => $ recoveryPassword ,
291291 ]));
@@ -482,7 +482,7 @@ private function removeProtocolFromUrl($url) {
482482 }
483483
484484 public function triggerChange ($ feature , $ value = null , $ oldValue = null ) {
485- $ this ->dispatcher ->dispatch (IUser::class . '::changeUser ' , new GenericEvent ($ this , [
485+ $ this ->legacyDispatcher ->dispatch (IUser::class . '::changeUser ' , new GenericEvent ($ this , [
486486 'feature ' => $ feature ,
487487 'value ' => $ value ,
488488 'oldValue ' => $ oldValue ,
0 commit comments