Completed
Push — master ( 4927a2...480517 )
by Daniel
23:52 queued 02:15
created
apps/contactsinteraction/lib/AppInfo/Application.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@
 block discarded – undo
18 18
 use OCP\User\Events\UserDeletedEvent;
19 19
 
20 20
 class Application extends App implements IBootstrap {
21
-	public const APP_ID = 'contactsinteraction';
21
+    public const APP_ID = 'contactsinteraction';
22 22
 
23
-	public function __construct() {
24
-		parent::__construct(self::APP_ID);
25
-	}
23
+    public function __construct() {
24
+        parent::__construct(self::APP_ID);
25
+    }
26 26
 
27
-	public function register(IRegistrationContext $context): void {
28
-		$context->registerEventListener(ContactInteractedWithEvent::class, ContactInteractionListener::class);
29
-		$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
30
-	}
27
+    public function register(IRegistrationContext $context): void {
28
+        $context->registerEventListener(ContactInteractedWithEvent::class, ContactInteractionListener::class);
29
+        $context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
30
+    }
31 31
 
32
-	public function boot(IBootContext $context): void {
33
-	}
32
+    public function boot(IBootContext $context): void {
33
+    }
34 34
 }
Please login to merge, or discard this patch.
apps/contactsinteraction/lib/Db/RecentContactMapper.php 1 patch
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -17,109 +17,109 @@
 block discarded – undo
17 17
  * @template-extends QBMapper<RecentContact>
18 18
  */
19 19
 class RecentContactMapper extends QBMapper {
20
-	public const TABLE_NAME = 'recent_contact';
21
-
22
-	public function __construct(IDBConnection $db) {
23
-		parent::__construct($db, self::TABLE_NAME);
24
-	}
25
-
26
-	/**
27
-	 * @return RecentContact[]
28
-	 */
29
-	public function findAll(string $uid): array {
30
-		$qb = $this->db->getQueryBuilder();
31
-
32
-		$select = $qb
33
-			->select('*')
34
-			->from($this->getTableName())
35
-			->where($qb->expr()->eq('actor_uid', $qb->createNamedParameter($uid)));
36
-
37
-		return $this->findEntities($select);
38
-	}
39
-
40
-	/**
41
-	 * @throws DoesNotExistException
42
-	 */
43
-	public function find(string $uid, int $id): RecentContact {
44
-		$qb = $this->db->getQueryBuilder();
45
-
46
-		$select = $qb
47
-			->select('*')
48
-			->from($this->getTableName())
49
-			->where($qb->expr()->eq('id', $qb->createNamedParameter($id, $qb::PARAM_INT)))
50
-			->andWhere($qb->expr()->eq('actor_uid', $qb->createNamedParameter($uid)));
51
-
52
-		return $this->findEntity($select);
53
-	}
54
-
55
-	/**
56
-	 * @return RecentContact[]
57
-	 */
58
-	public function findMatch(IUser $user,
59
-		?string $uid,
60
-		?string $email,
61
-		?string $cloudId): array {
62
-		$qb = $this->db->getQueryBuilder();
63
-
64
-		$additionalWheres = [];
65
-		if ($uid !== null) {
66
-			$additionalWheres[] = $qb->expr()->eq('uid', $qb->createNamedParameter($uid));
67
-		}
68
-		if ($email !== null) {
69
-			$additionalWheres[] = $qb->expr()->eq('email', $qb->createNamedParameter($email));
70
-		}
71
-		if ($cloudId !== null) {
72
-			$additionalWheres[] = $qb->expr()->eq('federated_cloud_id', $qb->createNamedParameter($cloudId));
73
-		}
74
-
75
-		$select = $qb
76
-			->select('*')
77
-			->from($this->getTableName())
78
-			->where($qb->expr()->eq('actor_uid', $qb->createNamedParameter($user->getUID())));
79
-
80
-		if (!empty($additionalWheres)) {
81
-			$select->andWhere($select->expr()->orX(...$additionalWheres));
82
-		}
83
-		return $this->findEntities($select);
84
-	}
85
-
86
-	public function findLastUpdatedForUserId(string $uid): ?int {
87
-		$qb = $this->db->getQueryBuilder();
88
-
89
-		$select = $qb
90
-			->select('last_contact')
91
-			->from($this->getTableName())
92
-			->where($qb->expr()->eq('actor_uid', $qb->createNamedParameter($uid)))
93
-			->orderBy('last_contact', 'DESC')
94
-			->setMaxResults(1);
95
-
96
-		$cursor = $select->executeQuery();
97
-		$row = $cursor->fetch();
98
-
99
-		if ($row === false) {
100
-			return null;
101
-		}
102
-
103
-		return (int)$row['last_contact'];
104
-	}
105
-
106
-	public function cleanUp(int $olderThan): void {
107
-		$qb = $this->db->getQueryBuilder();
108
-
109
-		$delete = $qb
110
-			->delete($this->getTableName())
111
-			->where($qb->expr()->lt('last_contact', $qb->createNamedParameter($olderThan)));
112
-
113
-		$delete->executeStatement();
114
-	}
115
-
116
-	public function deleteByUserId(string $uid): void {
117
-		$qb = $this->db->getQueryBuilder();
118
-
119
-		$delete = $qb
120
-			->delete($this->getTableName())
121
-			->where($qb->expr()->eq('actor_uid', $qb->createNamedParameter($uid)));
122
-
123
-		$delete->executeStatement();
124
-	}
20
+    public const TABLE_NAME = 'recent_contact';
21
+
22
+    public function __construct(IDBConnection $db) {
23
+        parent::__construct($db, self::TABLE_NAME);
24
+    }
25
+
26
+    /**
27
+     * @return RecentContact[]
28
+     */
29
+    public function findAll(string $uid): array {
30
+        $qb = $this->db->getQueryBuilder();
31
+
32
+        $select = $qb
33
+            ->select('*')
34
+            ->from($this->getTableName())
35
+            ->where($qb->expr()->eq('actor_uid', $qb->createNamedParameter($uid)));
36
+
37
+        return $this->findEntities($select);
38
+    }
39
+
40
+    /**
41
+     * @throws DoesNotExistException
42
+     */
43
+    public function find(string $uid, int $id): RecentContact {
44
+        $qb = $this->db->getQueryBuilder();
45
+
46
+        $select = $qb
47
+            ->select('*')
48
+            ->from($this->getTableName())
49
+            ->where($qb->expr()->eq('id', $qb->createNamedParameter($id, $qb::PARAM_INT)))
50
+            ->andWhere($qb->expr()->eq('actor_uid', $qb->createNamedParameter($uid)));
51
+
52
+        return $this->findEntity($select);
53
+    }
54
+
55
+    /**
56
+     * @return RecentContact[]
57
+     */
58
+    public function findMatch(IUser $user,
59
+        ?string $uid,
60
+        ?string $email,
61
+        ?string $cloudId): array {
62
+        $qb = $this->db->getQueryBuilder();
63
+
64
+        $additionalWheres = [];
65
+        if ($uid !== null) {
66
+            $additionalWheres[] = $qb->expr()->eq('uid', $qb->createNamedParameter($uid));
67
+        }
68
+        if ($email !== null) {
69
+            $additionalWheres[] = $qb->expr()->eq('email', $qb->createNamedParameter($email));
70
+        }
71
+        if ($cloudId !== null) {
72
+            $additionalWheres[] = $qb->expr()->eq('federated_cloud_id', $qb->createNamedParameter($cloudId));
73
+        }
74
+
75
+        $select = $qb
76
+            ->select('*')
77
+            ->from($this->getTableName())
78
+            ->where($qb->expr()->eq('actor_uid', $qb->createNamedParameter($user->getUID())));
79
+
80
+        if (!empty($additionalWheres)) {
81
+            $select->andWhere($select->expr()->orX(...$additionalWheres));
82
+        }
83
+        return $this->findEntities($select);
84
+    }
85
+
86
+    public function findLastUpdatedForUserId(string $uid): ?int {
87
+        $qb = $this->db->getQueryBuilder();
88
+
89
+        $select = $qb
90
+            ->select('last_contact')
91
+            ->from($this->getTableName())
92
+            ->where($qb->expr()->eq('actor_uid', $qb->createNamedParameter($uid)))
93
+            ->orderBy('last_contact', 'DESC')
94
+            ->setMaxResults(1);
95
+
96
+        $cursor = $select->executeQuery();
97
+        $row = $cursor->fetch();
98
+
99
+        if ($row === false) {
100
+            return null;
101
+        }
102
+
103
+        return (int)$row['last_contact'];
104
+    }
105
+
106
+    public function cleanUp(int $olderThan): void {
107
+        $qb = $this->db->getQueryBuilder();
108
+
109
+        $delete = $qb
110
+            ->delete($this->getTableName())
111
+            ->where($qb->expr()->lt('last_contact', $qb->createNamedParameter($olderThan)));
112
+
113
+        $delete->executeStatement();
114
+    }
115
+
116
+    public function deleteByUserId(string $uid): void {
117
+        $qb = $this->db->getQueryBuilder();
118
+
119
+        $delete = $qb
120
+            ->delete($this->getTableName())
121
+            ->where($qb->expr()->eq('actor_uid', $qb->createNamedParameter($uid)));
122
+
123
+        $delete->executeStatement();
124
+    }
125 125
 }
Please login to merge, or discard this patch.
apps/contactsinteraction/lib/Listeners/UserDeletedListener.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,17 +19,17 @@
 block discarded – undo
19 19
  */
20 20
 class UserDeletedListener implements IEventListener {
21 21
 
22
-	public function __construct(
23
-		private readonly RecentContactMapper $recentContactMapper,
24
-	) {
25
-	}
26
-
27
-	#[\Override]
28
-	public function handle(Event $event): void {
29
-		if (!($event instanceof UserDeletedEvent)) {
30
-			return;
31
-		}
32
-
33
-		$this->recentContactMapper->deleteByUserId($event->getUser()->getUID());
34
-	}
22
+    public function __construct(
23
+        private readonly RecentContactMapper $recentContactMapper,
24
+    ) {
25
+    }
26
+
27
+    #[\Override]
28
+    public function handle(Event $event): void {
29
+        if (!($event instanceof UserDeletedEvent)) {
30
+            return;
31
+        }
32
+
33
+        $this->recentContactMapper->deleteByUserId($event->getUser()->getUID());
34
+    }
35 35
 }
Please login to merge, or discard this patch.
apps/contactsinteraction/composer/composer/autoload_classmap.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10
-    'OCA\\ContactsInteraction\\AddressBook' => $baseDir . '/../lib/AddressBook.php',
11
-    'OCA\\ContactsInteraction\\AddressBookProvider' => $baseDir . '/../lib/AddressBookProvider.php',
12
-    'OCA\\ContactsInteraction\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
13
-    'OCA\\ContactsInteraction\\BackgroundJob\\CleanupJob' => $baseDir . '/../lib/BackgroundJob/CleanupJob.php',
14
-    'OCA\\ContactsInteraction\\Card' => $baseDir . '/../lib/Card.php',
15
-    'OCA\\ContactsInteraction\\Db\\CardSearchDao' => $baseDir . '/../lib/Db/CardSearchDao.php',
16
-    'OCA\\ContactsInteraction\\Db\\RecentContact' => $baseDir . '/../lib/Db/RecentContact.php',
17
-    'OCA\\ContactsInteraction\\Db\\RecentContactMapper' => $baseDir . '/../lib/Db/RecentContactMapper.php',
18
-    'OCA\\ContactsInteraction\\Listeners\\ContactInteractionListener' => $baseDir . '/../lib/Listeners/ContactInteractionListener.php',
19
-    'OCA\\ContactsInteraction\\Listeners\\UserDeletedListener' => $baseDir . '/../lib/Listeners/UserDeletedListener.php',
20
-    'OCA\\ContactsInteraction\\Migration\\Version010000Date20200304152605' => $baseDir . '/../lib/Migration/Version010000Date20200304152605.php',
9
+    'Composer\\InstalledVersions' => $vendorDir.'/composer/InstalledVersions.php',
10
+    'OCA\\ContactsInteraction\\AddressBook' => $baseDir.'/../lib/AddressBook.php',
11
+    'OCA\\ContactsInteraction\\AddressBookProvider' => $baseDir.'/../lib/AddressBookProvider.php',
12
+    'OCA\\ContactsInteraction\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php',
13
+    'OCA\\ContactsInteraction\\BackgroundJob\\CleanupJob' => $baseDir.'/../lib/BackgroundJob/CleanupJob.php',
14
+    'OCA\\ContactsInteraction\\Card' => $baseDir.'/../lib/Card.php',
15
+    'OCA\\ContactsInteraction\\Db\\CardSearchDao' => $baseDir.'/../lib/Db/CardSearchDao.php',
16
+    'OCA\\ContactsInteraction\\Db\\RecentContact' => $baseDir.'/../lib/Db/RecentContact.php',
17
+    'OCA\\ContactsInteraction\\Db\\RecentContactMapper' => $baseDir.'/../lib/Db/RecentContactMapper.php',
18
+    'OCA\\ContactsInteraction\\Listeners\\ContactInteractionListener' => $baseDir.'/../lib/Listeners/ContactInteractionListener.php',
19
+    'OCA\\ContactsInteraction\\Listeners\\UserDeletedListener' => $baseDir.'/../lib/Listeners/UserDeletedListener.php',
20
+    'OCA\\ContactsInteraction\\Migration\\Version010000Date20200304152605' => $baseDir.'/../lib/Migration/Version010000Date20200304152605.php',
21 21
 );
Please login to merge, or discard this patch.
apps/contactsinteraction/composer/composer/autoload_static.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -6,38 +6,38 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInitContactsInteraction
8 8
 {
9
-    public static $prefixLengthsPsr4 = array (
9
+    public static $prefixLengthsPsr4 = array(
10 10
         'O' => 
11
-        array (
11
+        array(
12 12
             'OCA\\ContactsInteraction\\' => 24,
13 13
         ),
14 14
     );
15 15
 
16
-    public static $prefixDirsPsr4 = array (
16
+    public static $prefixDirsPsr4 = array(
17 17
         'OCA\\ContactsInteraction\\' => 
18
-        array (
19
-            0 => __DIR__ . '/..' . '/../lib',
18
+        array(
19
+            0 => __DIR__.'/..'.'/../lib',
20 20
         ),
21 21
     );
22 22
 
23
-    public static $classMap = array (
24
-        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
25
-        'OCA\\ContactsInteraction\\AddressBook' => __DIR__ . '/..' . '/../lib/AddressBook.php',
26
-        'OCA\\ContactsInteraction\\AddressBookProvider' => __DIR__ . '/..' . '/../lib/AddressBookProvider.php',
27
-        'OCA\\ContactsInteraction\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
28
-        'OCA\\ContactsInteraction\\BackgroundJob\\CleanupJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupJob.php',
29
-        'OCA\\ContactsInteraction\\Card' => __DIR__ . '/..' . '/../lib/Card.php',
30
-        'OCA\\ContactsInteraction\\Db\\CardSearchDao' => __DIR__ . '/..' . '/../lib/Db/CardSearchDao.php',
31
-        'OCA\\ContactsInteraction\\Db\\RecentContact' => __DIR__ . '/..' . '/../lib/Db/RecentContact.php',
32
-        'OCA\\ContactsInteraction\\Db\\RecentContactMapper' => __DIR__ . '/..' . '/../lib/Db/RecentContactMapper.php',
33
-        'OCA\\ContactsInteraction\\Listeners\\ContactInteractionListener' => __DIR__ . '/..' . '/../lib/Listeners/ContactInteractionListener.php',
34
-        'OCA\\ContactsInteraction\\Listeners\\UserDeletedListener' => __DIR__ . '/..' . '/../lib/Listeners/UserDeletedListener.php',
35
-        'OCA\\ContactsInteraction\\Migration\\Version010000Date20200304152605' => __DIR__ . '/..' . '/../lib/Migration/Version010000Date20200304152605.php',
23
+    public static $classMap = array(
24
+        'Composer\\InstalledVersions' => __DIR__.'/..'.'/composer/InstalledVersions.php',
25
+        'OCA\\ContactsInteraction\\AddressBook' => __DIR__.'/..'.'/../lib/AddressBook.php',
26
+        'OCA\\ContactsInteraction\\AddressBookProvider' => __DIR__.'/..'.'/../lib/AddressBookProvider.php',
27
+        'OCA\\ContactsInteraction\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php',
28
+        'OCA\\ContactsInteraction\\BackgroundJob\\CleanupJob' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupJob.php',
29
+        'OCA\\ContactsInteraction\\Card' => __DIR__.'/..'.'/../lib/Card.php',
30
+        'OCA\\ContactsInteraction\\Db\\CardSearchDao' => __DIR__.'/..'.'/../lib/Db/CardSearchDao.php',
31
+        'OCA\\ContactsInteraction\\Db\\RecentContact' => __DIR__.'/..'.'/../lib/Db/RecentContact.php',
32
+        'OCA\\ContactsInteraction\\Db\\RecentContactMapper' => __DIR__.'/..'.'/../lib/Db/RecentContactMapper.php',
33
+        'OCA\\ContactsInteraction\\Listeners\\ContactInteractionListener' => __DIR__.'/..'.'/../lib/Listeners/ContactInteractionListener.php',
34
+        'OCA\\ContactsInteraction\\Listeners\\UserDeletedListener' => __DIR__.'/..'.'/../lib/Listeners/UserDeletedListener.php',
35
+        'OCA\\ContactsInteraction\\Migration\\Version010000Date20200304152605' => __DIR__.'/..'.'/../lib/Migration/Version010000Date20200304152605.php',
36 36
     );
37 37
 
38 38
     public static function getInitializer(ClassLoader $loader)
39 39
     {
40
-        return \Closure::bind(function () use ($loader) {
40
+        return \Closure::bind(function() use ($loader) {
41 41
             $loader->prefixLengthsPsr4 = ComposerStaticInitContactsInteraction::$prefixLengthsPsr4;
42 42
             $loader->prefixDirsPsr4 = ComposerStaticInitContactsInteraction::$prefixDirsPsr4;
43 43
             $loader->classMap = ComposerStaticInitContactsInteraction::$classMap;
Please login to merge, or discard this patch.