Differential D17412 Diff 41873 src/applications/badges/xaction/PhabricatorBadgesBadgeAwardTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/badges/xaction/PhabricatorBadgesBadgeAwardTransaction.php
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | return pht( | ||||
new PhutilNumber(count($new)), | new PhutilNumber(count($new)), | ||||
$handles); | $handles); | ||||
} | } | ||||
public function getIcon() { | public function getIcon() { | ||||
return 'fa-user-plus'; | return 'fa-user-plus'; | ||||
} | } | ||||
public function validateTransactions($object, array $xactions) { | |||||
$errors = array(); | |||||
foreach ($xactions as $xaction) { | |||||
epriestley: Does this actually work? Isn't `getNewValue()` a //list// of recipients? | |||||
$user_phids = $xaction->getNewValue(); | |||||
Not Done Inline Actionshaha ha haaa chad: haha ha haaa | |||||
Not Done Inline Actionsya this looks a whole lot like copy-pasta buddy epriestley: ya this looks a whole lot like copy-pasta buddy | |||||
if (!$user_phids) { | |||||
$errors[] = $this->newRequiredError( | |||||
pht('Recipient is required.')); | |||||
continue; | |||||
} | |||||
foreach ($user_phids as $user_phid) { | |||||
$user = id(new PhabricatorPeopleQuery()) | |||||
->setViewer($this->getActor()) | |||||
->withPHIDs(array($user_phid)) | |||||
->executeOne(); | |||||
if (!$user) { | |||||
$errors[] = $this->newInvalidError( | |||||
pht( | |||||
'Recipient PHID "%s" is not a valid user PHID.', | |||||
$user_phid)); | |||||
} | |||||
} | |||||
} | |||||
return $errors; | |||||
} | |||||
} | } |
Does this actually work? Isn't getNewValue() a list of recipients?