Changeset View
Changeset View
Standalone View
Standalone View
src/applications/badges/storage/PhabricatorBadgesBadge.php
<?php | <?php | ||||
final class PhabricatorBadgesBadge extends PhabricatorBadgesDAO | final class PhabricatorBadgesBadge extends PhabricatorBadgesDAO | ||||
implements | implements | ||||
PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
PhabricatorSubscribableInterface, | PhabricatorSubscribableInterface, | ||||
PhabricatorTokenReceiverInterface, | PhabricatorTokenReceiverInterface, | ||||
PhabricatorFlaggableInterface, | PhabricatorFlaggableInterface, | ||||
PhabricatorDestructibleInterface { | PhabricatorDestructibleInterface, | ||||
PhabricatorConduitResultInterface { | |||||
protected $name; | protected $name; | ||||
protected $flavor; | protected $flavor; | ||||
protected $description; | protected $description; | ||||
protected $icon; | protected $icon; | ||||
protected $quality; | protected $quality; | ||||
protected $mailKey; | protected $mailKey; | ||||
protected $editPolicy; | protected $editPolicy; | ||||
Show All 25 Lines | public static function initializeNewBadge(PhabricatorUser $actor) { | ||||
$edit_policy = | $edit_policy = | ||||
$app->getPolicy(PhabricatorBadgesDefaultEditCapability::CAPABILITY); | $app->getPolicy(PhabricatorBadgesDefaultEditCapability::CAPABILITY); | ||||
return id(new PhabricatorBadgesBadge()) | return id(new PhabricatorBadgesBadge()) | ||||
->setIcon(self::DEFAULT_ICON) | ->setIcon(self::DEFAULT_ICON) | ||||
->setQuality(PhabricatorBadgesQuality::DEFAULT_QUALITY) | ->setQuality(PhabricatorBadgesQuality::DEFAULT_QUALITY) | ||||
->setCreatorPHID($actor->getPHID()) | ->setCreatorPHID($actor->getPHID()) | ||||
->setEditPolicy($edit_policy) | ->setEditPolicy($edit_policy) | ||||
->setFlavor('') | |||||
->setDescription('') | |||||
->setStatus(self::STATUS_ACTIVE); | ->setStatus(self::STATUS_ACTIVE); | ||||
} | } | ||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'name' => 'text255', | 'name' => 'text255', | ||||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | foreach ($awards as $award) { | ||||
$engine->destroyObjectPermanently($award); | $engine->destroyObjectPermanently($award); | ||||
} | } | ||||
$this->openTransaction(); | $this->openTransaction(); | ||||
$this->delete(); | $this->delete(); | ||||
$this->saveTransaction(); | $this->saveTransaction(); | ||||
} | } | ||||
/* -( PhabricatorConduitResultInterface )---------------------------------- */ | |||||
public function getFieldSpecificationsForConduit() { | |||||
return array( | |||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('name') | |||||
->setType('string') | |||||
->setDescription(pht('The name of the badge.')), | |||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('creatorPHID') | |||||
->setType('phid') | |||||
->setDescription(pht('User PHID of the creator.')), | |||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('status') | |||||
->setType('string') | |||||
->setDescription(pht('Active or archived status of the badge.')), | |||||
epriestley: Small copy/paste issue, `paste` -> `badge`.
Also `arhived` is missing a letter, maybe an issue… | |||||
); | |||||
} | |||||
public function getFieldValuesForConduit() { | |||||
return array( | |||||
'name' => $this->getName(), | |||||
'creatorPHID' => $this->getCreatorPHID(), | |||||
'status' => $this->getStatus(), | |||||
); | |||||
} | |||||
public function getConduitSearchAttachments() { | |||||
return array(); | |||||
} | |||||
} | } | ||||
Not Done Inline ActionsOmit this; PasteContent doesn't make sense in the context of badges. Just return array(), badges have no attachments for now. epriestley: Omit this; `PasteContent` doesn't make sense in the context of badges. Just `return array()`… | |||||
Not Done Inline ActionsAren't awards attachments? lpriestley: Aren't awards attachments? |
Small copy/paste issue, paste -> badge.
Also arhived is missing a letter, maybe an issue in Paste too?