Skip to content

Commit b362aae

Browse files
committed
Remove duplicate functionality; clean up calls
1 parent 6c6351f commit b362aae

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

resources/lib/UnityGroup.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function cancelGroupRequest($send_mail = true)
204204
return;
205205
}
206206

207-
$this->SQL->deleteGroupRequestByUserAndPI($this->getOwner()->getUID(), "admin");
207+
$this->SQL->removeRequest($this->getOwner()->getUID());
208208

209209
if ($send_mail) {
210210
// send email to requestor
@@ -221,7 +221,7 @@ public function cancelGroupJoinRequest($user, $send_mail = true)
221221
return;
222222
}
223223

224-
$this->SQL->deleteGroupRequestByUserAndPI($user->getUID(), $this->pi_uid);
224+
$this->SQL->removeRequest($user->getUID(), $this->pi_uid);
225225

226226
if ($send_mail) {
227227
// send email to requestor
@@ -286,7 +286,7 @@ public function approveUser($new_user, $send_mail = true)
286286
$this->addUserToGroup($new_user);
287287

288288
// remove request, this will fail silently if the request doesn't exist
289-
$this->removeRequest($new_user->getUID());
289+
$this->SQL->removeRequest($new_user->getUID(), $this->pi_uid);
290290

291291
// send email to the requestor
292292
if ($send_mail) {
@@ -318,7 +318,7 @@ public function denyUser($new_user, $send_mail = true)
318318
}
319319

320320
// remove request, this will fail silently if the request doesn't exist
321-
$this->removeRequest($new_user->getUID());
321+
$this->SQL->removeRequest($new_user->getUID(), $this->pi_uid);
322322

323323
if ($send_mail) {
324324
// send email to the user
@@ -557,11 +557,6 @@ private function addRequest($uid)
557557
$this->SQL->addRequest($uid, $this->pi_uid);
558558
}
559559

560-
private function removeRequest($uid)
561-
{
562-
$this->SQL->removeRequest($uid, $this->pi_uid);
563-
}
564-
565560
//
566561
// Public helper functions
567562
//

resources/lib/UnitySQL.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,6 @@ public function addRequest($requestor, $dest = self::REQUEST_BECOME_PI)
5353
$stmt->execute();
5454
}
5555

56-
public function deleteGroupRequestByUserAndPI($user, $pi_uid)
57-
{
58-
$stmt = $this->conn->prepare(
59-
"DELETE FROM " . self::TABLE_REQS . " WHERE uid=:uid AND request_for=:request_for"
60-
);
61-
$stmt->bindParam(":uid", $user);
62-
$stmt->bindParam(":request_for", $pi_uid);
63-
64-
$stmt->execute();
65-
}
66-
6756
public function removeRequest($requestor, $dest = self::REQUEST_BECOME_PI)
6857
{
6958
if (!$this->requestExists($requestor, $dest)) {

0 commit comments

Comments
 (0)