Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15421575
D17914.id43092.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D17914.id43092.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
@@ -4401,6 +4401,7 @@
'PholioMockHeraldField' => 'applications/pholio/herald/PholioMockHeraldField.php',
'PholioMockHeraldFieldGroup' => 'applications/pholio/herald/PholioMockHeraldFieldGroup.php',
'PholioMockImagesView' => 'applications/pholio/view/PholioMockImagesView.php',
+ 'PholioMockInlineTransaction' => 'applications/pholio/xaction/PholioMockInlineTransaction.php',
'PholioMockListController' => 'applications/pholio/controller/PholioMockListController.php',
'PholioMockMailReceiver' => 'applications/pholio/mail/PholioMockMailReceiver.php',
'PholioMockNameHeraldField' => 'applications/pholio/herald/PholioMockNameHeraldField.php',
@@ -9979,6 +9980,7 @@
'PholioMockHeraldField' => 'HeraldField',
'PholioMockHeraldFieldGroup' => 'HeraldFieldGroup',
'PholioMockImagesView' => 'AphrontView',
+ 'PholioMockInlineTransaction' => 'PholioMockTransactionType',
'PholioMockListController' => 'PholioController',
'PholioMockMailReceiver' => 'PhabricatorObjectMailReceiver',
'PholioMockNameHeraldField' => 'PholioMockHeraldField',
diff --git a/src/applications/pholio/controller/PholioMockCommentController.php b/src/applications/pholio/controller/PholioMockCommentController.php
--- a/src/applications/pholio/controller/PholioMockCommentController.php
+++ b/src/applications/pholio/controller/PholioMockCommentController.php
@@ -45,7 +45,7 @@
foreach ($inline_comments as $inline_comment) {
$xactions[] = id(new PholioTransaction())
- ->setTransactionType(PholioTransaction::TYPE_INLINE)
+ ->setTransactionType(PholioMockInlineTransaction::TRANSACTIONTYPE)
->attachComment($inline_comment);
}
diff --git a/src/applications/pholio/editor/PholioMockEditor.php b/src/applications/pholio/editor/PholioMockEditor.php
--- a/src/applications/pholio/editor/PholioMockEditor.php
+++ b/src/applications/pholio/editor/PholioMockEditor.php
@@ -30,23 +30,9 @@
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
- $types[] = PholioTransaction::TYPE_INLINE;
-
return $types;
}
- protected function transactionHasEffect(
- PhabricatorLiskDAO $object,
- PhabricatorApplicationTransaction $xaction) {
-
- switch ($xaction->getTransactionType()) {
- case PholioTransaction::TYPE_INLINE:
- return true;
- }
-
- return parent::transactionHasEffect($object, $xaction);
- }
-
protected function shouldApplyInitialEffects(
PhabricatorLiskDAO $object,
array $xactions) {
@@ -147,7 +133,7 @@
}
$comment = $xaction->getComment();
switch ($xaction->getTransactionType()) {
- case PholioTransaction::TYPE_INLINE:
+ case PholioMockInlineTransaction::TRANSACTIONTYPE:
if ($comment && strlen($comment->getContent())) {
$inline_comments[] = $comment;
}
@@ -237,7 +223,7 @@
// Move inline comments to the end, so the comments precede them.
foreach ($xactions as $xaction) {
$type = $xaction->getTransactionType();
- if ($type == PholioTransaction::TYPE_INLINE) {
+ if ($type == PholioMockInlineTransaction::TRANSACTIONTYPE) {
$tail[] = $xaction;
} else {
$head[] = $xaction;
@@ -252,7 +238,7 @@
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case PholioTransaction::TYPE_INLINE:
+ case PholioMockInlineTransaction::TRANSACTIONTYPE:
return true;
}
diff --git a/src/applications/pholio/storage/PholioTransaction.php b/src/applications/pholio/storage/PholioTransaction.php
--- a/src/applications/pholio/storage/PholioTransaction.php
+++ b/src/applications/pholio/storage/PholioTransaction.php
@@ -2,9 +2,6 @@
final class PholioTransaction extends PhabricatorModularTransaction {
- // Your witty commentary at the mock : image : x,y level
- const TYPE_INLINE = 'inline';
-
const MAILTAG_STATUS = 'pholio-status';
const MAILTAG_COMMENT = 'pholio-comment';
const MAILTAG_UPDATED = 'pholio-updated';
@@ -30,19 +27,10 @@
return new PholioTransactionView();
}
- public function getIcon() {
- switch ($this->getTransactionType()) {
- case self::TYPE_INLINE:
- return 'fa-comment';
- }
-
- return parent::getIcon();
- }
-
public function getMailTags() {
$tags = array();
switch ($this->getTransactionType()) {
- case self::TYPE_INLINE:
+ case PholioMockInlineTransaction::TRANSACTIONTYPE:
case PhabricatorTransactions::TYPE_COMMENT:
$tags[] = self::MAILTAG_COMMENT;
break;
@@ -65,50 +53,4 @@
return $tags;
}
- public function getTitle() {
- $author_phid = $this->getAuthorPHID();
-
- $old = $this->getOldValue();
- $new = $this->getNewValue();
-
- $type = $this->getTransactionType();
- switch ($type) {
- case self::TYPE_INLINE:
- $count = 1;
- foreach ($this->getTransactionGroup() as $xaction) {
- if ($xaction->getTransactionType() == $type) {
- $count++;
- }
- }
-
- return pht(
- '%s added %d inline comment(s).',
- $this->renderHandleLink($author_phid),
- $count);
- break;
- }
-
- return parent::getTitle();
- }
-
- public function getTitleForFeed() {
- $author_phid = $this->getAuthorPHID();
- $object_phid = $this->getObjectPHID();
-
- $old = $this->getOldValue();
- $new = $this->getNewValue();
-
- $type = $this->getTransactionType();
- switch ($type) {
- case self::TYPE_INLINE:
- return pht(
- '%s added an inline comment to %s.',
- $this->renderHandleLink($author_phid),
- $this->renderHandleLink($object_phid));
- break;
- }
-
- return parent::getTitleForFeed();
- }
-
}
diff --git a/src/applications/pholio/view/PholioTransactionView.php b/src/applications/pholio/view/PholioTransactionView.php
--- a/src/applications/pholio/view/PholioTransactionView.php
+++ b/src/applications/pholio/view/PholioTransactionView.php
@@ -30,14 +30,14 @@
switch ($u->getTransactionType()) {
case PhabricatorTransactions::TYPE_COMMENT:
- case PholioTransaction::TYPE_INLINE:
+ case PholioMockInlineTransaction::TRANSACTIONTYPE:
break;
default:
return false;
}
switch ($v->getTransactionType()) {
- case PholioTransaction::TYPE_INLINE:
+ case PholioMockInlineTransaction::TRANSACTIONTYPE:
return true;
}
@@ -50,7 +50,8 @@
$out = array();
$group = $xaction->getTransactionGroup();
- if ($xaction->getTransactionType() == PholioTransaction::TYPE_INLINE) {
+ $type = $xaction->getTransactionType();
+ if ($type == PholioMockInlineTransaction::TRANSACTIONTYPE) {
array_unshift($group, $xaction);
} else {
$out[] = parent::renderTransactionContent($xaction);
@@ -63,7 +64,7 @@
$inlines = array();
foreach ($group as $xaction) {
switch ($xaction->getTransactionType()) {
- case PholioTransaction::TYPE_INLINE:
+ case PholioMockInlineTransaction::TRANSACTIONTYPE:
$inlines[] = $xaction;
break;
default:
diff --git a/src/applications/pholio/xaction/PholioMockInlineTransaction.php b/src/applications/pholio/xaction/PholioMockInlineTransaction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/pholio/xaction/PholioMockInlineTransaction.php
@@ -0,0 +1,33 @@
+<?php
+
+final class PholioMockInlineTransaction
+ extends PholioMockTransactionType {
+
+ const TRANSACTIONTYPE = 'inline';
+
+ public function generateOldValue($object) {
+ return null;
+ }
+
+ public function getTitle() {
+ return pht(
+ '%s added inline comment(s).',
+ $this->renderAuthor());
+ }
+
+ public function getTitleForFeed() {
+ return pht(
+ '%s added an inline comment to %s.',
+ $this->renderAuthor(),
+ $this->renderObject());
+ }
+
+ public function getIcon() {
+ return 'fa-comment';
+ }
+
+ public function getTransactionHasEffect($object, $old, $new) {
+ return true;
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 23, 12:57 AM (5 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7717645
Default Alt Text
D17914.id43092.diff (8 KB)
Attached To
Mode
D17914: Migrate Pholio inline comments to modular transactions
Attached
Detach File
Event Timeline
Log In to Comment