Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F17930952
D17956.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D17956.id.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
@@ -3620,6 +3620,7 @@
'PhabricatorProjectHeraldFieldGroup' => 'applications/project/herald/PhabricatorProjectHeraldFieldGroup.php',
'PhabricatorProjectHovercardEngineExtension' => 'applications/project/engineextension/PhabricatorProjectHovercardEngineExtension.php',
'PhabricatorProjectIconSet' => 'applications/project/icon/PhabricatorProjectIconSet.php',
+ 'PhabricatorProjectIconTransaction' => 'applications/project/xaction/PhabricatorProjectIconTransaction.php',
'PhabricatorProjectIconsConfigOptionType' => 'applications/project/config/PhabricatorProjectIconsConfigOptionType.php',
'PhabricatorProjectImageTransaction' => 'applications/project/xaction/PhabricatorProjectImageTransaction.php',
'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php',
@@ -9035,6 +9036,7 @@
'PhabricatorProjectHeraldFieldGroup' => 'HeraldFieldGroup',
'PhabricatorProjectHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension',
'PhabricatorProjectIconSet' => 'PhabricatorIconSet',
+ 'PhabricatorProjectIconTransaction' => 'PhabricatorProjectTransactionType',
'PhabricatorProjectIconsConfigOptionType' => 'PhabricatorConfigJSONOptionType',
'PhabricatorProjectImageTransaction' => 'PhabricatorProjectTransactionType',
'PhabricatorProjectListController' => 'PhabricatorProjectController',
diff --git a/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php b/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php
--- a/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php
+++ b/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php
@@ -52,7 +52,7 @@
if ($request->getValue('icon')) {
$xactions[] = id(new PhabricatorProjectTransaction())
- ->setTransactionType(PhabricatorProjectTransaction::TYPE_ICON)
+ ->setTransactionType(PhabricatorProjectIconTransaction::TRANSACTIONTYPE)
->setNewValue($request->getValue('icon'));
}
diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
--- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
+++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
@@ -30,7 +30,6 @@
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
$types[] = PhabricatorTransactions::TYPE_JOIN_POLICY;
- $types[] = PhabricatorProjectTransaction::TYPE_ICON;
$types[] = PhabricatorProjectTransaction::TYPE_COLOR;
$types[] = PhabricatorProjectTransaction::TYPE_LOCKED;
$types[] = PhabricatorProjectTransaction::TYPE_PARENT;
@@ -48,8 +47,6 @@
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_ICON:
- return $object->getIcon();
case PhabricatorProjectTransaction::TYPE_COLOR:
return $object->getColor();
case PhabricatorProjectTransaction::TYPE_LOCKED:
@@ -75,7 +72,6 @@
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_ICON:
case PhabricatorProjectTransaction::TYPE_COLOR:
case PhabricatorProjectTransaction::TYPE_LOCKED:
case PhabricatorProjectTransaction::TYPE_PARENT:
@@ -101,9 +97,6 @@
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_ICON:
- $object->setIcon($xaction->getNewValue());
- return;
case PhabricatorProjectTransaction::TYPE_COLOR:
$object->setColor($xaction->getNewValue());
return;
@@ -143,7 +136,6 @@
$new = $xaction->getNewValue();
switch ($xaction->getTransactionType()) {
- case PhabricatorProjectTransaction::TYPE_ICON:
case PhabricatorProjectTransaction::TYPE_COLOR:
case PhabricatorProjectTransaction::TYPE_LOCKED:
case PhabricatorProjectTransaction::TYPE_PARENT:
@@ -329,7 +321,7 @@
case PhabricatorProjectNameTransaction::TRANSACTIONTYPE:
case PhabricatorProjectStatusTransaction::TRANSACTIONTYPE:
case PhabricatorProjectImageTransaction::TRANSACTIONTYPE:
- case PhabricatorProjectTransaction::TYPE_ICON:
+ case PhabricatorProjectIconTransaction::TRANSACTIONTYPE:
case PhabricatorProjectTransaction::TYPE_COLOR:
PhabricatorPolicyFilter::requireCapability(
$this->requireActor(),
diff --git a/src/applications/project/engine/PhabricatorProjectEditEngine.php b/src/applications/project/engine/PhabricatorProjectEditEngine.php
--- a/src/applications/project/engine/PhabricatorProjectEditEngine.php
+++ b/src/applications/project/engine/PhabricatorProjectEditEngine.php
@@ -112,7 +112,7 @@
PhabricatorTransactions::TYPE_VIEW_POLICY,
PhabricatorTransactions::TYPE_EDIT_POLICY,
PhabricatorTransactions::TYPE_JOIN_POLICY,
- PhabricatorProjectTransaction::TYPE_ICON,
+ PhabricatorProjectIconTransaction::TRANSACTIONTYPE,
PhabricatorProjectTransaction::TYPE_COLOR,
);
$unavailable = array_fuse($unavailable);
@@ -244,7 +244,7 @@
id(new PhabricatorIconSetEditField())
->setKey('icon')
->setLabel(pht('Icon'))
- ->setTransactionType(PhabricatorProjectTransaction::TYPE_ICON)
+ ->setTransactionType(PhabricatorProjectIconTransaction::TRANSACTIONTYPE)
->setIconSet(new PhabricatorProjectIconSet())
->setDescription(pht('Project icon.'))
->setConduitDescription(pht('Change the project icon.'))
diff --git a/src/applications/project/storage/PhabricatorProjectTransaction.php b/src/applications/project/storage/PhabricatorProjectTransaction.php
--- a/src/applications/project/storage/PhabricatorProjectTransaction.php
+++ b/src/applications/project/storage/PhabricatorProjectTransaction.php
@@ -3,7 +3,6 @@
final class PhabricatorProjectTransaction
extends PhabricatorModularTransaction {
- const TYPE_ICON = 'project:icon';
const TYPE_COLOR = 'project:color';
const TYPE_LOCKED = 'project:locked';
const TYPE_PARENT = 'project:parent';
@@ -99,8 +98,6 @@
} else {
return 'fa-unlock';
}
- case self::TYPE_ICON:
- return PhabricatorProjectIconSet::getIconIcon($new);
case self::TYPE_MEMBERS:
return 'fa-user';
}
@@ -119,15 +116,6 @@
'%s created this project.',
$this->renderHandleLink($author_phid));
- case self::TYPE_ICON:
- $set = new PhabricatorProjectIconSet();
-
- return pht(
- "%s set this project's icon to %s.",
- $author_handle,
- $set->getIconLabel($new));
- break;
-
case self::TYPE_COLOR:
return pht(
"%s set this project's color to %s.",
@@ -226,16 +214,6 @@
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
-
- case self::TYPE_ICON:
- $set = new PhabricatorProjectIconSet();
-
- return pht(
- '%s set the icon for %s to %s.',
- $author_handle,
- $object_handle,
- $set->getIconLabel($new));
-
case self::TYPE_COLOR:
return pht(
'%s set the color for %s to %s.',
@@ -266,7 +244,7 @@
case PhabricatorProjectNameTransaction::TRANSACTIONTYPE:
case PhabricatorProjectSlugsTransaction::TRANSACTIONTYPE:
case PhabricatorProjectImageTransaction::TRANSACTIONTYPE:
- case self::TYPE_ICON:
+ case PhabricatorProjectIconTransaction::TRANSACTIONTYPE:
case self::TYPE_COLOR:
$tags[] = self::MAILTAG_METADATA;
break;
diff --git a/src/applications/project/xaction/PhabricatorProjectIconTransaction.php b/src/applications/project/xaction/PhabricatorProjectIconTransaction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/xaction/PhabricatorProjectIconTransaction.php
@@ -0,0 +1,42 @@
+<?php
+
+final class PhabricatorProjectIconTransaction
+ extends PhabricatorProjectTransactionType {
+
+ const TRANSACTIONTYPE = 'project:icon';
+
+ public function generateOldValue($object) {
+ return $object->getIcon();
+ }
+
+ public function applyInternalEffects($object, $value) {
+ $object->setIcon($value);
+ }
+
+ public function getTitle() {
+ $set = new PhabricatorProjectIconSet();
+ $new = $this->getNewValue();
+
+ return pht(
+ "%s set this project's icon to %s.",
+ $this->renderAuthor(),
+ $this->renderValue($set->getIconLabel($new)));
+ }
+
+ public function getTitleForFeed() {
+ $set = new PhabricatorProjectIconSet();
+ $new = $this->getNewValue();
+
+ return pht(
+ '%s set the icon for %s to %s.',
+ $this->renderAuthor(),
+ $this->renderObject(),
+ $this->renderValue($set->getIconLabel($new)));
+ }
+
+ public function getIcon() {
+ $new = $this->getNewValue();
+ return PhabricatorProjectIconSet::getIconIcon($new);
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 31, 6:25 PM (4 d, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8731381
Default Alt Text
D17956.id.diff (9 KB)
Attached To
Mode
D17956: Migrate Project icons to modular transactions
Attached
Detach File
Event Timeline
Log In to Comment