File tree Expand file tree Collapse file tree 5 files changed +50
-0
lines changed Expand file tree Collapse file tree 5 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1616    'OCA \\ContactsInteraction \\Db \\RecentContact '  => $ baseDir'/../lib/Db/RecentContact.php ' ,
1717    'OCA \\ContactsInteraction \\Db \\RecentContactMapper '  => $ baseDir'/../lib/Db/RecentContactMapper.php ' ,
1818    'OCA \\ContactsInteraction \\Listeners \\ContactInteractionListener '  => $ baseDir'/../lib/Listeners/ContactInteractionListener.php ' ,
19+     'OCA \\ContactsInteraction \\Listeners \\UserDeletedListener '  => $ baseDir'/../lib/Listeners/UserDeletedListener.php ' ,
1920    'OCA \\ContactsInteraction \\Migration \\Version010000Date20200304152605 '  => $ baseDir'/../lib/Migration/Version010000Date20200304152605.php ' ,
2021);
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ class ComposerStaticInitContactsInteraction
3131        'OCA \\ContactsInteraction \\Db \\RecentContact '  => __DIR__  . '/.. '  . '/../lib/Db/RecentContact.php ' ,
3232        'OCA \\ContactsInteraction \\Db \\RecentContactMapper '  => __DIR__  . '/.. '  . '/../lib/Db/RecentContactMapper.php ' ,
3333        'OCA \\ContactsInteraction \\Listeners \\ContactInteractionListener '  => __DIR__  . '/.. '  . '/../lib/Listeners/ContactInteractionListener.php ' ,
34+         'OCA \\ContactsInteraction \\Listeners \\UserDeletedListener '  => __DIR__  . '/.. '  . '/../lib/Listeners/UserDeletedListener.php ' ,
3435        'OCA \\ContactsInteraction \\Migration \\Version010000Date20200304152605 '  => __DIR__  . '/.. '  . '/../lib/Migration/Version010000Date20200304152605.php ' ,
3536    );
3637
Original file line number Diff line number Diff line change 99namespace  OCA \ContactsInteraction \AppInfo ;
1010
1111use  OCA \ContactsInteraction \Listeners \ContactInteractionListener ;
12+ use  OCA \ContactsInteraction \Listeners \UserDeletedListener ;
1213use  OCP \AppFramework \App ;
1314use  OCP \AppFramework \Bootstrap \IBootContext ;
1415use  OCP \AppFramework \Bootstrap \IBootstrap ;
1516use  OCP \AppFramework \Bootstrap \IRegistrationContext ;
1617use  OCP \Contacts \Events \ContactInteractedWithEvent ;
18+ use  OCP \User \Events \UserDeletedEvent ;
1719
1820class  Application extends  App implements  IBootstrap {
1921	public  const  APP_ID  = 'contactsinteraction ' ;
@@ -24,6 +26,7 @@ public function __construct() {
2426
2527	public  function  register (IRegistrationContext $ contextvoid  {
2628		$ contextregisterEventListener (ContactInteractedWithEvent::class, ContactInteractionListener::class);
29+ 		$ contextregisterEventListener (UserDeletedEvent::class, UserDeletedListener::class);
2730	}
2831
2932	public  function  boot (IBootContext $ contextvoid  {
Original file line number Diff line number Diff line change @@ -112,4 +112,14 @@ public function cleanUp(int $olderThan): void {
112112
113113		$ deleteexecuteStatement ();
114114	}
115+ 
116+ 	public  function  deleteByUserId (string  $ uidvoid  {
117+ 		$ qb$ this db ->getQueryBuilder ();
118+ 
119+ 		$ delete$ qb
120+ 			->delete ($ this getTableName ())
121+ 			->where ($ qbexpr ()->eq ('actor_uid ' , $ qbcreateNamedParameter ($ uid
122+ 
123+ 		$ deleteexecuteStatement ();
124+ 	}
115125}
Original file line number Diff line number Diff line change 1+ <?php 
2+ 
3+ declare (strict_types=1 );
4+ 
5+ /** 
6+  * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors 
7+  * SPDX-License-Identifier: AGPL-3.0-or-later 
8+  */ 
9+ 
10+ namespace  OCA \ContactsInteraction \Listeners ;
11+ 
12+ use  OCA \ContactsInteraction \Db \RecentContactMapper ;
13+ use  OCP \EventDispatcher \Event ;
14+ use  OCP \EventDispatcher \IEventListener ;
15+ use  OCP \User \Events \UserDeletedEvent ;
16+ 
17+ /** 
18+  * @template-implements IEventListener<Event|UserDeletedEvent> 
19+  */ 
20+ class  UserDeletedListener implements  IEventListener {
21+ 
22+ 	public  function  __construct (
23+ 		private  readonly  RecentContactMapper $ recentContactMapper
24+ 	) {
25+ 	}
26+ 
27+ 	#[\Override]
28+ 	public  function  handle (Event $ eventvoid  {
29+ 		if  (!($ eventinstanceof  UserDeletedEvent)) {
30+ 			return ;
31+ 		}
32+ 
33+ 		$ this recentContactMapper ->deleteByUserId ($ eventgetUser ()->getUID ());
34+ 	}
35+ }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments