Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14039157
D17111.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D17111.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -512,6 +512,7 @@
'DifferentialRevisionAuthorProjectsHeraldField' => 'applications/differential/herald/DifferentialRevisionAuthorProjectsHeraldField.php',
'DifferentialRevisionCloseDetailsController' => 'applications/differential/controller/DifferentialRevisionCloseDetailsController.php',
'DifferentialRevisionCloseTransaction' => 'applications/differential/xaction/DifferentialRevisionCloseTransaction.php',
+ 'DifferentialRevisionCommandeerTransaction' => 'applications/differential/xaction/DifferentialRevisionCommandeerTransaction.php',
'DifferentialRevisionContentAddedHeraldField' => 'applications/differential/herald/DifferentialRevisionContentAddedHeraldField.php',
'DifferentialRevisionContentHeraldField' => 'applications/differential/herald/DifferentialRevisionContentHeraldField.php',
'DifferentialRevisionContentRemovedHeraldField' => 'applications/differential/herald/DifferentialRevisionContentRemovedHeraldField.php',
@@ -5185,6 +5186,7 @@
'DifferentialRevisionAuthorProjectsHeraldField' => 'DifferentialRevisionHeraldField',
'DifferentialRevisionCloseDetailsController' => 'DifferentialController',
'DifferentialRevisionCloseTransaction' => 'DifferentialRevisionActionTransaction',
+ 'DifferentialRevisionCommandeerTransaction' => 'DifferentialRevisionActionTransaction',
'DifferentialRevisionContentAddedHeraldField' => 'DifferentialRevisionHeraldField',
'DifferentialRevisionContentHeraldField' => 'DifferentialRevisionHeraldField',
'DifferentialRevisionContentRemovedHeraldField' => 'DifferentialRevisionHeraldField',
diff --git a/src/applications/differential/xaction/DifferentialRevisionCommandeerTransaction.php b/src/applications/differential/xaction/DifferentialRevisionCommandeerTransaction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/differential/xaction/DifferentialRevisionCommandeerTransaction.php
@@ -0,0 +1,67 @@
+<?php
+
+final class DifferentialRevisionCommandeerTransaction
+ extends DifferentialRevisionActionTransaction {
+
+ const TRANSACTIONTYPE = 'differential.revision.commandeer';
+ const ACTIONKEY = 'commandeer';
+
+ protected function getRevisionActionLabel() {
+ return pht('Commandeer Revision');
+ }
+
+ protected function getRevisionActionDescription() {
+ return pht('You will take control of this revision and become its author.');
+ }
+
+ public function getIcon() {
+ return 'fa-flag';
+ }
+
+ public function getColor() {
+ return 'sky';
+ }
+
+ public function generateOldValue($object) {
+ return $object->getAuthorPHID();
+ }
+
+ public function generateNewValue($object, $value) {
+ $actor = $this->getActor();
+ return $actor->getPHID();
+ }
+
+ public function applyInternalEffects($object, $value) {
+ $object->setAuthorPHID($value);
+ }
+
+ protected function validateAction($object, PhabricatorUser $viewer) {
+ if ($object->isClosed()) {
+ throw new Exception(
+ pht(
+ 'You can not commandeer this revision because it has already '.
+ 'been closed. You can only commandeer open revisions.'));
+ }
+
+ if ($this->isViewerRevisionAuthor($object, $viewer)) {
+ throw new Exception(
+ pht(
+ 'You can not commandeer this revision because you are already '.
+ 'the author.'));
+ }
+ }
+
+ public function getTitle() {
+ return pht(
+ '%s commandeered this revision.',
+ $this->renderAuthor());
+ }
+
+ public function getTitleForFeed() {
+ return pht(
+ '%s commandeered %s.',
+ $this->renderAuthor(),
+ $this->renderObject());
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 12, 4:07 AM (6 d, 21 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6711826
Default Alt Text
D17111.diff (3 KB)
Attached To
Mode
D17111: Restore "Commandeer" action to Differential on EditEngine
Attached
Detach File
Event Timeline
Log In to Comment