@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 setContentSourceFromRequest() in more places

Summary: I introduced this helper at some point, clean up all the code duplication around content sources.

Test Plan: Grepped; hit edit interfaces for most/all of these.

Reviewers: btrahan, chad, edward

Reviewed By: chad

CC: aran

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

+31 -107
+1 -6
src/applications/config/controller/PhabricatorConfigEditController.php
··· 73 73 $editor = id(new PhabricatorConfigEditor()) 74 74 ->setActor($user) 75 75 ->setContinueOnNoEffect(true) 76 - ->setContentSource( 77 - PhabricatorContentSource::newForSource( 78 - PhabricatorContentSource::SOURCE_WEB, 79 - array( 80 - 'ip' => $request->getRemoteAddr(), 81 - ))); 76 + ->setContentSourceFromRequest($request); 82 77 83 78 try { 84 79 $editor->applyTransactions($config_entry, array($xaction));
+1 -7
src/applications/config/editor/PhabricatorConfigEditor.php
··· 117 117 $editor = id(new PhabricatorConfigEditor()) 118 118 ->setActor($request->getUser()) 119 119 ->setContinueOnNoEffect(true) 120 - ->setContentSource( 121 - PhabricatorContentSource::newForSource( 122 - PhabricatorContentSource::SOURCE_WEB, 123 - array( 124 - 'ip' => $request->getRemoteAddr(), 125 - ))); 126 - 120 + ->setContentSourceFromRequest($request); 127 121 128 122 $editor->applyTransactions($config_entry, array($xaction)); 129 123 }
+2 -6
src/applications/conpherence/controller/ConpherenceNewController.php
··· 73 73 id(new ConpherenceTransactionComment()) 74 74 ->setContent($message) 75 75 ->setConpherencePHID($conpherence->getPHID())); 76 - $content_source = PhabricatorContentSource::newForSource( 77 - PhabricatorContentSource::SOURCE_WEB, 78 - array( 79 - 'ip' => $request->getRemoteAddr() 80 - )); 76 + 81 77 id(new ConpherenceEditor()) 82 - ->setContentSource($content_source) 78 + ->setContentSourceFromRequest($request) 83 79 ->setContinueOnNoEffect(true) 84 80 ->setActor($user) 85 81 ->applyTransactions($conpherence, $xactions);
+1 -6
src/applications/conpherence/controller/ConpherenceUpdateController.php
··· 40 40 $e_file = array(); 41 41 $errors = array(); 42 42 if ($request->isFormPost()) { 43 - $content_source = PhabricatorContentSource::newForSource( 44 - PhabricatorContentSource::SOURCE_WEB, 45 - array( 46 - 'ip' => $request->getRemoteAddr() 47 - )); 48 43 $editor = id(new ConpherenceEditor()) 49 44 ->setContinueOnNoEffect($request->isContinueRequest()) 50 - ->setContentSource($content_source) 45 + ->setContentSourceFromRequest($request) 51 46 ->setActor($user); 52 47 53 48 switch ($action) {
+1 -6
src/applications/macro/controller/PhabricatorMacroCommentController.php
··· 40 40 $editor = id(new PhabricatorMacroEditor()) 41 41 ->setActor($user) 42 42 ->setContinueOnNoEffect($request->isContinueRequest()) 43 - ->setContentSource( 44 - PhabricatorContentSource::newForSource( 45 - PhabricatorContentSource::SOURCE_WEB, 46 - array( 47 - 'ip' => $request->getRemoteAddr(), 48 - ))) 43 + ->setContentSourceFromRequest($request) 49 44 ->setIsPreview($is_preview); 50 45 51 46 try {
+1 -6
src/applications/macro/controller/PhabricatorMacroDisableController.php
··· 35 35 36 36 $editor = id(new PhabricatorMacroEditor()) 37 37 ->setActor($user) 38 - ->setContentSource( 39 - PhabricatorContentSource::newForSource( 40 - PhabricatorContentSource::SOURCE_WEB, 41 - array( 42 - 'ip' => $request->getRemoteAddr(), 43 - ))); 38 + ->setContentSourceFromRequest($request); 44 39 45 40 $xactions = $editor->applyTransactions($macro, array($xaction)); 46 41
+1 -6
src/applications/macro/controller/PhabricatorMacroEditController.php
··· 118 118 $editor = id(new PhabricatorMacroEditor()) 119 119 ->setActor($user) 120 120 ->setContinueOnNoEffect(true) 121 - ->setContentSource( 122 - PhabricatorContentSource::newForSource( 123 - PhabricatorContentSource::SOURCE_WEB, 124 - array( 125 - 'ip' => $request->getRemoteAddr(), 126 - ))); 121 + ->setContentSourceFromRequest($request); 127 122 128 123 $xactions = $editor->applyTransactions($original, $xactions); 129 124
+8
src/applications/metamta/contentsource/PhabricatorContentSource.php
··· 38 38 return $obj; 39 39 } 40 40 41 + public static function newFromRequest(AphrontRequest $request) { 42 + return self::newForSource( 43 + PhabricatorContentSource::SOURCE_WEB, 44 + array( 45 + 'ip' => $request->getRemoteAddr(), 46 + )); 47 + } 48 + 41 49 public function serialize() { 42 50 return json_encode(array( 43 51 'source' => $this->getSource(),
+1 -6
src/applications/phlux/controller/PhluxEditController.php
··· 69 69 $editor = id(new PhluxVariableEditor()) 70 70 ->setActor($user) 71 71 ->setContinueOnNoEffect(true) 72 - ->setContentSource( 73 - PhabricatorContentSource::newForSource( 74 - PhabricatorContentSource::SOURCE_WEB, 75 - array( 76 - 'ip' => $request->getRemoteAddr(), 77 - ))); 72 + ->setContentSourceFromRequest($request); 78 73 79 74 $xactions = array(); 80 75 $xactions[] = id(new PhluxTransaction())
+1 -8
src/applications/pholio/controller/PholioInlineSaveController.php
··· 42 42 $draft->setAuthorPHID($user->getPHID()); 43 43 $draft->setEditPolicy($user->getPHID()); 44 44 $draft->setViewPolicy(PhabricatorPolicies::POLICY_PUBLIC); 45 - 46 - $content_source = PhabricatorContentSource::newForSource( 47 - PhabricatorContentSource::SOURCE_WEB, 48 - array( 49 - 'ip' => $request->getRemoteAddr(), 50 - )); 51 - 52 - $draft->setContentSource($content_source); 45 + $draft->setContentSourceFromRequest($request); 53 46 54 47 $draft->setWidth($request->getInt('endX') - $request->getInt('startX')); 55 48 $draft->setHeight($request->getInt('endY') - $request->getInt('startY'));
+1 -7
src/applications/pholio/controller/PholioMockCommentController.php
··· 37 37 38 38 $comment = $request->getStr('comment'); 39 39 40 - $content_source = PhabricatorContentSource::newForSource( 41 - PhabricatorContentSource::SOURCE_WEB, 42 - array( 43 - 'ip' => $request->getRemoteAddr(), 44 - )); 45 - 46 40 $xactions = array(); 47 41 48 42 $inline_comments = id(new PholioTransactionComment())->loadAllWhere( ··· 66 60 67 61 $editor = id(new PholioMockEditor()) 68 62 ->setActor($user) 69 - ->setContentSource($content_source) 63 + ->setContentSourceFromRequest($request) 70 64 ->setContinueOnNoEffect($request->isContinueRequest()) 71 65 ->setIsPreview($is_preview); 72 66
+1 -7
src/applications/pholio/controller/PholioMockEditController.php
··· 110 110 } 111 111 112 112 if (!$errors) { 113 - $content_source = PhabricatorContentSource::newForSource( 114 - PhabricatorContentSource::SOURCE_WEB, 115 - array( 116 - 'ip' => $request->getRemoteAddr(), 117 - )); 118 - 119 113 foreach ($xactions as $type => $value) { 120 114 $xactions[$type] = id(new PholioTransaction()) 121 115 ->setTransactionType($type) ··· 124 118 125 119 $mock->openTransaction(); 126 120 $editor = id(new PholioMockEditor()) 127 - ->setContentSource($content_source) 121 + ->setContentSourceFromRequest($request) 128 122 ->setContinueOnNoEffect(true) 129 123 ->setActor($user); 130 124
+1 -6
src/applications/phortune/controller/PhortuneController.php
··· 39 39 40 40 $editor = id(new PhortuneAccountEditor()) 41 41 ->setActor($user) 42 - ->setContentSource( 43 - PhabricatorContentSource::newForSource( 44 - PhabricatorContentSource::SOURCE_WEB, 45 - array( 46 - 'ip' => $request->getRemoteAddr(), 47 - ))); 42 + ->setContentSourceFromRequest($request); 48 43 49 44 // We create an account for you the first time you visit Phortune. 50 45 $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
+1 -6
src/applications/releeph/controller/request/ReleephRequestActionController.php
··· 28 28 $editor = id(new ReleephRequestTransactionalEditor()) 29 29 ->setActor($user) 30 30 ->setContinueOnNoEffect(true) 31 - ->setContentSource( 32 - PhabricatorContentSource::newForSource( 33 - PhabricatorContentSource::SOURCE_WEB, 34 - array( 35 - 'ip' => $request->getRemoteAddr(), 36 - ))); 31 + ->setContentSourceFromRequest($request); 37 32 38 33 $xactions = array(); 39 34
+1 -6
src/applications/releeph/controller/request/ReleephRequestCommentController.php
··· 28 28 $editor = id(new ReleephRequestTransactionalEditor()) 29 29 ->setActor($user) 30 30 ->setContinueOnNoEffect($request->isContinueRequest()) 31 - ->setContentSource( 32 - PhabricatorContentSource::newForSource( 33 - PhabricatorContentSource::SOURCE_WEB, 34 - array( 35 - 'ip' => $request->getRemoteAddr(), 36 - ))) 31 + ->setContentSourceFromRequest($request) 37 32 ->setIsPreview($is_preview); 38 33 39 34 try {
+1 -6
src/applications/releeph/controller/request/ReleephRequestEditController.php
··· 140 140 $editor = id(new ReleephRequestTransactionalEditor()) 141 141 ->setActor($user) 142 142 ->setContinueOnNoEffect(true) 143 - ->setContentSource( 144 - PhabricatorContentSource::newForSource( 145 - PhabricatorContentSource::SOURCE_WEB, 146 - array( 147 - 'ip' => $request->getRemoteAddr(), 148 - ))); 143 + ->setContentSourceFromRequest($request); 149 144 $editor->applyTransactions($rq, $xactions); 150 145 return id(new AphrontRedirectResponse())->setURI($origin_uri); 151 146 }
+1 -6
src/applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php
··· 76 76 $editor = id($object->getApplicationTransactionEditor()) 77 77 ->setActor($user) 78 78 ->setContinueOnNoEffect(true) 79 - ->setContentSource( 80 - PhabricatorContentSource::newForSource( 81 - PhabricatorContentSource::SOURCE_WEB, 82 - array( 83 - 'ip' => $request->getRemoteAddr(), 84 - ))); 79 + ->setContentSourceFromRequest($request); 85 80 86 81 $editor->applyTransactions($object, array($xaction)); 87 82 } else {
+1 -6
src/applications/transactions/controller/PhabricatorApplicationTransactionCommentEditController.php
··· 49 49 50 50 $editor = id(new PhabricatorApplicationTransactionCommentEditor()) 51 51 ->setActor($user) 52 - ->setContentSource( 53 - $content_source = PhabricatorContentSource::newForSource( 54 - PhabricatorContentSource::SOURCE_WEB, 55 - array( 56 - 'ip' => $request->getRemoteAddr(), 57 - ))) 52 + ->setContentSourceFromRequest($request) 58 53 ->applyEdit($xaction, $comment); 59 54 60 55 if ($request->isAjax()) {
+5
src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php
··· 47 47 return $this; 48 48 } 49 49 50 + public function setContentSourceFromRequest(AphrontRequest $request) { 51 + return $this->setContentSource( 52 + PhabricatorContentSource::newFromRequest($request)); 53 + } 54 + 50 55 public function getContentSource() { 51 56 return PhabricatorContentSource::newFromSerialized($this->contentSource); 52 57 }