diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-03-05 11:33:06 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-03-05 11:33:06 +0300 |
commit | 229187a19898639b5728da74a5949ba94fc7e35f (patch) | |
tree | 121b2fcc12a874f93d1c354c66a688dbe238afb1 /lib | |
parent | 02433a35a67b16a1e3c23ba9f82f110ac725f546 (diff) |
Fix account deletion with Vue front-end
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Db/AliasMapper.php | 14 | ||||
-rw-r--r-- | lib/Service/AccountService.php | 2 | ||||
-rw-r--r-- | lib/Service/AliasesService.php | 4 |
3 files changed, 7 insertions, 13 deletions
diff --git a/lib/Db/AliasMapper.php b/lib/Db/AliasMapper.php index ce46fe5d1..6c9eabe8f 100644 --- a/lib/Db/AliasMapper.php +++ b/lib/Db/AliasMapper.php @@ -71,18 +71,12 @@ class AliasMapper extends QBMapper { * @param int $accountId the account whose aliases will be deleted * @param string $currentUserId the user that is currently logged in */ - public function deleteAll($accountId, $currentUserId) { + public function deleteAll($accountId) { $qb = $this->db->getQueryBuilder(); - $query = $qb->delete($this->getTableName(), 'aliases') - ->join('aliases', 'mail_accounts', 'accounts', $qb->expr()->eq('aliases.account_id', 'accounts.id')) - ->where($qb->expr()->eq('account_id', $qb->createNamedParameter($accountId))) - ->andWhere( - $qb->expr()->andX( - $qb->expr()->eq('accounts.user_id', $qb->createNamedParameter($currentUserId)), - $qb->expr()->eq('aliases.account_id', $qb->createNamedParameter($accountId)) - ) - ); + $query = $qb + ->delete($this->getTableName()) + ->where($qb->expr()->eq('account_id', $qb->createNamedParameter($accountId))); $query->execute(); } diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php index ad5f93b78..c3cfec3b2 100644 --- a/lib/Service/AccountService.php +++ b/lib/Service/AccountService.php @@ -115,9 +115,9 @@ class AccountService { if ($accountId === Manager::ACCOUNT_ID) { return; } - $this->aliasesService->deleteAll($accountId, $currentUserId); $mailAccount = $this->mapper->find($currentUserId, $accountId); + $this->aliasesService->deleteAll($accountId); $this->mapper->delete($mailAccount); } diff --git a/lib/Service/AliasesService.php b/lib/Service/AliasesService.php index 8c696556d..01ee5a338 100644 --- a/lib/Service/AliasesService.php +++ b/lib/Service/AliasesService.php @@ -83,7 +83,7 @@ class AliasesService { * @param int $accountId the account which aliases will be deleted * @param string $currentUserId the user whom the account belongs to */ - public function deleteAll($accountId, $currentUserId) { - $this->mapper->deleteAll($accountId, $currentUserId); + public function deleteAll($accountId) { + $this->mapper->deleteAll($accountId); } } |