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

Added willEditTask and didEditTask for Differential.

Summary: Added constants to PhabricatorEventType. Modified DifferentialRevisionEditor and DifferentialCommentEditor.

Test Plan:
Created a revision. Edited and made a comment on that revision. It's updating as usual. I think nothing broke may be it's working.
Let me know if I have done it correclty.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, AnhNhan

Maniphest Tasks: T2899

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

authored by

Afaque Hussain and committed by
epriestley
473a2c3b 38778a8b

+76 -1
+24
src/applications/differential/controller/DifferentialRevisionEditController.php
··· 56 56 } 57 57 58 58 if (!$errors) { 59 + $is_new = !$revision->getID(); 60 + $user = $request->getUser(); 61 + 62 + $event = new PhabricatorEvent( 63 + PhabricatorEventType::TYPE_DIFFERENTIAL_WILLEDITREVISION, 64 + array( 65 + 'revision' => $revision, 66 + 'new' => $is_new, 67 + )); 68 + 69 + $event->setUser($user); 70 + $event->setAphrontRequest($request); 71 + PhutilEventEngine::dispatchEvent($event); 72 + 59 73 $editor = new DifferentialRevisionEditor($revision); 60 74 $editor->setActor($request->getUser()); 61 75 if ($diff) { ··· 63 77 } 64 78 $editor->setAuxiliaryFields($aux_fields); 65 79 $editor->save(); 80 + 81 + $event = new PhabricatorEvent( 82 + PhabricatorEventType::TYPE_DIFFERENTIAL_DIDEDITREVISION, 83 + array( 84 + 'revision' => $revision, 85 + 'new' => $is_new, 86 + )); 87 + $event->setUser($user); 88 + $event->setAphrontRequest($request); 89 + PhutilEventEngine::dispatchEvent($event); 66 90 67 91 return id(new AphrontRedirectResponse()) 68 92 ->setURI('/D'.$revision->getID());
+21
src/applications/differential/editor/DifferentialCommentEditor.php
··· 492 492 $actor_phid); 493 493 } 494 494 495 + $is_new = !$revision->getID(); 496 + 497 + $event = new PhabricatorEvent( 498 + PhabricatorEventType::TYPE_DIFFERENTIAL_WILLEDITREVISION, 499 + array( 500 + 'revision' => $revision, 501 + 'new' => $is_new, 502 + )); 503 + 504 + $event->setUser($actor); 505 + PhutilEventEngine::dispatchEvent($event); 506 + 495 507 $comment = id(new DifferentialComment()) 496 508 ->setAuthorPHID($actor_phid) 497 509 ->setRevisionID($revision->getID()) ··· 546 558 547 559 $comment->setMetadata($metadata); 548 560 $comment->save(); 561 + 562 + $event = new PhabricatorEvent( 563 + PhabricatorEventType::TYPE_DIFFERENTIAL_DIDEDITREVISION, 564 + array( 565 + 'revision' => $revision, 566 + 'new' => $is_new, 567 + )); 568 + $event->setUser($actor); 569 + PhutilEventEngine::dispatchEvent($event); 549 570 } 550 571 } 551 572
+29 -1
src/docs/userguide/events.diviner
··· 204 204 - ##is_generated## Boolean indicating if this file should be treated as 205 205 generated. 206 206 207 + == Differential: Will Edit Revision == 208 + 209 + The constant for this event is 210 + `PhabricatorEventType::TYPE_DIFFERENTIAL_WILLEDITREVISION`. 211 + 212 + This event is dispatched before a revision is edited, and allows you to 213 + respond to or alter the edit. Data available on this event: 214 + 215 + - ##revision## The @{class:DifferentialRevision} being edited. 216 + - ##new## A boolean indicating if this revision is being created. 217 + 218 + This is similar to the next event (did edit revision) but occurs before the edit 219 + begins. 220 + 221 + == Differential: Did Edit Revision == 222 + 223 + The constant for this event is 224 + `PhabricatorEventType::TYPE_DIFFERENTIAL_DIDEDITREVISION`. 225 + 226 + This event is dispatched after a revision is edited, and allows you to 227 + react to the edit. Data available on this event: 228 + 229 + - ##revision## The @{class:DifferentialRevision} being edited. 230 + - ##new## A boolean indicating if this revision is being created. 231 + 232 + This is similar to the previous event (will edit revision) but occurs after the 233 + edit completes. 234 + 207 235 == Diffusion: Did Discover Commit == 208 236 209 237 The constant for this event is ··· 336 364 Continue by: 337 365 338 366 - taking a look at @{class:PhabricatorExampleEventListener}; or 339 - - building a library with @{article:libphutil Libraries User Guide}. 367 + - building a library with @{article:libphutil Libraries User Guide}.
+2
src/infrastructure/events/constant/PhabricatorEventType.php
··· 15 15 16 16 const TYPE_DIFFERENTIAL_WILLSENDMAIL = 'differential.willSendMail'; 17 17 const TYPE_DIFFERENTIAL_WILLMARKGENERATED = 'differential.willMarkGenerated'; 18 + const TYPE_DIFFERENTIAL_WILLEDITREVISION = 'differential.willEditRevision'; 19 + const TYPE_DIFFERENTIAL_DIDEDITREVISION = 'differential.didEditRevision'; 18 20 19 21 const TYPE_DIFFUSION_DIDDISCOVERCOMMIT = 'diffusion.didDiscoverCommit'; 20 22 const TYPE_DIFFUSION_LOOKUPUSER = 'diffusion.lookupUser';