@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use PhabricatorEdgeType strings when rendering transactions

Summary:
Ref T5245. This hooks up the translation/rendering methods added previously.

These are messy, but now extractable/translatable.

Test Plan: Viewed edge transactions and stories, saw correct strings.

Reviewers: chad, btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T5245

Differential Revision: https://secure.phabricator.com/D9841

+45 -18
+45 -18
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 591 591 $type = $this->getMetadata('edge:type'); 592 592 $type = head($type); 593 593 594 + $type_obj = PhabricatorEdgeType::getByConstant($type); 595 + 594 596 if ($add && $rem) { 595 - $string = PhabricatorEdgeConfig::getEditStringForEdgeType($type); 596 - return pht( 597 - $string, 597 + return $type_obj->getTransactionEditString( 598 598 $this->renderHandleLink($author_phid), 599 - count($add), 599 + new PhutilNumber(count($add) + count($rem)), 600 + new PhutilNumber(count($add)), 600 601 $this->renderHandleList($add), 601 - count($rem), 602 + new PhutilNumber(count($rem)), 602 603 $this->renderHandleList($rem)); 603 604 } else if ($add) { 604 - $string = PhabricatorEdgeConfig::getAddStringForEdgeType($type); 605 - return pht( 606 - $string, 605 + return $type_obj->getTransactionAddString( 607 606 $this->renderHandleLink($author_phid), 608 - count($add), 607 + new PhutilNumber(count($add)), 609 608 $this->renderHandleList($add)); 610 609 } else if ($rem) { 611 - $string = PhabricatorEdgeConfig::getRemoveStringForEdgeType($type); 612 - return pht( 613 - $string, 610 + return $type_obj->getTransactionRemoveString( 614 611 $this->renderHandleLink($author_phid), 615 - count($rem), 612 + new PhutilNumber(count($rem)), 616 613 $this->renderHandleList($rem)); 617 614 } else { 618 615 return pht( ··· 711 708 $this->renderHandleLink($author_phid), 712 709 $this->renderHandleLink($object_phid)); 713 710 case PhabricatorTransactions::TYPE_EDGE: 711 + $new = ipull($new, 'dst'); 712 + $old = ipull($old, 'dst'); 713 + $add = array_diff($new, $old); 714 + $rem = array_diff($old, $new); 714 715 $type = $this->getMetadata('edge:type'); 715 716 $type = head($type); 716 - $string = PhabricatorEdgeConfig::getFeedStringForEdgeType($type); 717 - return pht( 718 - $string, 719 - $this->renderHandleLink($author_phid), 720 - $this->renderHandleLink($object_phid)); 717 + 718 + $type_obj = PhabricatorEdgeType::getByConstant($type); 719 + 720 + if ($add && $rem) { 721 + return $type_obj->getFeedEditString( 722 + $this->renderHandleLink($author_phid), 723 + $this->renderHandleLink($object_phid), 724 + new PhutilNumber(count($add) + count($rem)), 725 + new PhutilNumber(count($add)), 726 + $this->renderHandleList($add), 727 + new PhutilNumber(count($rem)), 728 + $this->renderHandleList($rem)); 729 + } else if ($add) { 730 + return $type_obj->getFeedAddString( 731 + $this->renderHandleLink($author_phid), 732 + $this->renderHandleLink($object_phid), 733 + new PhutilNumber(count($add)), 734 + $this->renderHandleList($add)); 735 + } else if ($rem) { 736 + return $type_obj->getFeedRemoveString( 737 + $this->renderHandleLink($author_phid), 738 + $this->renderHandleLink($object_phid), 739 + new PhutilNumber(count($rem)), 740 + $this->renderHandleList($rem)); 741 + } else { 742 + return pht( 743 + '%s edited edge metadata for %s.', 744 + $this->renderHandleLink($author_phid), 745 + $this->renderHandleLink($object_phid)); 746 + } 747 + 721 748 case PhabricatorTransactions::TYPE_CUSTOMFIELD: 722 749 $field = $this->getTransactionCustomField(); 723 750 if ($field) {