Path: blob/master/src/applications/maniphest/xaction/ManiphestTaskAttachTransaction.php
12256 views
<?php12final class ManiphestTaskAttachTransaction3extends ManiphestTaskTransactionType {45// NOTE: this type is deprecated. Keep it around for legacy installs6// so any transactions render correctly.78const TRANSACTIONTYPE = 'attach';910public function getActionName() {11return pht('Attached');12}1314public function getTitle() {15$old = $this->getOldValue();16$new = $this->getNewValue();1718$old = nonempty($old, array());19$new = nonempty($new, array());20$new = array_keys(idx($new, 'FILE', array()));21$old = array_keys(idx($old, 'FILE', array()));2223$added = array_diff($new, $old);24$removed = array_diff($old, $new);25if ($added && !$removed) {26return pht(27'%s attached %s file(s): %s.',28$this->renderAuthor(),29phutil_count($added),30$this->renderHandleList($added));31} else if ($removed && !$added) {32return pht(33'%s detached %s file(s): %s.',34$this->renderAuthor(),35phutil_count($removed),36$this->renderHandleList($removed));37} else {38return pht(39'%s changed file(s), attached %s: %s; detached %s: %s.',40$this->renderAuthor(),41phutil_count($added),42$this->renderHandleList($added),43phutil_count($removed),44$this->renderHandleList($removed));45}4647}4849public function getTitleForFeed() {50$old = $this->getOldValue();51$new = $this->getNewValue();5253$old = nonempty($old, array());54$new = nonempty($new, array());55$new = array_keys(idx($new, 'FILE', array()));56$old = array_keys(idx($old, 'FILE', array()));5758$added = array_diff($new, $old);59$removed = array_diff($old, $new);60if ($added && !$removed) {61return pht(62'%s attached %d file(s) of %s: %s',63$this->renderAuthor(),64$this->renderObject(),65count($added),66$this->renderHandleList($added));67} else if ($removed && !$added) {68return pht(69'%s detached %d file(s) of %s: %s',70$this->renderAuthor(),71$this->renderObject(),72count($removed),73$this->renderHandleList($removed));74} else {75return pht(76'%s changed file(s) for %s, attached %d: %s; detached %d: %s',77$this->renderAuthor(),78$this->renderObject(),79count($added),80$this->renderHandleList($added),81count($removed),82$this->renderHandleList($removed));83}84}8586public function getIcon() {87return 'fa-thumb-tack';88}8990}919293