Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/storage/PhabricatorProjectTransaction.php
<?php | <?php | ||||
final class PhabricatorProjectTransaction | final class PhabricatorProjectTransaction | ||||
extends PhabricatorModularTransaction { | extends PhabricatorModularTransaction { | ||||
const TYPE_IMAGE = 'project:image'; | |||||
const TYPE_ICON = 'project:icon'; | const TYPE_ICON = 'project:icon'; | ||||
const TYPE_COLOR = 'project:color'; | const TYPE_COLOR = 'project:color'; | ||||
const TYPE_LOCKED = 'project:locked'; | const TYPE_LOCKED = 'project:locked'; | ||||
const TYPE_PARENT = 'project:parent'; | const TYPE_PARENT = 'project:parent'; | ||||
const TYPE_MILESTONE = 'project:milestone'; | const TYPE_MILESTONE = 'project:milestone'; | ||||
const TYPE_HASWORKBOARD = 'project:hasworkboard'; | const TYPE_HASWORKBOARD = 'project:hasworkboard'; | ||||
const TYPE_DEFAULT_SORT = 'project:sort'; | const TYPE_DEFAULT_SORT = 'project:sort'; | ||||
const TYPE_DEFAULT_FILTER = 'project:filter'; | const TYPE_DEFAULT_FILTER = 'project:filter'; | ||||
Show All 25 Lines | public function getRequiredHandlePHIDs() { | ||||
$req_phids = array(); | $req_phids = array(); | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case self::TYPE_MEMBERS: | case self::TYPE_MEMBERS: | ||||
$add = array_diff($new, $old); | $add = array_diff($new, $old); | ||||
$rem = array_diff($old, $new); | $rem = array_diff($old, $new); | ||||
$req_phids = array_merge($add, $rem); | $req_phids = array_merge($add, $rem); | ||||
break; | break; | ||||
case self::TYPE_IMAGE: | |||||
amckinley: I'm pretty sure this isn't needed anymore, but I could be wrong. | |||||
Not Done Inline ActionsShould be good to nuke. epriestley: Should be good to nuke. | |||||
$req_phids[] = $old; | |||||
$req_phids[] = $new; | |||||
break; | |||||
} | } | ||||
return array_merge($req_phids, parent::getRequiredHandlePHIDs()); | return array_merge($req_phids, parent::getRequiredHandlePHIDs()); | ||||
} | } | ||||
public function shouldHide() { | public function shouldHide() { | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case PhabricatorTransactions::TYPE_EDGE: | case PhabricatorTransactions::TYPE_EDGE: | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | switch ($this->getTransactionType()) { | ||||
case self::TYPE_LOCKED: | case self::TYPE_LOCKED: | ||||
if ($new) { | if ($new) { | ||||
return 'fa-lock'; | return 'fa-lock'; | ||||
} else { | } else { | ||||
return 'fa-unlock'; | return 'fa-unlock'; | ||||
} | } | ||||
case self::TYPE_ICON: | case self::TYPE_ICON: | ||||
return PhabricatorProjectIconSet::getIconIcon($new); | return PhabricatorProjectIconSet::getIconIcon($new); | ||||
case self::TYPE_IMAGE: | |||||
return 'fa-photo'; | |||||
case self::TYPE_MEMBERS: | case self::TYPE_MEMBERS: | ||||
return 'fa-user'; | return 'fa-user'; | ||||
} | } | ||||
return parent::getIcon(); | return parent::getIcon(); | ||||
} | } | ||||
public function getTitle() { | public function getTitle() { | ||||
$old = $this->getOldValue(); | $old = $this->getOldValue(); | ||||
$new = $this->getNewValue(); | $new = $this->getNewValue(); | ||||
$author_phid = $this->getAuthorPHID(); | $author_phid = $this->getAuthorPHID(); | ||||
$author_handle = $this->renderHandleLink($author_phid); | $author_handle = $this->renderHandleLink($author_phid); | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case PhabricatorTransactions::TYPE_CREATE: | case PhabricatorTransactions::TYPE_CREATE: | ||||
return pht( | return pht( | ||||
'%s created this project.', | '%s created this project.', | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
case self::TYPE_IMAGE: | |||||
// TODO: Some day, it would be nice to show the images. | |||||
if (!$old) { | |||||
return pht( | |||||
"%s set this project's image to %s.", | |||||
$author_handle, | |||||
$this->renderHandleLink($new)); | |||||
} else if (!$new) { | |||||
return pht( | |||||
"%s removed this project's image.", | |||||
$author_handle); | |||||
} else { | |||||
return pht( | |||||
"%s updated this project's image from %s to %s.", | |||||
$author_handle, | |||||
$this->renderHandleLink($old), | |||||
$this->renderHandleLink($new)); | |||||
} | |||||
break; | |||||
case self::TYPE_ICON: | case self::TYPE_ICON: | ||||
$set = new PhabricatorProjectIconSet(); | $set = new PhabricatorProjectIconSet(); | ||||
return pht( | return pht( | ||||
"%s set this project's icon to %s.", | "%s set this project's icon to %s.", | ||||
$author_handle, | $author_handle, | ||||
$set->getIconLabel($new)); | $set->getIconLabel($new)); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | public function getTitleForFeed() { | ||||
$object_phid = $this->getObjectPHID(); | $object_phid = $this->getObjectPHID(); | ||||
$author_handle = $this->renderHandleLink($author_phid); | $author_handle = $this->renderHandleLink($author_phid); | ||||
$object_handle = $this->renderHandleLink($object_phid); | $object_handle = $this->renderHandleLink($object_phid); | ||||
$old = $this->getOldValue(); | $old = $this->getOldValue(); | ||||
$new = $this->getNewValue(); | $new = $this->getNewValue(); | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case self::TYPE_IMAGE: | |||||
// TODO: Some day, it would be nice to show the images. | |||||
if (!$old) { | |||||
return pht( | |||||
'%s set the image for %s to %s.', | |||||
$author_handle, | |||||
$object_handle, | |||||
$this->renderHandleLink($new)); | |||||
} else if (!$new) { | |||||
return pht( | |||||
'%s removed the image for %s.', | |||||
$author_handle, | |||||
$object_handle); | |||||
} else { | |||||
return pht( | |||||
'%s updated the image for %s from %s to %s.', | |||||
$author_handle, | |||||
$object_handle, | |||||
$this->renderHandleLink($old), | |||||
$this->renderHandleLink($new)); | |||||
} | |||||
case self::TYPE_ICON: | case self::TYPE_ICON: | ||||
$set = new PhabricatorProjectIconSet(); | $set = new PhabricatorProjectIconSet(); | ||||
return pht( | return pht( | ||||
'%s set the icon for %s to %s.', | '%s set the icon for %s to %s.', | ||||
$author_handle, | $author_handle, | ||||
$object_handle, | $object_handle, | ||||
Show All 23 Lines | public function getTitleForFeed() { | ||||
return parent::getTitleForFeed(); | return parent::getTitleForFeed(); | ||||
} | } | ||||
public function getMailTags() { | public function getMailTags() { | ||||
$tags = array(); | $tags = array(); | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case PhabricatorProjectNameTransaction::TRANSACTIONTYPE: | case PhabricatorProjectNameTransaction::TRANSACTIONTYPE: | ||||
case PhabricatorProjectSlugsTransaction::TRANSACTIONTYPE: | case PhabricatorProjectSlugsTransaction::TRANSACTIONTYPE: | ||||
case self::TYPE_IMAGE: | case PhabricatorProjectImageTransaction::TRANSACTIONTYPE: | ||||
case self::TYPE_ICON: | case self::TYPE_ICON: | ||||
case self::TYPE_COLOR: | case self::TYPE_COLOR: | ||||
$tags[] = self::MAILTAG_METADATA; | $tags[] = self::MAILTAG_METADATA; | ||||
break; | break; | ||||
case PhabricatorTransactions::TYPE_EDGE: | case PhabricatorTransactions::TYPE_EDGE: | ||||
$type = $this->getMetadata('edge:type'); | $type = $this->getMetadata('edge:type'); | ||||
$type = head($type); | $type = head($type); | ||||
$type_member = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; | $type_member = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; | ||||
Show All 19 Lines |
I'm pretty sure this isn't needed anymore, but I could be wrong.