@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.

Projects - publish feed stories for project edits

Summary: Fixes T7426. Wasn't 100% sure what the right feed notify phids were so I went with project subscribers.

Test Plan: made a project and saw the "btrahan created $project" story. edited project members and hashtags and got proper stories.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7426

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

+174 -4
+8 -4
src/applications/project/controller/PhabricatorProjectEditDetailsController.php
··· 77 77 $v_icon = $request->getStr('icon'); 78 78 $v_locked = $request->getInt('is_membership_locked', 0); 79 79 80 - $xactions = $field_list->buildFieldTransactionsFromRequest( 81 - new PhabricatorProjectTransaction(), 82 - $request); 83 - 84 80 $type_name = PhabricatorProjectTransaction::TYPE_NAME; 85 81 $type_slugs = PhabricatorProjectTransaction::TYPE_SLUGS; 86 82 $type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY; 87 83 $type_icon = PhabricatorProjectTransaction::TYPE_ICON; 88 84 $type_color = PhabricatorProjectTransaction::TYPE_COLOR; 89 85 $type_locked = PhabricatorProjectTransaction::TYPE_LOCKED; 86 + 87 + $xactions = array(); 90 88 91 89 $xactions[] = id(new PhabricatorProjectTransaction()) 92 90 ->setTransactionType($type_name) ··· 119 117 $xactions[] = id(new PhabricatorProjectTransaction()) 120 118 ->setTransactionType($type_locked) 121 119 ->setNewValue($v_locked); 120 + 121 + $xactions = array_merge( 122 + $xactions, 123 + $field_list->buildFieldTransactionsFromRequest( 124 + new PhabricatorProjectTransaction(), 125 + $request)); 122 126 123 127 $editor = id(new PhabricatorProjectTransactionEditor()) 124 128 ->setActor($viewer)
+13
src/applications/project/editor/PhabricatorProjectTransactionEditor.php
··· 403 403 return parent::requireCapabilities($object, $xaction); 404 404 } 405 405 406 + /** 407 + * Note: this is implemented for Feed purposes. 408 + */ 409 + protected function getMailTo(PhabricatorLiskDAO $object) { 410 + return array(); 411 + } 412 + 413 + protected function shouldPublishFeedStory( 414 + PhabricatorLiskDAO $object, 415 + array $xactions) { 416 + return true; 417 + } 418 + 406 419 protected function supportsSearch() { 407 420 return true; 408 421 }
+119
src/applications/project/storage/PhabricatorProjectTransaction.php
··· 226 226 return parent::getTitle(); 227 227 } 228 228 229 + public function getTitleForFeed() { 230 + $author_phid = $this->getAuthorPHID(); 231 + $object_phid = $this->getObjectPHID(); 232 + $author_handle = $this->renderHandleLink($author_phid); 233 + $object_handle = $this->renderHandleLink($object_phid); 234 + 235 + $old = $this->getOldValue(); 236 + $new = $this->getNewValue(); 237 + 238 + switch ($this->getTransactionType()) { 239 + case self::TYPE_NAME: 240 + if ($old === null) { 241 + return pht( 242 + '%s created %s.', 243 + $author_handle, 244 + $object_handle); 245 + } else { 246 + return pht( 247 + '%s renamed %s from "%s" to "%s".', 248 + $author_handle, 249 + $object_handle, 250 + $old, 251 + $new); 252 + } 253 + case self::TYPE_STATUS: 254 + if ($old == 0) { 255 + return pht( 256 + '%s archived %s.', 257 + $author_handle, 258 + $object_handle); 259 + } else { 260 + return pht( 261 + '%s activated %s.', 262 + $author_handle, 263 + $object_handle); 264 + } 265 + case self::TYPE_IMAGE: 266 + // TODO: Some day, it would be nice to show the images. 267 + if (!$old) { 268 + return pht( 269 + '%s set the image for %s to %s.', 270 + $author_handle, 271 + $object_handle, 272 + $this->renderHandleLink($new)); 273 + } else if (!$new) { 274 + return pht( 275 + '%s removed the image for %s.', 276 + $author_handle, 277 + $object_handle); 278 + } else { 279 + return pht( 280 + '%s updated the image for %s from %s to %s.', 281 + $author_handle, 282 + $object_handle, 283 + $this->renderHandleLink($old), 284 + $this->renderHandleLink($new)); 285 + } 286 + 287 + case self::TYPE_ICON: 288 + return pht( 289 + '%s set the icon for %s to %s.', 290 + $author_handle, 291 + $object_handle, 292 + PhabricatorProjectIcon::getLabel($new)); 293 + 294 + case self::TYPE_COLOR: 295 + return pht( 296 + '%s set the color for %s to %s.', 297 + $author_handle, 298 + $object_handle, 299 + PHUITagView::getShadeName($new)); 300 + 301 + case self::TYPE_LOCKED: 302 + if ($new) { 303 + return pht( 304 + '%s locked %s membership.', 305 + $author_handle, 306 + $object_handle); 307 + } else { 308 + return pht( 309 + '%s unlocked %s membership.', 310 + $author_handle, 311 + $object_handle); 312 + } 313 + 314 + case self::TYPE_SLUGS: 315 + $add = array_diff($new, $old); 316 + $rem = array_diff($old, $new); 317 + 318 + if ($add && $rem) { 319 + return pht( 320 + '%s changed %s hashtag(s), added %d: %s; removed %d: %s.', 321 + $author_handle, 322 + $object_handle, 323 + count($add), 324 + $this->renderSlugList($add), 325 + count($rem), 326 + $this->renderSlugList($rem)); 327 + } else if ($add) { 328 + return pht( 329 + '%s added %d %s hashtag(s): %s.', 330 + $author_handle, 331 + count($add), 332 + $object_handle, 333 + $this->renderSlugList($add)); 334 + } else if ($rem) { 335 + return pht( 336 + '%s removed %d %s hashtag(s): %s.', 337 + $author_handle, 338 + count($rem), 339 + $object_handle, 340 + $this->renderSlugList($rem)); 341 + } 342 + 343 + } 344 + 345 + return parent::getTitleForFeed(); 346 + } 347 + 229 348 private function renderSlugList($slugs) { 230 349 return implode(', ', $slugs); 231 350 }
+34
src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php
··· 735 735 ), 736 736 ), 737 737 738 + '%s changed %s hashtag(s), added %d: %s; removed %d: %s.' => 739 + '%s changed hashtags for %s, added %4$s; removed %6$s.', 740 + 741 + '%s added %d %s hashtag(s): %s.' => array( 742 + array( 743 + '%s added a hashtag to %3$s: %4$s.', 744 + '%s added hashtags to %3$s: %4$s.', 745 + ), 746 + ), 747 + 748 + '%s removed %d %s hashtag(s): %s.' => array( 749 + array( 750 + '%s removed a hashtag from %3$s: %4$s.', 751 + '%s removed hashtags from %3$s: %4$s.', 752 + ), 753 + ), 754 + 738 755 '%d User(s) Need Approval' => array( 739 756 '%d User Needs Approval', 740 757 '%d Users Need Approval', ··· 947 964 948 965 '%s edited %s edge(s) for %s, added %s: %s; removed %s: %s.' => 949 966 '%s edited edges for %3$s, added: %5$s; removed %7$s.', 967 + 968 + '%s added %s member(s) for %s: %s.' => array( 969 + array( 970 + '%s added a member for %3$s: %4$s.', 971 + '%s added members for %3$s: %4$s.', 972 + ), 973 + ), 974 + 975 + '%s removed %s member(s) for %s: %s.' => array( 976 + array( 977 + '%s removed a member for %3$s: %4$s.', 978 + '%s removed members for %3$s: %4$s.', 979 + ), 980 + ), 981 + 982 + '%s edited %s member(s) for %s, added %s: %s; removed %s: %s.' => 983 + '%s edited members for %3$s, added: %5$s; removed %7$s.', 950 984 951 985 '%d related link(s):' => array( 952 986 'Related link:',