public function getTitleForFeed(PhabricatorFeedStory $story)
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case FundInitiativeTransaction::TYPE_NAME:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s renamed %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case FundInitiativeTransaction::TYPE_DESCRIPTION:
             return pht('%s updated the description for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case FundInitiativeTransaction::TYPE_STATUS:
             switch ($new) {
                 case FundInitiative::STATUS_OPEN:
                     return pht('%s reopened %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 case FundInitiative::STATUS_CLOSED:
                     return pht('%s closed %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
     }
     return parent::getTitleForFeed($story);
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $author_link = $this->renderHandleLink($author_phid);
     $object_link = $this->renderHandleLink($object_phid);
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_NAME:
             if (!strlen($old)) {
                 return pht('%s created dashboard %s.', $author_link, $object_link);
             } else {
                 return pht('%s renamed dashboard %s from "%s" to "%s".', $author_link, $object_link, $old, $new);
             }
             break;
         case self::TYPE_STATUS:
             if ($new == PhabricatorDashboard::STATUS_ACTIVE) {
                 return pht('%s activated dashboard %s.', $author_link, $object_link);
             } else {
                 return pht('%s archived dashboard %s.', $author_link, $object_link);
             }
             break;
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed(PhabricatorFeedStory $story)
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $author_link = $this->renderHandleLink($author_phid);
     $object_link = $this->renderHandleLink($object_phid);
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_NAME:
             if (!strlen($old)) {
                 return pht('%s created dashboard panel %s.', $author_link, $object_link);
             } else {
                 return pht('%s renamed dashboard panel %s from "%s" to "%s".', $author_link, $object_link, $old, $new);
             }
         case self::TYPE_ARCHIVE:
             if ($new) {
                 return pht('%s archived dashboard panel %s.', $author_link, $object_link);
             } else {
                 return pht('%s activated dashboard panel %s.', $author_link, $object_link);
             }
     }
     return parent::getTitleForFeed($story);
 }
 public final function getTitleForFeed()
 {
     $title = $this->getTransactionImplementation()->getTitleForFeed();
     if ($title !== null) {
         return $title;
     }
     return parent::getTitleForFeed();
 }
Ejemplo n.º 5
0
 public function getTitleForFeed(PhabricatorFeedStory $story)
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     switch ($this->getTransactionType()) {
         case self::TYPE_CONTENT:
             return pht('%s updated %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
     }
     return parent::getTitleForFeed($story);
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_NAME:
             return pht('%s updated the name of %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old, $new);
             break;
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_TITLE:
             return pht('%s renamed %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_DESCRIPTION:
             return pht('%s edited the description of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_EPOCH:
             return pht('%s edited the end date of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case self::TYPE_ACTIVE:
             if ($new) {
                 return pht('%s activated release product %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s deactivated release product %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case self::TYPE_CONTENT:
             if ($old === '') {
                 return pht('%s added %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s updated %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_TITLE:
             if (strlen($old) && strlen($new)) {
                 return pht('%s renamed %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old, $new);
             } else {
                 return pht('%s created the room %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
             break;
         case self::TYPE_TOPIC:
             if (strlen($new)) {
                 return pht('%s set the topic of %s to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $new);
             } else {
                 if (strlen($old)) {
                     return pht('%s deleted the topic in %s', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 }
             }
             break;
         case self::TYPE_PICTURE:
             return pht('%s updated the room image for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
     }
     return parent::getTitleForFeed();
 }
Ejemplo n.º 11
0
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case self::TYPE_TITLE:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             return pht('%s renamed %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old, $new);
         case self::TYPE_CONTENT:
             return pht('%s edited the content of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_DELETE:
             return pht('%s deleted %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case PhabricatorTransactions::TYPE_CREATE:
             return pht('%s authored %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_BLOG:
             return pht('%s moved post "%s" from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $this->renderHandleLink($old), $this->renderHandleLink($new));
         case self::TYPE_TITLE:
             if ($old === null) {
                 return pht('%s authored %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s updated the name for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_SUBTITLE:
             return pht('%s updated the subtitle for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_BODY:
             return pht('%s updated the blog post %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_HEADERIMAGE:
             return pht('%s updated the header image for post %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_VISIBILITY:
             if ($new == PhameConstants::VISIBILITY_DRAFT) {
                 return pht('%s marked %s as a draft.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 if ($new == PhameConstants::VISIBILITY_ARCHIVED) {
                     return pht('%s marked %s as archived.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 } else {
                     return pht('%s published %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 }
             }
             break;
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $viewer = $this->getViewer();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_NAME:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s changed the name of %s from %s to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old, $new);
             }
         case self::TYPE_URL:
             if ($old === null) {
                 return pht('%s set the destination of %s to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $new);
             } else {
                 return pht('%s changed the destination of %s from %s to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old, $new);
             }
         case self::TYPE_ALIAS:
             if ($old === null) {
                 return pht('%s set the alias of %s to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $new);
             } else {
                 if ($new === null) {
                     return pht('%s removed the alias of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 } else {
                     return pht('%s changed the alias of %s from %s to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old, $new);
                 }
             }
         case self::TYPE_DESCRIPTION:
             return pht('%s updated the description of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_NAME:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s renamed %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_FLAVOR:
             return pht('%s updated the flavor text for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_ICON:
             return pht('%s updated the icon for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_QUALITY:
             return pht('%s updated the quality level for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_DESCRIPTION:
             return pht('%s updated the description for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_STATUS:
             switch ($new) {
                 case PhabricatorBadgesBadge::STATUS_ACTIVE:
                     return pht('%s activated %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 case PhabricatorBadgesBadge::STATUS_ARCHIVED:
                     return pht('%s archived %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
     }
     return parent::getTitleForFeed();
 }
Ejemplo n.º 15
0
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_NAME:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s updated the name for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_DESCRIPTION:
             return pht('%s updated the description for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_DOMAIN:
             return pht('%s updated the domain for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_STATUS:
             switch ($new) {
                 case PhameBlog::STATUS_ACTIVE:
                     return pht('%s published the blog %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 case PhameBlog::STATUS_ARCHIVED:
                     return pht('%s archived the blog %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
     }
     return parent::getTitleForFeed();
 }
Ejemplo n.º 16
0
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_NAME:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s renamed %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old, $new);
             }
             break;
         case self::TYPE_DESCRIPTION:
             return pht('%s updated the description for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_STATUS:
             if ($new == PholioMock::STATUS_CLOSED) {
                 return pht('%s closed a mock %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s opened a mock %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_INLINE:
             return pht('%s added an inline comment to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_IMAGE_REPLACE:
         case self::TYPE_IMAGE_FILE:
             return pht('%s updated images of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_IMAGE_NAME:
             return pht('%s updated the image names of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_IMAGE_DESCRIPTION:
             return pht('%s updated image descriptions of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_IMAGE_SEQUENCE:
             return pht('%s updated image sequence of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case self::TYPE_CONTENT:
             if ($old === '') {
                 return pht('%s added %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s updated %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_STATUS:
             if ($new == PonderAnswerStatus::ANSWER_STATUS_VISIBLE) {
                 return pht('%s marked %s as visible.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 if ($new == PonderAnswerStatus::ANSWER_STATUS_HIDDEN) {
                     return pht('%s marked %s as hidden.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 }
             }
             break;
     }
     return parent::getTitleForFeed();
 }
Ejemplo n.º 18
0
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $author_link = $this->renderHandleLink($author_phid);
     $object_link = $this->renderHandleLink($object_phid);
     switch ($this->getTransactionType()) {
         case self::TYPE_INLINE:
             return pht('%s added inline comments to %s.', $author_link, $object_link);
         case self::TYPE_UPDATE:
             return pht('%s updated the diff for %s.', $author_link, $object_link);
         case self::TYPE_ACTION:
             switch ($new) {
                 case DifferentialAction::ACTION_ACCEPT:
                     return pht('%s accepted %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_REJECT:
                     return pht('%s requested changes to %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_RETHINK:
                     return pht('%s planned changes to %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_ABANDON:
                     return pht('%s abandoned %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_CLOSE:
                     if (!$this->getMetadataValue('isCommitClose')) {
                         return pht('%s closed %s.', $author_link, $object_link);
                     } else {
                         $commit_name = $this->renderHandleLink($this->getMetadataValue('commitPHID'));
                         $committer_phid = $this->getMetadataValue('committerPHID');
                         $author_phid = $this->getMetadataValue('authorPHID');
                         if ($this->getHandleIfExists($committer_phid)) {
                             $committer_name = $this->renderHandleLink($committer_phid);
                         } else {
                             $committer_name = $this->getMetadataValue('committerName');
                         }
                         if ($this->getHandleIfExists($author_phid)) {
                             $author_name = $this->renderHandleLink($author_phid);
                         } else {
                             $author_name = $this->getMetadataValue('authorName');
                         }
                         // Check if the committer and author are the same. They're the
                         // same if both resolved and are the same user, or if neither
                         // resolved and the text is identical.
                         if ($committer_phid && $author_phid) {
                             $same_author = $committer_phid == $author_phid;
                         } else {
                             if (!$committer_phid && !$author_phid) {
                                 $same_author = $committer_name == $author_name;
                             } else {
                                 $same_author = false;
                             }
                         }
                         if ($committer_name && !$same_author) {
                             return pht('%s closed %s by committing %s (authored by %s).', $author_link, $object_link, $commit_name, $author_name);
                         } else {
                             return pht('%s closed %s by committing %s.', $author_link, $object_link, $commit_name);
                         }
                     }
                     break;
                 case DifferentialAction::ACTION_REQUEST:
                     return pht('%s requested review of %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_RECLAIM:
                     return pht('%s reclaimed %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_RESIGN:
                     return pht('%s resigned from %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_CLAIM:
                     return pht('%s commandeered %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_REOPEN:
                     return pht('%s reopened %s.', $author_link, $object_link);
             }
             break;
         case self::TYPE_STATUS:
             switch ($this->getNewValue()) {
                 case ArcanistDifferentialRevisionStatus::ACCEPTED:
                     return pht('%s is now accepted and ready to land.', $object_link);
                 case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
                     return pht('%s now requires changes to proceed.', $object_link);
                 case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
                     return pht('%s now requires review to proceed.', $object_link);
             }
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_QUESTION:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s renamed %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_DESCRIPTION:
             if ($old === null) {
                 return pht('%s set the description of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s edited the description of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_RESPONSES:
             // TODO: This could be more detailed
             return pht('%s changed who can see the responses of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_SHUFFLE:
             if ($new) {
                 return pht('%s made %s responses appear in a random order.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s made %s responses appear in a fixed order.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
         case self::TYPE_CLOSE:
             if ($new) {
                 return pht('%s closed %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s reopened %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed(PhabricatorFeedStory $story)
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case PhabricatorMacroTransactionType::TYPE_NAME:
             return pht('%s renamed %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old, $new);
         case PhabricatorMacroTransactionType::TYPE_DISABLED:
             if ($new) {
                 return pht('%s disabled %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s restored %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
         case PhabricatorMacroTransactionType::TYPE_FILE:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s updated the image for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
         case PhabricatorMacroTransactionType::TYPE_AUDIO:
             if (!$old) {
                 return pht('%s attached audio to %s: %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $this->renderHandleLink($new));
             } else {
                 return pht('%s changed the audio for %s from %s to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $this->renderHandleLink($old), $this->renderHandleLink($new));
             }
         case PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR:
             switch ($new) {
                 case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE:
                     return pht('%s set the audio for %s to play once.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_LOOP:
                     return pht('%s set the audio for %s to loop.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 default:
                     return pht('%s disabled the audio for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
     }
     return parent::getTitleForFeed($story);
 }
 public function getTitleForFeed()
 {
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $author_handle = $this->renderHandleLink($this->getAuthorPHID());
     $object_handle = $this->renderHandleLink($this->getObjectPHID());
     $type = $this->getTransactionType();
     switch ($type) {
         case PhabricatorAuditActionConstants::ADD_CCS:
         case PhabricatorAuditActionConstants::ADD_AUDITORS:
             if (!is_array($old)) {
                 $old = array();
             }
             if (!is_array($new)) {
                 $new = array();
             }
             $add = array_keys(array_diff_key($new, $old));
             $rem = array_keys(array_diff_key($old, $new));
             break;
     }
     switch ($type) {
         case self::TYPE_COMMIT:
             $author = null;
             if ($new['authorPHID']) {
                 $author = $this->renderHandleLink($new['authorPHID']);
             } else {
                 $author = $new['authorName'];
             }
             $committer = null;
             if ($new['committerPHID']) {
                 $committer = $this->renderHandleLink($new['committerPHID']);
             } else {
                 if ($new['committerName']) {
                     $committer = $new['committerName'];
                 }
             }
             if (!$committer) {
                 $committer = $author;
                 $author = null;
             }
             if ($author) {
                 $title = pht('%s committed %s (authored by %s).', $committer, $object_handle, $author);
             } else {
                 $title = pht('%s committed %s.', $committer, $object_handle);
             }
             return $title;
         case PhabricatorAuditActionConstants::INLINE:
             return pht('%s added inline comments to %s.', $author_handle, $object_handle);
         case PhabricatorAuditActionConstants::ADD_AUDITORS:
             if ($add && $rem) {
                 return pht('%s edited auditors for %s; added: %s, removed: %s.', $author_handle, $object_handle, $this->renderHandleList($add), $this->renderHandleList($rem));
             } else {
                 if ($add) {
                     return pht('%s added auditors to %s: %s.', $author_handle, $object_handle, $this->renderHandleList($add));
                 } else {
                     if ($rem) {
                         return pht('%s removed auditors from %s: %s.', $author_handle, $object_handle, $this->renderHandleList($rem));
                     } else {
                         return pht('%s added auditors to %s...', $author_handle, $object_handle);
                     }
                 }
             }
         case PhabricatorAuditActionConstants::ACTION:
             switch ($new) {
                 case PhabricatorAuditActionConstants::ACCEPT:
                     return pht('%s accepted %s.', $author_handle, $object_handle);
                 case PhabricatorAuditActionConstants::CONCERN:
                     return pht('%s raised a concern with %s.', $author_handle, $object_handle);
                 case PhabricatorAuditActionConstants::RESIGN:
                     return pht('%s resigned from auditing %s.', $author_handle, $object_handle);
                 case PhabricatorAuditActionConstants::CLOSE:
                     return pht('%s closed the audit of %s.', $author_handle, $object_handle);
             }
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed(PhabricatorFeedStory $story)
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $author_link = $this->renderHandleLink($author_phid);
     $object_link = $this->renderHandleLink($object_phid);
     switch ($this->getTransactionType()) {
         case self::TYPE_INLINE:
             return pht('%s added inline comments to %s.', $author_link, $object_link);
         case self::TYPE_UPDATE:
             return pht('%s updated the diff for %s.', $author_link, $object_link);
         case self::TYPE_ACTION:
             switch ($new) {
                 case DifferentialAction::ACTION_ACCEPT:
                     return pht('%s accepted %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_REJECT:
                     return pht('%s requested changes to %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_RETHINK:
                     return pht('%s planned changes to %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_ABANDON:
                     return pht('%s abandoned %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_CLOSE:
                     return pht('%s closed %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_REQUEST:
                     return pht('%s requested review of %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_RECLAIM:
                     return pht('%s reclaimed %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_RESIGN:
                     return pht('%s resigned from %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_CLAIM:
                     return pht('%s commandeered %s.', $author_link, $object_link);
                 case DifferentialAction::ACTION_REOPEN:
                     return pht('%s reopened %s.', $author_link, $object_link);
             }
             break;
         case self::TYPE_STATUS:
             switch ($this->getNewValue()) {
                 case ArcanistDifferentialRevisionStatus::ACCEPTED:
                     return pht('%s is now accepted and ready to land.', $object_link);
                 case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
                     return pht('%s now requires changes to proceed.', $object_link);
                 case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
                     return pht('%s now requires review to proceed.', $object_link);
             }
     }
     return parent::getTitleForFeed($story);
 }
Ejemplo n.º 23
0
 public function getTitleForFeed(PhabricatorFeedStory $story)
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case self::TYPE_TITLE:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             return pht('%s renamed %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old, $new);
         case self::TYPE_DESCRIPTION:
             return pht('%s edited the description of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_STATUS:
             $old_closed = ManiphestTaskStatus::isClosedStatus($old);
             $new_closed = ManiphestTaskStatus::isClosedStatus($new);
             $old_name = ManiphestTaskStatus::getTaskStatusName($old);
             $new_name = ManiphestTaskStatus::getTaskStatusName($new);
             if ($new_closed && !$old_closed) {
                 if ($new == ManiphestTaskStatus::getDuplicateStatus()) {
                     return pht('%s closed %s as a duplicate.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 } else {
                     return pht('%s closed %s as "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $new_name);
                 }
             } else {
                 if (!$new_closed && $old_closed) {
                     return pht('%s reopened %s as "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $new_name);
                 } else {
                     return pht('%s changed the status of %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old_name, $new_name);
                 }
             }
         case self::TYPE_UNBLOCK:
             $blocker_phid = key($new);
             $old_status = head($old);
             $new_status = head($new);
             $old_closed = ManiphestTaskStatus::isClosedStatus($old_status);
             $new_closed = ManiphestTaskStatus::isClosedStatus($new_status);
             $old_name = ManiphestTaskStatus::getTaskStatusName($old_status);
             $new_name = ManiphestTaskStatus::getTaskStatusName($new_status);
             if ($old_closed && !$new_closed) {
                 return pht('%s reopened %s, a task blocking %s, as "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($blocker_phid), $this->renderHandleLink($object_phid), $new_name);
             } else {
                 if (!$old_closed && $new_closed) {
                     return pht('%s closed %s, a task blocking %s, as "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($blocker_phid), $this->renderHandleLink($object_phid), $new_name);
                 } else {
                     return pht('%s changed the status of %s, a task blocking %s, ' . 'from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($blocker_phid), $this->renderHandleLink($object_phid), $old_name, $new_name);
                 }
             }
         case self::TYPE_OWNER:
             if ($author_phid == $new) {
                 return pht('%s claimed %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 if (!$new) {
                     return pht('%s placed %s up for grabs.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 } else {
                     if (!$old) {
                         return pht('%s assigned %s to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $this->renderHandleLink($new));
                     } else {
                         return pht('%s reassigned %s from %s to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $this->renderHandleLink($old), $this->renderHandleLink($new));
                     }
                 }
             }
         case self::TYPE_PROJECTS:
             $added = array_diff($new, $old);
             $removed = array_diff($old, $new);
             if ($added && !$removed) {
                 return pht('%s added %d project(s) to %s: %s', $this->renderHandleLink($author_phid), count($added), $this->renderHandleLink($object_phid), $this->renderHandleList($added));
             } else {
                 if ($removed && !$added) {
                     return pht('%s removed %d project(s) from %s: %s', $this->renderHandleLink($author_phid), count($removed), $this->renderHandleLink($object_phid), $this->renderHandleList($removed));
                 } else {
                     if ($removed && $added) {
                         return pht('%s changed project(s) of %s, added %d: %s; removed %d: %s', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), count($added), $this->renderHandleList($added), count($removed), $this->renderHandleList($removed));
                     }
                 }
             }
         case self::TYPE_PRIORITY:
             $old_name = ManiphestTaskPriority::getTaskPriorityName($old);
             $new_name = ManiphestTaskPriority::getTaskPriorityName($new);
             if ($old == ManiphestTaskPriority::getDefaultPriority()) {
                 return pht('%s triaged %s as "%s" priority.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $new_name);
             } else {
                 if ($old > $new) {
                     return pht('%s lowered the priority of %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old_name, $new_name);
                 } else {
                     return pht('%s raised the priority of %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old_name, $new_name);
                 }
             }
         case self::TYPE_CCS:
             // TODO: Remove this when we switch to subscribers. Just reuse the
             // code in the parent.
             $clone = clone $this;
             $clone->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS);
             return $clone->getTitleForFeed($story);
         case self::TYPE_EDGE:
             // TODO: Remove this when we switch to real edges. Just reuse the
             // code in the parent;
             $clone = clone $this;
             $clone->setTransactionType(PhabricatorTransactions::TYPE_EDGE);
             return $clone->getTitleForFeed($story);
         case self::TYPE_ATTACH:
             $old = nonempty($old, array());
             $new = nonempty($new, array());
             $new = array_keys(idx($new, 'FILE', array()));
             $old = array_keys(idx($old, 'FILE', array()));
             $added = array_diff($new, $old);
             $removed = array_diff($old, $new);
             if ($added && !$removed) {
                 return pht('%s attached %d file(s) of %s: %s', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), count($added), $this->renderHandleList($added));
             } else {
                 if ($removed && !$added) {
                     return pht('%s detached %d file(s) of %s: %s', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), count($removed), $this->renderHandleList($removed));
                 } else {
                     return pht('%s changed file(s) for %s, attached %d: %s; detached %d: %s', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), count($added), $this->renderHandleList($added), count($removed), $this->renderHandleList($removed));
                 }
             }
         case self::TYPE_PROJECT_COLUMN:
             $project_phid = $new['projectPHID'];
             $column_phid = head($new['columnPHIDs']);
             return pht('%s moved %s to %s on the %s workboard.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $this->renderHandleLink($column_phid), $this->renderHandleLink($project_phid));
         case self::TYPE_MERGED_INTO:
             return pht('%s merged task %s into %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $this->renderHandleLink($new));
         case self::TYPE_MERGED_FROM:
             return pht('%s merged %d task(s) %s into %s.', $this->renderHandleLink($author_phid), count($new), $this->renderHandleList($new), $this->renderHandleLink($object_phid));
     }
     return parent::getTitleForFeed($story);
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_NAME:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s renamed %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_DESCRIPTION:
             return pht('%s updated the description for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_STATUS:
             switch ($new) {
                 case FundInitiative::STATUS_OPEN:
                     return pht('%s reopened %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 case FundInitiative::STATUS_CLOSED:
                     return pht('%s closed %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_BACKER:
             $amount = $this->getMetadataValue(self::PROPERTY_AMOUNT);
             $amount = PhortuneCurrency::newFromString($amount);
             return pht('%s backed %s with %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $amount->formatForDisplay());
         case self::TYPE_REFUND:
             $amount = $this->getMetadataValue(self::PROPERTY_AMOUNT);
             $amount = PhortuneCurrency::newFromString($amount);
             $backer_phid = $this->getMetadataValue(self::PROPERTY_BACKER);
             return pht('%s refunded %s to %s for %s.', $this->renderHandleLink($author_phid), $amount->formatForDisplay(), $this->renderHandleLink($backer_phid), $this->renderHandleLink($object_phid));
     }
     return parent::getTitleForFeed();
 }
Ejemplo n.º 25
0
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_TITLE:
             if ($old === null) {
                 return pht('%s authored %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s updated the name for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_BODY:
             return pht('%s updated the blog post %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_VISIBILITY:
             if ($new == PhameConstants::VISIBILITY_DRAFT) {
                 return pht('%s marked %s as a draft.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s published %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_PHAME_TITLE:
             return pht('%s updated the Phame title for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
     }
     return parent::getTitleForFeed();
 }
Ejemplo n.º 26
0
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_NAME:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s updated the name for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_SUBTITLE:
             if ($old === null) {
                 return pht('%s set the subtitle for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s updated the subtitle for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_DESCRIPTION:
             return pht('%s updated the description for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_FULLDOMAIN:
             return pht('%s updated the full domain for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_PARENTSITE:
             return pht('%s updated the parent site for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_PARENTDOMAIN:
             return pht('%s updated the parent domain for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_HEADERIMAGE:
             return pht('%s updated the header image for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_PROFILEIMAGE:
             return pht('%s updated the profile image for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_STATUS:
             switch ($new) {
                 case PhameBlog::STATUS_ACTIVE:
                     return pht('%s published the blog %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 case PhameBlog::STATUS_ARCHIVED:
                     return pht('%s archived the blog %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case self::TYPE_TITLE:
             if ($old === null) {
                 return pht('%s asked a question: %s', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s edited the title of %s (was "%s")', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old);
             }
         case self::TYPE_CONTENT:
             return pht('%s edited the description of %s', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_ANSWERWIKI:
             return pht('%s edited the answer wiki for %s', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_ANSWERS:
             $answer_handle = $this->getHandle($this->getNewAnswerPHID());
             $question_handle = $this->getHandle($object_phid);
             return pht('%s answered %s', $this->renderHandleLink($author_phid), $answer_handle->renderLink($question_handle->getFullName()));
         case self::TYPE_STATUS:
             switch ($new) {
                 case PonderQuestionStatus::STATUS_OPEN:
                     return pht('%s reopened %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 case PonderQuestionStatus::STATUS_CLOSED_RESOLVED:
                     return pht('%s closed %s as resolved.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 case PonderQuestionStatus::STATUS_CLOSED_INVALID:
                     return pht('%s closed %s as invalid.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 case PonderQuestionStatus::STATUS_CLOSED_OBSOLETE:
                     return pht('%s closed %s as obsolete.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $type = $this->getTransactionType();
     switch ($type) {
         case self::TYPE_CONTENT:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 return pht('%s edited %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
         case self::TYPE_TITLE:
             return pht('%s updated the title for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_LANGUAGE:
             return pht('%s updated the language for %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             break;
         case self::TYPE_STATUS:
             switch ($new) {
                 case PhabricatorPaste::STATUS_ACTIVE:
                     return pht('%s activated %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 case PhabricatorPaste::STATUS_ARCHIVED:
                     return pht('%s archived %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             break;
     }
     return parent::getTitleForFeed();
 }
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $author_handle = $this->renderHandleLink($author_phid);
     $object_handle = $this->renderHandleLink($object_phid);
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case self::TYPE_NAME:
             if ($old === null) {
                 return pht('%s created %s.', $author_handle, $object_handle);
             } else {
                 return pht('%s renamed %s from "%s" to "%s".', $author_handle, $object_handle, $old, $new);
             }
         case self::TYPE_STATUS:
             if ($old == 0) {
                 return pht('%s archived %s.', $author_handle, $object_handle);
             } else {
                 return pht('%s activated %s.', $author_handle, $object_handle);
             }
         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:
             return pht('%s set the icon for %s to %s.', $author_handle, $object_handle, PhabricatorProjectIcon::getLabel($new));
         case self::TYPE_COLOR:
             return pht('%s set the color for %s to %s.', $author_handle, $object_handle, PHUITagView::getShadeName($new));
         case self::TYPE_LOCKED:
             if ($new) {
                 return pht('%s locked %s membership.', $author_handle, $object_handle);
             } else {
                 return pht('%s unlocked %s membership.', $author_handle, $object_handle);
             }
         case self::TYPE_SLUGS:
             $add = array_diff($new, $old);
             $rem = array_diff($old, $new);
             if ($add && $rem) {
                 return pht('%s changed %s hashtag(s), added %d: %s; removed %d: %s.', $author_handle, $object_handle, count($add), $this->renderSlugList($add), count($rem), $this->renderSlugList($rem));
             } else {
                 if ($add) {
                     return pht('%s added %d %s hashtag(s): %s.', $author_handle, count($add), $object_handle, $this->renderSlugList($add));
                 } else {
                     if ($rem) {
                         return pht('%s removed %d %s hashtag(s): %s.', $author_handle, count($rem), $object_handle, $this->renderSlugList($rem));
                     }
                 }
             }
     }
     return parent::getTitleForFeed();
 }
Ejemplo n.º 30
0
 public function getTitleForFeed()
 {
     $author_phid = $this->getAuthorPHID();
     $object_phid = $this->getObjectPHID();
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     switch ($this->getTransactionType()) {
         case self::TYPE_TITLE:
             if ($old === null) {
                 return pht('%s created %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             }
             return pht('%s renamed %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old, $new);
         case self::TYPE_DESCRIPTION:
             return pht('%s edited the description of %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
         case self::TYPE_STATUS:
             $old_closed = ManiphestTaskStatus::isClosedStatus($old);
             $new_closed = ManiphestTaskStatus::isClosedStatus($new);
             $old_name = ManiphestTaskStatus::getTaskStatusName($old);
             $new_name = ManiphestTaskStatus::getTaskStatusName($new);
             $commit_phid = $this->getMetadataValue('commitPHID');
             if ($new_closed && !$old_closed) {
                 if ($new == ManiphestTaskStatus::getDuplicateStatus()) {
                     if ($commit_phid) {
                         return pht('%s closed %s as a duplicate by committing %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $this->renderHandleLink($commit_phid));
                     } else {
                         return pht('%s closed %s as a duplicate.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                     }
                 } else {
                     if ($commit_phid) {
                         return pht('%s closed %s as "%s" by committing %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $new_name, $this->renderHandleLink($commit_phid));
                     } else {
                         return pht('%s closed %s as "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $new_name);
                     }
                 }
             } else {
                 if (!$new_closed && $old_closed) {
                     if ($commit_phid) {
                         return pht('%s reopened %s as "%s" by committing %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $new_name, $this->renderHandleLink($commit_phid));
                     } else {
                         return pht('%s reopened %s as "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $new_name);
                     }
                 } else {
                     if ($commit_phid) {
                         return pht('%s changed the status of %s from "%s" to "%s" by committing %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old_name, $new_name, $this->renderHandleLink($commit_phid));
                     } else {
                         return pht('%s changed the status of %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old_name, $new_name);
                     }
                 }
             }
         case self::TYPE_UNBLOCK:
             $blocker_phid = key($new);
             $old_status = head($old);
             $new_status = head($new);
             $old_closed = ManiphestTaskStatus::isClosedStatus($old_status);
             $new_closed = ManiphestTaskStatus::isClosedStatus($new_status);
             $old_name = ManiphestTaskStatus::getTaskStatusName($old_status);
             $new_name = ManiphestTaskStatus::getTaskStatusName($new_status);
             if ($old_closed && !$new_closed) {
                 return pht('%s reopened %s, a subtask of %s, as "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($blocker_phid), $this->renderHandleLink($object_phid), $new_name);
             } else {
                 if (!$old_closed && $new_closed) {
                     return pht('%s closed %s, a subtask of %s, as "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($blocker_phid), $this->renderHandleLink($object_phid), $new_name);
                 } else {
                     return pht('%s changed the status of %s, a subtasktask of %s, ' . 'from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($blocker_phid), $this->renderHandleLink($object_phid), $old_name, $new_name);
                 }
             }
         case self::TYPE_OWNER:
             if ($author_phid == $new) {
                 return pht('%s claimed %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
             } else {
                 if (!$new) {
                     return pht('%s placed %s up for grabs.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid));
                 } else {
                     if (!$old) {
                         return pht('%s assigned %s to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $this->renderHandleLink($new));
                     } else {
                         return pht('%s reassigned %s from %s to %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $this->renderHandleLink($old), $this->renderHandleLink($new));
                     }
                 }
             }
         case self::TYPE_PRIORITY:
             $old_name = ManiphestTaskPriority::getTaskPriorityName($old);
             $new_name = ManiphestTaskPriority::getTaskPriorityName($new);
             if ($old == ManiphestTaskPriority::getDefaultPriority()) {
                 return pht('%s triaged %s as "%s" priority.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $new_name);
             } else {
                 if ($old > $new) {
                     return pht('%s lowered the priority of %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old_name, $new_name);
                 } else {
                     return pht('%s raised the priority of %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $old_name, $new_name);
                 }
             }
         case self::TYPE_ATTACH:
             $old = nonempty($old, array());
             $new = nonempty($new, array());
             $new = array_keys(idx($new, 'FILE', array()));
             $old = array_keys(idx($old, 'FILE', array()));
             $added = array_diff($new, $old);
             $removed = array_diff($old, $new);
             if ($added && !$removed) {
                 return pht('%s attached %d file(s) of %s: %s', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), count($added), $this->renderHandleList($added));
             } else {
                 if ($removed && !$added) {
                     return pht('%s detached %d file(s) of %s: %s', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), count($removed), $this->renderHandleList($removed));
                 } else {
                     return pht('%s changed file(s) for %s, attached %d: %s; detached %d: %s', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), count($added), $this->renderHandleList($added), count($removed), $this->renderHandleList($removed));
                 }
             }
         case self::TYPE_MERGED_INTO:
             return pht('%s merged task %s into %s.', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), $this->renderHandleLink($new));
         case self::TYPE_MERGED_FROM:
             return pht('%s merged %s task(s) %s into %s.', $this->renderHandleLink($author_phid), phutil_count($new), $this->renderHandleList($new), $this->renderHandleLink($object_phid));
     }
     return parent::getTitleForFeed();
 }