1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 14:30:56 +01:00

Remove *TransactionType classes

Summary: Remove the `*TransactionType` classes and define the constants in the corresponding `*Transaction` class instead.

Test Plan: `grep`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D13188
This commit is contained in:
Joshua Spence 2015-06-08 09:54:53 +10:00
parent 259b40fc28
commit 5914bbd806
35 changed files with 395 additions and 441 deletions

View file

@ -264,7 +264,6 @@ phutil_register_library_map(array(
'ConpherenceTransactionComment' => 'applications/conpherence/storage/ConpherenceTransactionComment.php',
'ConpherenceTransactionQuery' => 'applications/conpherence/query/ConpherenceTransactionQuery.php',
'ConpherenceTransactionRenderer' => 'applications/conpherence/ConpherenceTransactionRenderer.php',
'ConpherenceTransactionType' => 'applications/conpherence/constants/ConpherenceTransactionType.php',
'ConpherenceTransactionView' => 'applications/conpherence/view/ConpherenceTransactionView.php',
'ConpherenceUpdateActions' => 'applications/conpherence/constants/ConpherenceUpdateActions.php',
'ConpherenceUpdateController' => 'applications/conpherence/controller/ConpherenceUpdateController.php',
@ -956,7 +955,6 @@ phutil_register_library_map(array(
'JavelinUIExample' => 'applications/uiexample/examples/JavelinUIExample.php',
'JavelinViewExampleServerView' => 'applications/uiexample/examples/JavelinViewExampleServerView.php',
'JavelinViewUIExample' => 'applications/uiexample/examples/JavelinViewUIExample.php',
'LegalpadConstants' => 'applications/legalpad/constants/LegalpadConstants.php',
'LegalpadController' => 'applications/legalpad/controller/LegalpadController.php',
'LegalpadCreateDocumentsCapability' => 'applications/legalpad/capability/LegalpadCreateDocumentsCapability.php',
'LegalpadDAO' => 'applications/legalpad/storage/LegalpadDAO.php',
@ -990,7 +988,6 @@ phutil_register_library_map(array(
'LegalpadTransaction' => 'applications/legalpad/storage/LegalpadTransaction.php',
'LegalpadTransactionComment' => 'applications/legalpad/storage/LegalpadTransactionComment.php',
'LegalpadTransactionQuery' => 'applications/legalpad/query/LegalpadTransactionQuery.php',
'LegalpadTransactionType' => 'applications/legalpad/constants/LegalpadTransactionType.php',
'LegalpadTransactionView' => 'applications/legalpad/view/LegalpadTransactionView.php',
'LiskChunkTestCase' => 'infrastructure/storage/lisk/__tests__/LiskChunkTestCase.php',
'LiskDAO' => 'infrastructure/storage/lisk/LiskDAO.php',
@ -1088,7 +1085,6 @@ phutil_register_library_map(array(
'MetaMTAEmailTransactionCommand' => 'applications/metamta/command/MetaMTAEmailTransactionCommand.php',
'MetaMTAMailReceivedGarbageCollector' => 'applications/metamta/garbagecollector/MetaMTAMailReceivedGarbageCollector.php',
'MetaMTAMailSentGarbageCollector' => 'applications/metamta/garbagecollector/MetaMTAMailSentGarbageCollector.php',
'MetaMTANotificationType' => 'applications/metamta/constants/MetaMTANotificationType.php',
'MetaMTAReceivedMailStatus' => 'applications/metamta/constants/MetaMTAReceivedMailStatus.php',
'MultimeterContext' => 'applications/multimeter/storage/MultimeterContext.php',
'MultimeterControl' => 'applications/multimeter/data/MultimeterControl.php',
@ -2012,7 +2008,6 @@ phutil_register_library_map(array(
'PhabricatorMacroTransaction' => 'applications/macro/storage/PhabricatorMacroTransaction.php',
'PhabricatorMacroTransactionComment' => 'applications/macro/storage/PhabricatorMacroTransactionComment.php',
'PhabricatorMacroTransactionQuery' => 'applications/macro/query/PhabricatorMacroTransactionQuery.php',
'PhabricatorMacroTransactionType' => 'applications/macro/constants/PhabricatorMacroTransactionType.php',
'PhabricatorMacroViewController' => 'applications/macro/controller/PhabricatorMacroViewController.php',
'PhabricatorMailImplementationAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationAdapter.php',
'PhabricatorMailImplementationAmazonSESAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php',
@ -2850,7 +2845,6 @@ phutil_register_library_map(array(
'PhluxVariableQuery' => 'applications/phlux/query/PhluxVariableQuery.php',
'PhluxViewController' => 'applications/phlux/controller/PhluxViewController.php',
'PholioActionMenuEventListener' => 'applications/pholio/event/PholioActionMenuEventListener.php',
'PholioConstants' => 'applications/pholio/constants/PholioConstants.php',
'PholioController' => 'applications/pholio/controller/PholioController.php',
'PholioDAO' => 'applications/pholio/storage/PholioDAO.php',
'PholioDefaultEditCapability' => 'applications/pholio/capability/PholioDefaultEditCapability.php',
@ -2882,7 +2876,6 @@ phutil_register_library_map(array(
'PholioTransaction' => 'applications/pholio/storage/PholioTransaction.php',
'PholioTransactionComment' => 'applications/pholio/storage/PholioTransactionComment.php',
'PholioTransactionQuery' => 'applications/pholio/query/PholioTransactionQuery.php',
'PholioTransactionType' => 'applications/pholio/constants/PholioTransactionType.php',
'PholioTransactionView' => 'applications/pholio/view/PholioTransactionView.php',
'PholioUploadedImageView' => 'applications/pholio/view/PholioUploadedImageView.php',
'PhortuneAccount' => 'applications/phortune/storage/PhortuneAccount.php',
@ -3542,7 +3535,6 @@ phutil_register_library_map(array(
'ConpherenceTransaction' => 'PhabricatorApplicationTransaction',
'ConpherenceTransactionComment' => 'PhabricatorApplicationTransactionComment',
'ConpherenceTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'ConpherenceTransactionType' => 'ConpherenceConstants',
'ConpherenceTransactionView' => 'AphrontView',
'ConpherenceUpdateActions' => 'ConpherenceConstants',
'ConpherenceUpdateController' => 'ConpherenceController',
@ -4331,7 +4323,6 @@ phutil_register_library_map(array(
'LegalpadTransaction' => 'PhabricatorApplicationTransaction',
'LegalpadTransactionComment' => 'PhabricatorApplicationTransactionComment',
'LegalpadTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'LegalpadTransactionType' => 'LegalpadConstants',
'LegalpadTransactionView' => 'PhabricatorApplicationTransactionView',
'LiskChunkTestCase' => 'PhabricatorTestCase',
'LiskDAOTestCase' => 'PhabricatorTestCase',
@ -4440,7 +4431,6 @@ phutil_register_library_map(array(
'MetaMTAEmailTransactionCommand' => 'Phobject',
'MetaMTAMailReceivedGarbageCollector' => 'PhabricatorGarbageCollector',
'MetaMTAMailSentGarbageCollector' => 'PhabricatorGarbageCollector',
'MetaMTANotificationType' => 'MetaMTAConstants',
'MetaMTAReceivedMailStatus' => 'MetaMTAConstants',
'MultimeterContext' => 'MultimeterDimension',
'MultimeterController' => 'PhabricatorController',
@ -6430,7 +6420,6 @@ phutil_register_library_map(array(
'PholioTransaction' => 'PhabricatorApplicationTransaction',
'PholioTransactionComment' => 'PhabricatorApplicationTransactionComment',
'PholioTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PholioTransactionType' => 'PholioConstants',
'PholioTransactionView' => 'PhabricatorApplicationTransactionView',
'PholioUploadedImageView' => 'AphrontView',
'PhortuneAccount' => array(

View file

@ -61,7 +61,7 @@ final class ConpherenceTransactionRenderer {
// between days. some setup required!
$previous_transaction = null;
$date_marker_transaction = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_DATE_MARKER)
->setTransactionType(ConpherenceTransaction::TYPE_DATE_MARKER)
->makeEphemeral();
$date_marker_transaction_view = id(new ConpherenceTransactionView())
->setUser($user)

View file

@ -157,10 +157,10 @@ final class ConpherenceRoomTestCase extends ConpherenceTestCase {
$xactions = array();
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_PARTICIPANTS)
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => $participant_phids));
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE)
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setNewValue('Test');
id(new ConpherenceEditor())

View file

@ -8,7 +8,7 @@ abstract class ConpherenceTestCase extends PhabricatorTestCase {
array $participant_phids) {
$xactions = array(id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_PARTICIPANTS)
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => $participant_phids)),
);
$editor = id(new ConpherenceEditor())
@ -24,7 +24,7 @@ abstract class ConpherenceTestCase extends PhabricatorTestCase {
array $participant_phids) {
$xactions = array(id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_PARTICIPANTS)
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('-' => $participant_phids)),
);
$editor = id(new ConpherenceEditor())

View file

@ -71,7 +71,7 @@ final class ConpherenceUpdateThreadConduitAPIMethod
if ($add_participant_phids) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(
ConpherenceTransactionType::TYPE_PARTICIPANTS)
ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => $add_participant_phids));
}
if ($remove_participant_phid) {
@ -80,12 +80,12 @@ final class ConpherenceUpdateThreadConduitAPIMethod
}
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(
ConpherenceTransactionType::TYPE_PARTICIPANTS)
ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('-' => array($remove_participant_phid)));
}
if ($title) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE)
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setNewValue($title);
}
if ($message) {

View file

@ -1,12 +0,0 @@
<?php
final class ConpherenceTransactionType extends ConpherenceConstants {
const TYPE_FILES = 'files';
const TYPE_TITLE = 'title';
const TYPE_PARTICIPANTS = 'participants';
const TYPE_DATE_MARKER = 'date-marker';
const TYPE_PICTURE = 'picture';
const TYPE_PICTURE_CROP = 'picture-crop';
}

View file

@ -14,10 +14,10 @@ final class ConpherenceNewRoomController extends ConpherenceController {
$xactions = array();
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_PARTICIPANTS)
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => array($user->getPHID())));
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE)
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setNewValue($request->getStr('title'));
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
@ -41,7 +41,7 @@ final class ConpherenceNewRoomController extends ConpherenceController {
} catch (PhabricatorApplicationTransactionValidationException $ex) {
$validation_exception = $ex;
$e_title = $ex->getShortMessage(ConpherenceTransactionType::TYPE_TITLE);
$e_title = $ex->getShortMessage(ConpherenceTransaction::TYPE_TITLE);
$conpherence->setViewPolicy($request->getStr('viewPolicy'));
$conpherence->setEditPolicy($request->getStr('editPolicy'));

View file

@ -67,7 +67,7 @@ final class ConpherenceUpdateController
case ConpherenceUpdateActions::JOIN_ROOM:
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(
ConpherenceTransactionType::TYPE_PARTICIPANTS)
ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => array($user->getPHID())));
$delete_draft = true;
$message = $request->getStr('text');
@ -101,7 +101,7 @@ final class ConpherenceUpdateController
if (!empty($person_phids)) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(
ConpherenceTransactionType::TYPE_PARTICIPANTS)
ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => $person_phids));
}
break;
@ -114,7 +114,7 @@ final class ConpherenceUpdateController
if ($person_phid && $person_phid == $user->getPHID()) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(
ConpherenceTransactionType::TYPE_PARTICIPANTS)
ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('-' => array($person_phid)));
$response_mode = 'go-home';
}
@ -144,7 +144,7 @@ final class ConpherenceUpdateController
->withIDs(array($file_id))
->executeOne();
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_PICTURE)
->setTransactionType(ConpherenceTransaction::TYPE_PICTURE)
->setNewValue($orig_file);
$okay = $orig_file->isTransformableImage();
if ($okay) {
@ -157,7 +157,7 @@ final class ConpherenceUpdateController
ConpherenceImageData::CROP_HEIGHT);
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(
ConpherenceTransactionType::TYPE_PICTURE_CROP)
ConpherenceTransaction::TYPE_PICTURE_CROP)
->setNewValue($crop_file->getPHID());
}
$response_mode = 'redirect';
@ -181,12 +181,12 @@ final class ConpherenceUpdateController
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(
ConpherenceTransactionType::TYPE_PICTURE_CROP)
ConpherenceTransaction::TYPE_PICTURE_CROP)
->setNewValue($image_phid);
}
$title = $request->getStr('title');
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE)
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setNewValue($title);
if ($conpherence->getIsRoom()) {
$xactions[] = id(new ConpherenceTransaction())

View file

@ -47,16 +47,16 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
if (!$errors) {
$xactions = array();
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_PARTICIPANTS)
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => $participant_phids));
if ($files) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_FILES)
->setTransactionType(ConpherenceTransaction::TYPE_FILES)
->setNewValue(array('+' => mpull($files, 'getPHID')));
}
if ($title) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE)
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setNewValue($title);
}
@ -100,7 +100,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$xactions = array();
if ($files) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_FILES)
->setTransactionType(ConpherenceTransaction::TYPE_FILES)
->setNewValue(array('+' => mpull($files, 'getPHID')));
}
$xactions[] = id(new ConpherenceTransaction())
@ -117,11 +117,11 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$types[] = PhabricatorTransactions::TYPE_COMMENT;
$types[] = ConpherenceTransactionType::TYPE_TITLE;
$types[] = ConpherenceTransactionType::TYPE_PARTICIPANTS;
$types[] = ConpherenceTransactionType::TYPE_FILES;
$types[] = ConpherenceTransactionType::TYPE_PICTURE;
$types[] = ConpherenceTransactionType::TYPE_PICTURE_CROP;
$types[] = ConpherenceTransaction::TYPE_TITLE;
$types[] = ConpherenceTransaction::TYPE_PARTICIPANTS;
$types[] = ConpherenceTransaction::TYPE_FILES;
$types[] = ConpherenceTransaction::TYPE_PICTURE;
$types[] = ConpherenceTransaction::TYPE_PICTURE_CROP;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
$types[] = PhabricatorTransactions::TYPE_JOIN_POLICY;
@ -134,18 +134,18 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransaction::TYPE_TITLE:
return $object->getTitle();
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransaction::TYPE_PICTURE:
return $object->getImagePHID(ConpherenceImageData::SIZE_ORIG);
case ConpherenceTransactionType::TYPE_PICTURE_CROP:
case ConpherenceTransaction::TYPE_PICTURE_CROP:
return $object->getImagePHID(ConpherenceImageData::SIZE_CROP);
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case ConpherenceTransaction::TYPE_PARTICIPANTS:
if ($this->getIsNewObject()) {
return array();
}
return $object->getParticipantPHIDs();
case ConpherenceTransactionType::TYPE_FILES:
case ConpherenceTransaction::TYPE_FILES:
return $object->getFilePHIDs();
}
}
@ -155,14 +155,14 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_PICTURE_CROP:
case ConpherenceTransaction::TYPE_TITLE:
case ConpherenceTransaction::TYPE_PICTURE_CROP:
return $xaction->getNewValue();
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransaction::TYPE_PICTURE:
$file = $xaction->getNewValue();
return $file->getPHID();
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case ConpherenceTransactionType::TYPE_FILES:
case ConpherenceTransaction::TYPE_PARTICIPANTS:
case ConpherenceTransaction::TYPE_FILES:
return $this->getPHIDTransactionNewValue($xaction);
}
}
@ -207,7 +207,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
foreach ($xactions as $xaction) {
switch ($xaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case ConpherenceTransaction::TYPE_PARTICIPANTS:
// Since this is a new ConpherenceThread, we have to create the
// participation data asap to pass policy checks. For existing
// ConpherenceThreads, the existing participation is correct
@ -247,20 +247,20 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$make_author_recent_participant = true;
switch ($xaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransaction::TYPE_TITLE:
$object->setTitle($xaction->getNewValue());
break;
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransaction::TYPE_PICTURE:
$object->setImagePHID(
$xaction->getNewValue(),
ConpherenceImageData::SIZE_ORIG);
break;
case ConpherenceTransactionType::TYPE_PICTURE_CROP:
case ConpherenceTransaction::TYPE_PICTURE_CROP:
$object->setImagePHID(
$xaction->getNewValue(),
ConpherenceImageData::SIZE_CROP);
break;
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case ConpherenceTransaction::TYPE_PARTICIPANTS:
if (!$this->getIsNewObject()) {
$old_map = array_fuse($xaction->getOldValue());
$new_map = array_fuse($xaction->getNewValue());
@ -322,7 +322,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_FILES:
case ConpherenceTransaction::TYPE_FILES:
$editor = new PhabricatorEdgeEditor();
$edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
$old = array_fill_keys($xaction->getOldValue(), true);
@ -343,7 +343,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
}
$editor->save();
break;
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case ConpherenceTransaction::TYPE_PARTICIPANTS:
if ($this->getIsNewObject()) {
continue;
}
@ -443,7 +443,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
parent::requireCapabilities($object, $xaction);
switch ($xaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case ConpherenceTransaction::TYPE_PARTICIPANTS:
$old_map = array_fuse($xaction->getOldValue());
$new_map = array_fuse($xaction->getNewValue());
@ -473,13 +473,13 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
break;
// This is similar to PhabricatorTransactions::TYPE_COMMENT so
// use CAN_VIEW
case ConpherenceTransactionType::TYPE_FILES:
case ConpherenceTransaction::TYPE_FILES:
PhabricatorPolicyFilter::requireCapability(
$this->requireActor(),
$object,
PhabricatorPolicyCapability::CAN_VIEW);
break;
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransaction::TYPE_TITLE:
PhabricatorPolicyFilter::requireCapability(
$this->requireActor(),
$object,
@ -494,10 +494,10 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$type = $u->getTransactionType();
switch ($type) {
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransaction::TYPE_TITLE:
return $v;
case ConpherenceTransactionType::TYPE_FILES:
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case ConpherenceTransaction::TYPE_FILES:
case ConpherenceTransaction::TYPE_PARTICIPANTS:
return $this->mergePHIDOrEdgeTransactions($u, $v);
}
@ -626,9 +626,9 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransaction::TYPE_PICTURE:
return array($xaction->getNewValue()->getPHID());
case ConpherenceTransactionType::TYPE_PICTURE_CROP:
case ConpherenceTransaction::TYPE_PICTURE_CROP:
return array($xaction->getNewValue());
}
@ -643,7 +643,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$errors = parent::validateTransaction($object, $type, $xactions);
switch ($type) {
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransaction::TYPE_TITLE:
if (!$object->getIsRoom()) {
continue;
}
@ -667,7 +667,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$errors[] = $error;
}
break;
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransaction::TYPE_PICTURE:
foreach ($xactions as $xaction) {
$file = $xaction->getNewValue();
if (!$file->isTransformableImage()) {
@ -682,7 +682,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
}
}
break;
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case ConpherenceTransaction::TYPE_PARTICIPANTS:
foreach ($xactions as $xaction) {
$new_phids = $this->getPHIDTransactionNewValue($xaction, array());
$old_phids = nonempty($object->getParticipantPHIDs(), array());

View file

@ -65,7 +65,7 @@ final class ConpherenceReplyHandler extends PhabricatorMailReplyHandler {
$xactions = array();
if ($this->getMailAddedParticipantPHIDs()) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_PARTICIPANTS)
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => $this->getMailAddedParticipantPHIDs()));
}

View file

@ -2,6 +2,13 @@
final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
const TYPE_FILES = 'files';
const TYPE_TITLE = 'title';
const TYPE_PARTICIPANTS = 'participants';
const TYPE_DATE_MARKER = 'date-marker';
const TYPE_PICTURE = 'picture';
const TYPE_PICTURE_CROP = 'picture-crop';
public function getApplicationName() {
return 'conpherence';
}
@ -16,7 +23,7 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
public function getNoEffectDescription() {
switch ($this->getTransactionType()) {
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case self::TYPE_PARTICIPANTS:
return pht(
'You can not add a participant who has already been added.');
break;
@ -29,15 +36,15 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
$old = $this->getOldValue();
switch ($this->getTransactionType()) {
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case self::TYPE_PARTICIPANTS:
return ($old === null);
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransactionType::TYPE_DATE_MARKER:
case self::TYPE_TITLE:
case self::TYPE_PICTURE:
case self::TYPE_DATE_MARKER:
return false;
case ConpherenceTransactionType::TYPE_FILES:
case self::TYPE_FILES:
return true;
case ConpherenceTransactionType::TYPE_PICTURE_CROP:
case self::TYPE_PICTURE_CROP:
return true;
}
@ -51,18 +58,18 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE:
case self::TYPE_TITLE:
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_JOIN_POLICY:
case ConpherenceTransactionType::TYPE_PICTURE:
case self::TYPE_PICTURE:
if ($this->getObject()->getIsRoom()) {
return $this->getRoomTitle();
} else {
return $this->getThreadTitle();
}
break;
case ConpherenceTransactionType::TYPE_FILES:
case self::TYPE_FILES:
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
@ -85,7 +92,7 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
}
return $title;
break;
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case self::TYPE_PARTICIPANTS:
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
@ -124,7 +131,7 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE:
case self::TYPE_TITLE:
if ($old && $new) {
$title = pht(
'%s renamed this room from "%s" to "%s".',
@ -144,7 +151,7 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
}
return $title;
break;
case ConpherenceTransactionType::TYPE_PICTURE:
case self::TYPE_PICTURE:
return pht(
'%s updated the room image.',
$this->renderHandleLink($author_phid));
@ -180,7 +187,7 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE:
case self::TYPE_TITLE:
if ($old && $new) {
$title = pht(
'%s renamed this thread from "%s" to "%s".',
@ -200,7 +207,7 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
}
return $title;
break;
case ConpherenceTransactionType::TYPE_PICTURE:
case self::TYPE_PICTURE:
return pht(
'%s updated the room image.',
$this->renderHandleLink($author_phid));
@ -237,12 +244,12 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
$phids[] = $this->getAuthorPHID();
switch ($this->getTransactionType()) {
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransactionType::TYPE_FILES:
case ConpherenceTransactionType::TYPE_DATE_MARKER:
case self::TYPE_TITLE:
case self::TYPE_PICTURE:
case self::TYPE_FILES:
case self::TYPE_DATE_MARKER:
break;
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case self::TYPE_PARTICIPANTS:
$phids = array_merge($phids, $this->getOldValue());
$phids = array_merge($phids, $this->getNewValue());
break;

View file

@ -71,7 +71,7 @@ final class ConpherenceTransactionView extends AphrontView {
$transaction = $this->getConpherenceTransaction();
switch ($transaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_DATE_MARKER:
case ConpherenceTransaction::TYPE_DATE_MARKER:
return javelin_tag(
'div',
array(
@ -239,13 +239,13 @@ final class ConpherenceTransactionView extends AphrontView {
$content = null;
$handles = $this->getHandles();
switch ($transaction->getTransactionType()) {
case ConpherenceTransactionType::TYPE_FILES:
case ConpherenceTransaction::TYPE_FILES:
$content = $transaction->getTitle();
break;
case ConpherenceTransactionType::TYPE_TITLE:
case ConpherenceTransactionType::TYPE_PICTURE:
case ConpherenceTransactionType::TYPE_PICTURE_CROP:
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
case ConpherenceTransaction::TYPE_TITLE:
case ConpherenceTransaction::TYPE_PICTURE:
case ConpherenceTransaction::TYPE_PICTURE_CROP:
case ConpherenceTransaction::TYPE_PARTICIPANTS:
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_JOIN_POLICY:

View file

@ -1258,19 +1258,19 @@ final class DifferentialTransactionEditor
public function getMailTagsMap() {
return array(
MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEW_REQUEST =>
DifferentialTransaction::MAILTAG_REVIEW_REQUEST =>
pht('A revision is created.'),
MetaMTANotificationType::TYPE_DIFFERENTIAL_UPDATED =>
DifferentialTransaction::MAILTAG_UPDATED =>
pht('A revision is updated.'),
MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT =>
DifferentialTransaction::MAILTAG_COMMENT =>
pht('Someone comments on a revision.'),
MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED =>
DifferentialTransaction::MAILTAG_CLOSED =>
pht('A revision is closed.'),
MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS =>
DifferentialTransaction::MAILTAG_REVIEWERS =>
pht("A revision's reviewers change."),
MetaMTANotificationType::TYPE_DIFFERENTIAL_CC =>
DifferentialTransaction::MAILTAG_CC =>
pht("A revision's CCs change."),
MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER =>
DifferentialTransaction::MAILTAG_OTHER =>
pht('Other revision activity not listed above occurs.'),
);
}

View file

@ -4,6 +4,19 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
private $isCommandeerSideEffect;
const TYPE_INLINE = 'differential:inline';
const TYPE_UPDATE = 'differential:update';
const TYPE_ACTION = 'differential:action';
const TYPE_STATUS = 'differential:status';
const MAILTAG_REVIEWERS = 'differential-reviewers';
const MAILTAG_CLOSED = 'differential-committed';
const MAILTAG_CC = 'differential-cc';
const MAILTAG_COMMENT = 'differential-comment';
const MAILTAG_UPDATED = 'differential-updated';
const MAILTAG_REVIEW_REQUEST = 'differential-review-request';
const MAILTAG_OTHER = 'differential-other';
public function setIsCommandeerSideEffect($is_side_effect) {
$this->isCommandeerSideEffect = $is_side_effect;
@ -14,11 +27,6 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
return $this->isCommandeerSideEffect;
}
const TYPE_INLINE = 'differential:inline';
const TYPE_UPDATE = 'differential:update';
const TYPE_ACTION = 'differential:action';
const TYPE_STATUS = 'differential:status';
public function getApplicationName() {
return 'differential';
}
@ -109,7 +117,6 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
}
public function getActionStrength() {
switch ($this->getTransactionType()) {
case self::TYPE_ACTION:
return 3;
@ -160,38 +167,38 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
switch ($this->getTransactionType()) {
case PhabricatorTransactions::TYPE_SUBSCRIBERS;
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CC;
$tags[] = self::MAILTAG_CC;
break;
case self::TYPE_ACTION:
switch ($this->getNewValue()) {
case DifferentialAction::ACTION_CLOSE:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED;
$tags[] = self::MAILTAG_CLOSED;
break;
}
break;
case self::TYPE_UPDATE:
$old = $this->getOldValue();
if ($old === null) {
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEW_REQUEST;
$tags[] = self::MAILTAG_REVIEW_REQUEST;
} else {
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_UPDATED;
$tags[] = self::MAILTAG_UPDATED;
}
break;
case PhabricatorTransactions::TYPE_EDGE:
switch ($this->getMetadataValue('edge:type')) {
case DifferentialRevisionHasReviewerEdgeType::EDGECONST:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS;
$tags[] = self::MAILTAG_REVIEWERS;
break;
}
break;
case PhabricatorTransactions::TYPE_COMMENT:
case self::TYPE_INLINE:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT;
$tags[] = self::MAILTAG_COMMENT;
break;
}
if (!$tags) {
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER;
$tags[] = self::MAILTAG_OTHER;
}
return $tags;

View file

@ -1,3 +0,0 @@
<?php
abstract class LegalpadConstants {}

View file

@ -1,11 +0,0 @@
<?php
final class LegalpadTransactionType extends LegalpadConstants {
const TYPE_TITLE = 'title';
const TYPE_TEXT = 'text';
const TYPE_SIGNATURE_TYPE = 'legalpad:signature-type';
const TYPE_PREAMBLE = 'legalpad:premable';
const TYPE_REQUIRE_SIGNATURE = 'legalpad:require-signature';
}

View file

@ -57,7 +57,7 @@ final class LegalpadDocumentEditController extends LegalpadController {
$errors[] = pht('The document title may not be blank.');
} else {
$xactions[] = id(new LegalpadTransaction())
->setTransactionType(LegalpadTransactionType::TYPE_TITLE)
->setTransactionType(LegalpadTransaction::TYPE_TITLE)
->setNewValue($title);
}
@ -67,7 +67,7 @@ final class LegalpadDocumentEditController extends LegalpadController {
$errors[] = pht('The document may not be blank.');
} else {
$xactions[] = id(new LegalpadTransaction())
->setTransactionType(LegalpadTransactionType::TYPE_TEXT)
->setTransactionType(LegalpadTransaction::TYPE_TEXT)
->setNewValue($text);
}
@ -83,13 +83,13 @@ final class LegalpadDocumentEditController extends LegalpadController {
if ($is_create) {
$v_signature_type = $request->getStr('signatureType');
$xactions[] = id(new LegalpadTransaction())
->setTransactionType(LegalpadTransactionType::TYPE_SIGNATURE_TYPE)
->setTransactionType(LegalpadTransaction::TYPE_SIGNATURE_TYPE)
->setNewValue($v_signature_type);
}
$v_preamble = $request->getStr('preamble');
$xactions[] = id(new LegalpadTransaction())
->setTransactionType(LegalpadTransactionType::TYPE_PREAMBLE)
->setTransactionType(LegalpadTransaction::TYPE_PREAMBLE)
->setNewValue($v_preamble);
$v_require_signature = $request->getBool('requireSignature', 0);
@ -106,7 +106,7 @@ final class LegalpadDocumentEditController extends LegalpadController {
}
if ($user->getIsAdmin()) {
$xactions[] = id(new LegalpadTransaction())
->setTransactionType(LegalpadTransactionType::TYPE_REQUIRE_SIGNATURE)
->setTransactionType(LegalpadTransaction::TYPE_REQUIRE_SIGNATURE)
->setNewValue($v_require_signature);
}

View file

@ -28,11 +28,11 @@ final class LegalpadDocumentEditor
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
$types[] = LegalpadTransactionType::TYPE_TITLE;
$types[] = LegalpadTransactionType::TYPE_TEXT;
$types[] = LegalpadTransactionType::TYPE_SIGNATURE_TYPE;
$types[] = LegalpadTransactionType::TYPE_PREAMBLE;
$types[] = LegalpadTransactionType::TYPE_REQUIRE_SIGNATURE;
$types[] = LegalpadTransaction::TYPE_TITLE;
$types[] = LegalpadTransaction::TYPE_TEXT;
$types[] = LegalpadTransaction::TYPE_SIGNATURE_TYPE;
$types[] = LegalpadTransaction::TYPE_PREAMBLE;
$types[] = LegalpadTransaction::TYPE_REQUIRE_SIGNATURE;
return $types;
}
@ -42,15 +42,15 @@ final class LegalpadDocumentEditor
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case LegalpadTransactionType::TYPE_TITLE:
case LegalpadTransaction::TYPE_TITLE:
return $object->getDocumentBody()->getTitle();
case LegalpadTransactionType::TYPE_TEXT:
case LegalpadTransaction::TYPE_TEXT:
return $object->getDocumentBody()->getText();
case LegalpadTransactionType::TYPE_SIGNATURE_TYPE:
case LegalpadTransaction::TYPE_SIGNATURE_TYPE:
return $object->getSignatureType();
case LegalpadTransactionType::TYPE_PREAMBLE:
case LegalpadTransaction::TYPE_PREAMBLE:
return $object->getPreamble();
case LegalpadTransactionType::TYPE_REQUIRE_SIGNATURE:
case LegalpadTransaction::TYPE_REQUIRE_SIGNATURE:
return (bool)$object->getRequireSignature();
}
}
@ -60,12 +60,12 @@ final class LegalpadDocumentEditor
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case LegalpadTransactionType::TYPE_TITLE:
case LegalpadTransactionType::TYPE_TEXT:
case LegalpadTransactionType::TYPE_SIGNATURE_TYPE:
case LegalpadTransactionType::TYPE_PREAMBLE:
case LegalpadTransaction::TYPE_TITLE:
case LegalpadTransaction::TYPE_TEXT:
case LegalpadTransaction::TYPE_SIGNATURE_TYPE:
case LegalpadTransaction::TYPE_PREAMBLE:
return $xaction->getNewValue();
case LegalpadTransactionType::TYPE_REQUIRE_SIGNATURE:
case LegalpadTransaction::TYPE_REQUIRE_SIGNATURE:
return (bool)$xaction->getNewValue();
}
}
@ -75,24 +75,24 @@ final class LegalpadDocumentEditor
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case LegalpadTransactionType::TYPE_TITLE:
case LegalpadTransaction::TYPE_TITLE:
$object->setTitle($xaction->getNewValue());
$body = $object->getDocumentBody();
$body->setTitle($xaction->getNewValue());
$this->setIsContribution(true);
break;
case LegalpadTransactionType::TYPE_TEXT:
case LegalpadTransaction::TYPE_TEXT:
$body = $object->getDocumentBody();
$body->setText($xaction->getNewValue());
$this->setIsContribution(true);
break;
case LegalpadTransactionType::TYPE_SIGNATURE_TYPE:
case LegalpadTransaction::TYPE_SIGNATURE_TYPE:
$object->setSignatureType($xaction->getNewValue());
break;
case LegalpadTransactionType::TYPE_PREAMBLE:
case LegalpadTransaction::TYPE_PREAMBLE:
$object->setPreamble($xaction->getNewValue());
break;
case LegalpadTransactionType::TYPE_REQUIRE_SIGNATURE:
case LegalpadTransaction::TYPE_REQUIRE_SIGNATURE:
$object->setRequireSignature((int)$xaction->getNewValue());
break;
}
@ -103,7 +103,7 @@ final class LegalpadDocumentEditor
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case LegalpadTransactionType::TYPE_REQUIRE_SIGNATURE:
case LegalpadTransaction::TYPE_REQUIRE_SIGNATURE:
if ($xaction->getNewValue()) {
$session = new PhabricatorAuthSession();
queryfx(
@ -154,11 +154,11 @@ final class LegalpadDocumentEditor
$type = $u->getTransactionType();
switch ($type) {
case LegalpadTransactionType::TYPE_TITLE:
case LegalpadTransactionType::TYPE_TEXT:
case LegalpadTransactionType::TYPE_SIGNATURE_TYPE:
case LegalpadTransactionType::TYPE_PREAMBLE:
case LegalpadTransactionType::TYPE_REQUIRE_SIGNATURE:
case LegalpadTransaction::TYPE_TITLE:
case LegalpadTransaction::TYPE_TEXT:
case LegalpadTransaction::TYPE_SIGNATURE_TYPE:
case LegalpadTransaction::TYPE_PREAMBLE:
case LegalpadTransaction::TYPE_REQUIRE_SIGNATURE:
return $v;
}
@ -200,10 +200,10 @@ final class LegalpadDocumentEditor
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case LegalpadTransactionType::TYPE_TEXT:
case LegalpadTransactionType::TYPE_TITLE:
case LegalpadTransactionType::TYPE_PREAMBLE:
case LegalpadTransactionType::TYPE_REQUIRE_SIGNATURE:
case LegalpadTransaction::TYPE_TEXT:
case LegalpadTransaction::TYPE_TITLE:
case LegalpadTransaction::TYPE_PREAMBLE:
case LegalpadTransaction::TYPE_REQUIRE_SIGNATURE:
return true;
}

View file

@ -2,6 +2,12 @@
final class LegalpadTransaction extends PhabricatorApplicationTransaction {
const TYPE_TITLE = 'title';
const TYPE_TEXT = 'text';
const TYPE_SIGNATURE_TYPE = 'legalpad:signature-type';
const TYPE_PREAMBLE = 'legalpad:premable';
const TYPE_REQUIRE_SIGNATURE = 'legalpad:require-signature';
public function getApplicationName() {
return 'legalpad';
}
@ -22,10 +28,10 @@ final class LegalpadTransaction extends PhabricatorApplicationTransaction {
$old = $this->getOldValue();
switch ($this->getTransactionType()) {
case LegalpadTransactionType::TYPE_TITLE:
case LegalpadTransactionType::TYPE_TEXT:
case self::TYPE_TITLE:
case self::TYPE_TEXT:
return ($old === null);
case LegalpadTransactionType::TYPE_SIGNATURE_TYPE:
case self::TYPE_SIGNATURE_TYPE:
return true;
}
@ -40,21 +46,21 @@ final class LegalpadTransaction extends PhabricatorApplicationTransaction {
$type = $this->getTransactionType();
switch ($type) {
case LegalpadTransactionType::TYPE_TITLE:
case self::TYPE_TITLE:
return pht(
'%s renamed this document from "%s" to "%s".',
$this->renderHandleLink($author_phid),
$old,
$new);
case LegalpadTransactionType::TYPE_TEXT:
case self::TYPE_TEXT:
return pht(
"%s updated the document's text.",
$this->renderHandleLink($author_phid));
case LegalpadTransactionType::TYPE_PREAMBLE:
case self::TYPE_PREAMBLE:
return pht(
'%s updated the preamble.',
$this->renderHandleLink($author_phid));
case LegalpadTransactionType::TYPE_REQUIRE_SIGNATURE:
case self::TYPE_REQUIRE_SIGNATURE:
if ($new) {
$text = pht(
'%s set the document to require signatures.',
@ -72,9 +78,9 @@ final class LegalpadTransaction extends PhabricatorApplicationTransaction {
public function hasChangeDetails() {
switch ($this->getTransactionType()) {
case LegalpadTransactionType::TYPE_TITLE:
case LegalpadTransactionType::TYPE_TEXT:
case LegalpadTransactionType::TYPE_PREAMBLE:
case self::TYPE_TITLE:
case self::TYPE_TEXT:
case self::TYPE_PREAMBLE:
return true;
}
return parent::hasChangeDetails();

View file

@ -1,12 +0,0 @@
<?php
final class PhabricatorMacroTransactionType {
const TYPE_NAME = 'macro:name';
const TYPE_DISABLED = 'macro:disabled';
const TYPE_FILE = 'macro:file';
const TYPE_AUDIO = 'macro:audio';
const TYPE_AUDIO_BEHAVIOR = 'macro:audiobehavior';
}

View file

@ -40,7 +40,7 @@ final class PhabricatorMacroAudioController extends PhabricatorMacroController {
if ($request->getBool('behaviorForm')) {
$xactions[] = id(new PhabricatorMacroTransaction())
->setTransactionType(
PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR)
PhabricatorMacroTransaction::TYPE_AUDIO_BEHAVIOR)
->setNewValue($request->getStr('audioBehavior'));
} else {
$file = null;
@ -60,7 +60,7 @@ final class PhabricatorMacroAudioController extends PhabricatorMacroController {
$e_file = pht('Invalid');
} else {
$xactions[] = id(new PhabricatorMacroTransaction())
->setTransactionType(PhabricatorMacroTransactionType::TYPE_AUDIO)
->setTransactionType(PhabricatorMacroTransaction::TYPE_AUDIO)
->setNewValue($file->getPHID());
}
} else {

View file

@ -28,7 +28,7 @@ final class PhabricatorMacroDisableController
if ($request->isDialogFormPost() || $macro->getIsDisabled()) {
$xaction = id(new PhabricatorMacroTransaction())
->setTransactionType(PhabricatorMacroTransactionType::TYPE_DISABLED)
->setTransactionType(PhabricatorMacroTransaction::TYPE_DISABLED)
->setNewValue($macro->getIsDisabled() ? 0 : 1);
$editor = id(new PhabricatorMacroEditor())

View file

@ -141,13 +141,13 @@ final class PhabricatorMacroEditController extends PhabricatorMacroController {
if ($new_name !== null) {
$xactions[] = id(new PhabricatorMacroTransaction())
->setTransactionType(PhabricatorMacroTransactionType::TYPE_NAME)
->setTransactionType(PhabricatorMacroTransaction::TYPE_NAME)
->setNewValue($new_name);
}
if ($file) {
$xactions[] = id(new PhabricatorMacroTransaction())
->setTransactionType(PhabricatorMacroTransactionType::TYPE_FILE)
->setTransactionType(PhabricatorMacroTransaction::TYPE_FILE)
->setNewValue($file->getPHID());
}

View file

@ -15,11 +15,11 @@ final class PhabricatorMacroEditor
$types = parent::getTransactionTypes();
$types[] = PhabricatorTransactions::TYPE_COMMENT;
$types[] = PhabricatorMacroTransactionType::TYPE_NAME;
$types[] = PhabricatorMacroTransactionType::TYPE_DISABLED;
$types[] = PhabricatorMacroTransactionType::TYPE_FILE;
$types[] = PhabricatorMacroTransactionType::TYPE_AUDIO;
$types[] = PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR;
$types[] = PhabricatorMacroTransaction::TYPE_NAME;
$types[] = PhabricatorMacroTransaction::TYPE_DISABLED;
$types[] = PhabricatorMacroTransaction::TYPE_FILE;
$types[] = PhabricatorMacroTransaction::TYPE_AUDIO;
$types[] = PhabricatorMacroTransaction::TYPE_AUDIO_BEHAVIOR;
return $types;
}
@ -29,15 +29,15 @@ final class PhabricatorMacroEditor
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME:
case PhabricatorMacroTransaction::TYPE_NAME:
return $object->getName();
case PhabricatorMacroTransactionType::TYPE_DISABLED:
case PhabricatorMacroTransaction::TYPE_DISABLED:
return $object->getIsDisabled();
case PhabricatorMacroTransactionType::TYPE_FILE:
case PhabricatorMacroTransaction::TYPE_FILE:
return $object->getFilePHID();
case PhabricatorMacroTransactionType::TYPE_AUDIO:
case PhabricatorMacroTransaction::TYPE_AUDIO:
return $object->getAudioPHID();
case PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR:
case PhabricatorMacroTransaction::TYPE_AUDIO_BEHAVIOR:
return $object->getAudioBehavior();
}
}
@ -47,11 +47,11 @@ final class PhabricatorMacroEditor
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME:
case PhabricatorMacroTransactionType::TYPE_DISABLED:
case PhabricatorMacroTransactionType::TYPE_FILE:
case PhabricatorMacroTransactionType::TYPE_AUDIO:
case PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR:
case PhabricatorMacroTransaction::TYPE_NAME:
case PhabricatorMacroTransaction::TYPE_DISABLED:
case PhabricatorMacroTransaction::TYPE_FILE:
case PhabricatorMacroTransaction::TYPE_AUDIO:
case PhabricatorMacroTransaction::TYPE_AUDIO_BEHAVIOR:
return $xaction->getNewValue();
}
}
@ -61,19 +61,19 @@ final class PhabricatorMacroEditor
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME:
case PhabricatorMacroTransaction::TYPE_NAME:
$object->setName($xaction->getNewValue());
break;
case PhabricatorMacroTransactionType::TYPE_DISABLED:
case PhabricatorMacroTransaction::TYPE_DISABLED:
$object->setIsDisabled($xaction->getNewValue());
break;
case PhabricatorMacroTransactionType::TYPE_FILE:
case PhabricatorMacroTransaction::TYPE_FILE:
$object->setFilePHID($xaction->getNewValue());
break;
case PhabricatorMacroTransactionType::TYPE_AUDIO:
case PhabricatorMacroTransaction::TYPE_AUDIO:
$object->setAudioPHID($xaction->getNewValue());
break;
case PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR:
case PhabricatorMacroTransaction::TYPE_AUDIO_BEHAVIOR:
$object->setAudioBehavior($xaction->getNewValue());
break;
}
@ -84,8 +84,8 @@ final class PhabricatorMacroEditor
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_FILE:
case PhabricatorMacroTransactionType::TYPE_AUDIO:
case PhabricatorMacroTransaction::TYPE_FILE:
case PhabricatorMacroTransaction::TYPE_AUDIO:
// When changing a macro's image or audio, attach the underlying files
// to the macro (and detach the old files).
$old = $xaction->getOldValue();
@ -123,11 +123,11 @@ final class PhabricatorMacroEditor
$type = $u->getTransactionType();
switch ($type) {
case PhabricatorMacroTransactionType::TYPE_NAME:
case PhabricatorMacroTransactionType::TYPE_DISABLED:
case PhabricatorMacroTransactionType::TYPE_FILE:
case PhabricatorMacroTransactionType::TYPE_AUDIO:
case PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR:
case PhabricatorMacroTransaction::TYPE_NAME:
case PhabricatorMacroTransaction::TYPE_DISABLED:
case PhabricatorMacroTransaction::TYPE_FILE:
case PhabricatorMacroTransaction::TYPE_AUDIO:
case PhabricatorMacroTransaction::TYPE_AUDIO_BEHAVIOR:
return $v;
}
@ -139,7 +139,7 @@ final class PhabricatorMacroEditor
array $xactions) {
foreach ($xactions as $xaction) {
switch ($xaction->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME;
case PhabricatorMacroTransaction::TYPE_NAME;
return ($xaction->getOldValue() !== null);
default:
break;

View file

@ -3,6 +3,13 @@
final class PhabricatorMacroTransaction
extends PhabricatorApplicationTransaction {
const TYPE_NAME = 'macro:name';
const TYPE_DISABLED = 'macro:disabled';
const TYPE_FILE = 'macro:file';
const TYPE_AUDIO = 'macro:audio';
const TYPE_AUDIO_BEHAVIOR = 'macro:audiobehavior';
public function getApplicationName() {
return 'file';
}
@ -26,8 +33,8 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_FILE:
case PhabricatorMacroTransactionType::TYPE_AUDIO:
case self::TYPE_FILE:
case self::TYPE_AUDIO:
if ($old !== null) {
$phids[] = $old;
}
@ -43,7 +50,7 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME:
case self::TYPE_NAME:
return ($old === null);
}
@ -57,14 +64,14 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME:
case self::TYPE_NAME:
return pht(
'%s renamed this macro from "%s" to "%s".',
$this->renderHandleLink($author_phid),
$old,
$new);
break;
case PhabricatorMacroTransactionType::TYPE_DISABLED:
case self::TYPE_DISABLED:
if ($new) {
return pht(
'%s disabled this macro.',
@ -76,7 +83,7 @@ final class PhabricatorMacroTransaction
}
break;
case PhabricatorMacroTransactionType::TYPE_AUDIO:
case self::TYPE_AUDIO:
if (!$old) {
return pht(
'%s attached audio: %s.',
@ -90,7 +97,7 @@ final class PhabricatorMacroTransaction
$this->renderHandleLink($new));
}
case PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR:
case self::TYPE_AUDIO_BEHAVIOR:
switch ($new) {
case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE:
return pht(
@ -106,7 +113,7 @@ final class PhabricatorMacroTransaction
$this->renderHandleLink($author_phid));
}
case PhabricatorMacroTransactionType::TYPE_FILE:
case self::TYPE_FILE:
if ($old === null) {
return pht(
'%s created this macro.',
@ -132,14 +139,14 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME:
case self::TYPE_NAME:
return pht(
'%s renamed %s from "%s" to "%s".',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid),
$old,
$new);
case PhabricatorMacroTransactionType::TYPE_DISABLED:
case self::TYPE_DISABLED:
if ($new) {
return pht(
'%s disabled %s.',
@ -151,7 +158,7 @@ final class PhabricatorMacroTransaction
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
}
case PhabricatorMacroTransactionType::TYPE_FILE:
case self::TYPE_FILE:
if ($old === null) {
return pht(
'%s created %s.',
@ -164,7 +171,7 @@ final class PhabricatorMacroTransaction
$this->renderHandleLink($object_phid));
}
case PhabricatorMacroTransactionType::TYPE_AUDIO:
case self::TYPE_AUDIO:
if (!$old) {
return pht(
'%s attached audio to %s: %s.',
@ -180,7 +187,7 @@ final class PhabricatorMacroTransaction
$this->renderHandleLink($new));
}
case PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR:
case self::TYPE_AUDIO_BEHAVIOR:
switch ($new) {
case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE:
return pht(
@ -209,29 +216,29 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME:
case self::TYPE_NAME:
if ($old === null) {
return pht('Created');
} else {
return pht('Renamed');
}
case PhabricatorMacroTransactionType::TYPE_DISABLED:
case self::TYPE_DISABLED:
if ($new) {
return pht('Disabled');
} else {
return pht('Restored');
}
case PhabricatorMacroTransactionType::TYPE_FILE:
case self::TYPE_FILE:
if ($old === null) {
return pht('Created');
} else {
return pht('Edited Image');
}
case PhabricatorMacroTransactionType::TYPE_AUDIO:
case self::TYPE_AUDIO:
return pht('Audio');
case PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR:
case self::TYPE_AUDIO_BEHAVIOR:
return pht('Audio Behavior');
}
@ -241,9 +248,9 @@ final class PhabricatorMacroTransaction
public function getActionStrength() {
switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_DISABLED:
case self::TYPE_DISABLED:
return 2.0;
case PhabricatorMacroTransactionType::TYPE_FILE:
case self::TYPE_FILE:
return 1.5;
}
return parent::getActionStrength();
@ -254,21 +261,21 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME:
case self::TYPE_NAME:
return 'fa-pencil';
case PhabricatorMacroTransactionType::TYPE_FILE:
case self::TYPE_FILE:
if ($old === null) {
return 'fa-plus';
} else {
return 'fa-pencil';
}
case PhabricatorMacroTransactionType::TYPE_DISABLED:
case self::TYPE_DISABLED:
if ($new) {
return 'fa-times';
} else {
return 'fa-undo';
}
case PhabricatorMacroTransactionType::TYPE_AUDIO:
case self::TYPE_AUDIO:
return 'fa-headphones';
}
@ -280,15 +287,15 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME:
case self::TYPE_NAME:
return PhabricatorTransactions::COLOR_BLUE;
case PhabricatorMacroTransactionType::TYPE_FILE:
case self::TYPE_FILE:
if ($old === null) {
return PhabricatorTransactions::COLOR_GREEN;
} else {
return PhabricatorTransactions::COLOR_BLUE;
}
case PhabricatorMacroTransactionType::TYPE_DISABLED:
case self::TYPE_DISABLED:
if ($new) {
return PhabricatorTransactions::COLOR_RED;
} else {

View file

@ -1,19 +0,0 @@
<?php
final class MetaMTANotificationType
extends MetaMTAConstants {
const TYPE_DIFFERENTIAL_REVIEWERS = 'differential-reviewers';
const TYPE_DIFFERENTIAL_CLOSED = 'differential-committed';
const TYPE_DIFFERENTIAL_CC = 'differential-cc';
const TYPE_DIFFERENTIAL_COMMENT = 'differential-comment';
const TYPE_DIFFERENTIAL_UPDATED = 'differential-updated';
const TYPE_DIFFERENTIAL_REVIEW_REQUEST = 'differential-review-request';
const TYPE_DIFFERENTIAL_OTHER = 'differential-other';
const TYPE_PHOLIO_STATUS = 'pholio-status';
const TYPE_PHOLIO_COMMENT = 'pholio-comment';
const TYPE_PHOLIO_UPDATED = 'pholio-updated';
const TYPE_PHOLIO_OTHER = 'pholio-other';
}

View file

@ -64,12 +64,10 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO {
}
/**
* Set tags (@{class:MetaMTANotificationType} constants) which identify the
* content of this mail in a general way. These tags are used to allow users
* to opt out of receiving certain types of mail, like updates when a task's
* projects change.
* These tags are used to allow users to opt out of receiving certain types
* of mail, like updates when a task's projects change.
*
* @param list<const> List of @{class:MetaMTANotificationType} constants.
* @param list<const>
* @return this
*/
public function setMailTags(array $tags) {

View file

@ -1,3 +0,0 @@
<?php
abstract class PholioConstants {}

View file

@ -1,20 +0,0 @@
<?php
final class PholioTransactionType extends PholioConstants {
/* edits to the high level mock */
const TYPE_NAME = 'name';
const TYPE_DESCRIPTION = 'description';
const TYPE_STATUS = 'status';
/* edits to images within the mock */
const TYPE_IMAGE_FILE = 'image-file';
const TYPE_IMAGE_NAME= 'image-name';
const TYPE_IMAGE_DESCRIPTION = 'image-description';
const TYPE_IMAGE_REPLACE = 'image-replace';
const TYPE_IMAGE_SEQUENCE = 'image-sequence';
/* your witty commentary at the mock : image : x,y level */
const TYPE_INLINE = 'inline';
}

View file

@ -51,7 +51,7 @@ final class PholioMockCommentController extends PholioController {
foreach ($inline_comments as $inline_comment) {
$xactions[] = id(new PholioTransaction())
->setTransactionType(PholioTransactionType::TYPE_INLINE)
->setTransactionType(PholioTransaction::TYPE_INLINE)
->attachComment($inline_comment);
}

View file

@ -69,9 +69,9 @@ final class PholioMockEditController extends PholioController {
if ($request->isFormPost()) {
$xactions = array();
$type_name = PholioTransactionType::TYPE_NAME;
$type_desc = PholioTransactionType::TYPE_DESCRIPTION;
$type_status = PholioTransactionType::TYPE_STATUS;
$type_name = PholioTransaction::TYPE_NAME;
$type_desc = PholioTransaction::TYPE_DESCRIPTION;
$type_status = PholioTransaction::TYPE_STATUS;
$type_view = PhabricatorTransactions::TYPE_VIEW_POLICY;
$type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY;
$type_cc = PhabricatorTransactions::TYPE_SUBSCRIBERS;
@ -160,7 +160,7 @@ final class PholioMockEditController extends PholioController {
->setSequence($sequence);
$xactions[] = id(new PholioTransaction())
->setTransactionType(
PholioTransactionType::TYPE_IMAGE_REPLACE)
PholioTransaction::TYPE_IMAGE_REPLACE)
->setNewValue($replace_image);
$posted_mock_images[] = $replace_image;
} else if (!$existing_image) { // this is an add
@ -171,23 +171,23 @@ final class PholioMockEditController extends PholioController {
->setDescription($description)
->setSequence($sequence);
$xactions[] = id(new PholioTransaction())
->setTransactionType(PholioTransactionType::TYPE_IMAGE_FILE)
->setTransactionType(PholioTransaction::TYPE_IMAGE_FILE)
->setNewValue(
array('+' => array($add_image)));
$posted_mock_images[] = $add_image;
} else {
$xactions[] = id(new PholioTransaction())
->setTransactionType(PholioTransactionType::TYPE_IMAGE_NAME)
->setTransactionType(PholioTransaction::TYPE_IMAGE_NAME)
->setNewValue(
array($existing_image->getPHID() => $title));
$xactions[] = id(new PholioTransaction())
->setTransactionType(
PholioTransactionType::TYPE_IMAGE_DESCRIPTION)
PholioTransaction::TYPE_IMAGE_DESCRIPTION)
->setNewValue(
array($existing_image->getPHID() => $description));
$xactions[] = id(new PholioTransaction())
->setTransactionType(
PholioTransactionType::TYPE_IMAGE_SEQUENCE)
PholioTransaction::TYPE_IMAGE_SEQUENCE)
->setNewValue(
array($existing_image->getPHID() => $sequence));
@ -198,7 +198,7 @@ final class PholioMockEditController extends PholioController {
if (!isset($files[$file_phid]) && !isset($replaces[$file_phid])) {
// this is an outright delete
$xactions[] = id(new PholioTransaction())
->setTransactionType(PholioTransactionType::TYPE_IMAGE_FILE)
->setTransactionType(PholioTransaction::TYPE_IMAGE_FILE)
->setNewValue(
array('-' => array($mock_image)));
}

View file

@ -29,16 +29,16 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
$types[] = PholioTransactionType::TYPE_NAME;
$types[] = PholioTransactionType::TYPE_DESCRIPTION;
$types[] = PholioTransactionType::TYPE_STATUS;
$types[] = PholioTransactionType::TYPE_INLINE;
$types[] = PholioTransaction::TYPE_NAME;
$types[] = PholioTransaction::TYPE_DESCRIPTION;
$types[] = PholioTransaction::TYPE_STATUS;
$types[] = PholioTransaction::TYPE_INLINE;
$types[] = PholioTransactionType::TYPE_IMAGE_FILE;
$types[] = PholioTransactionType::TYPE_IMAGE_NAME;
$types[] = PholioTransactionType::TYPE_IMAGE_DESCRIPTION;
$types[] = PholioTransactionType::TYPE_IMAGE_REPLACE;
$types[] = PholioTransactionType::TYPE_IMAGE_SEQUENCE;
$types[] = PholioTransaction::TYPE_IMAGE_FILE;
$types[] = PholioTransaction::TYPE_IMAGE_NAME;
$types[] = PholioTransaction::TYPE_IMAGE_DESCRIPTION;
$types[] = PholioTransaction::TYPE_IMAGE_REPLACE;
$types[] = PholioTransaction::TYPE_IMAGE_SEQUENCE;
return $types;
}
@ -48,16 +48,16 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PholioTransactionType::TYPE_NAME:
case PholioTransaction::TYPE_NAME:
return $object->getName();
case PholioTransactionType::TYPE_DESCRIPTION:
case PholioTransaction::TYPE_DESCRIPTION:
return $object->getDescription();
case PholioTransactionType::TYPE_STATUS:
case PholioTransaction::TYPE_STATUS:
return $object->getStatus();
case PholioTransactionType::TYPE_IMAGE_FILE:
case PholioTransaction::TYPE_IMAGE_FILE:
$images = $object->getImages();
return mpull($images, 'getPHID');
case PholioTransactionType::TYPE_IMAGE_NAME:
case PholioTransaction::TYPE_IMAGE_NAME:
$name = null;
$phid = null;
$image = $this->getImageForXaction($object, $xaction);
@ -66,7 +66,7 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
$phid = $image->getPHID();
}
return array($phid => $name);
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case PholioTransaction::TYPE_IMAGE_DESCRIPTION:
$description = null;
$phid = null;
$image = $this->getImageForXaction($object, $xaction);
@ -75,10 +75,10 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
$phid = $image->getPHID();
}
return array($phid => $description);
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case PholioTransaction::TYPE_IMAGE_REPLACE:
$raw = $xaction->getNewValue();
return $raw->getReplacesImagePHID();
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case PholioTransaction::TYPE_IMAGE_SEQUENCE:
$sequence = null;
$phid = null;
$image = $this->getImageForXaction($object, $xaction);
@ -95,17 +95,17 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PholioTransactionType::TYPE_NAME:
case PholioTransactionType::TYPE_DESCRIPTION:
case PholioTransactionType::TYPE_STATUS:
case PholioTransactionType::TYPE_IMAGE_NAME:
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case PholioTransaction::TYPE_NAME:
case PholioTransaction::TYPE_DESCRIPTION:
case PholioTransaction::TYPE_STATUS:
case PholioTransaction::TYPE_IMAGE_NAME:
case PholioTransaction::TYPE_IMAGE_DESCRIPTION:
case PholioTransaction::TYPE_IMAGE_SEQUENCE:
return $xaction->getNewValue();
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case PholioTransaction::TYPE_IMAGE_REPLACE:
$raw = $xaction->getNewValue();
return $raw->getPHID();
case PholioTransactionType::TYPE_IMAGE_FILE:
case PholioTransaction::TYPE_IMAGE_FILE:
$raw_new_value = $xaction->getNewValue();
$new_value = array();
foreach ($raw_new_value as $key => $images) {
@ -121,14 +121,14 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PholioTransactionType::TYPE_IMAGE_FILE:
case PholioTransaction::TYPE_IMAGE_FILE:
$new = $xaction->getNewValue();
$phids = array();
foreach ($new as $key => $images) {
$phids[] = mpull($images, 'getFilePHID');
}
return array_mergev($phids);
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case PholioTransaction::TYPE_IMAGE_REPLACE:
return array($xaction->getNewValue()->getFilePHID());
}
@ -141,7 +141,7 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PholioTransactionType::TYPE_INLINE:
case PholioTransaction::TYPE_INLINE:
return true;
}
@ -154,8 +154,8 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
foreach ($xactions as $xaction) {
switch ($xaction->getTransactionType()) {
case PholioTransactionType::TYPE_IMAGE_FILE:
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case PholioTransaction::TYPE_IMAGE_FILE:
case PholioTransaction::TYPE_IMAGE_REPLACE:
return true;
break;
}
@ -170,7 +170,7 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
$new_images = array();
foreach ($xactions as $xaction) {
switch ($xaction->getTransactionType()) {
case PholioTransactionType::TYPE_IMAGE_FILE:
case PholioTransaction::TYPE_IMAGE_FILE:
$new_value = $xaction->getNewValue();
foreach ($new_value as $key => $txn_images) {
if ($key != '+') {
@ -182,7 +182,7 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
}
}
break;
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case PholioTransaction::TYPE_IMAGE_REPLACE:
$image = $xaction->getNewValue();
$image->save();
$new_images[] = $image;
@ -197,16 +197,16 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PholioTransactionType::TYPE_NAME:
case PholioTransaction::TYPE_NAME:
$object->setName($xaction->getNewValue());
if ($object->getOriginalName() === null) {
$object->setOriginalName($xaction->getNewValue());
}
break;
case PholioTransactionType::TYPE_DESCRIPTION:
case PholioTransaction::TYPE_DESCRIPTION:
$object->setDescription($xaction->getNewValue());
break;
case PholioTransactionType::TYPE_STATUS:
case PholioTransaction::TYPE_STATUS:
$object->setStatus($xaction->getNewValue());
break;
}
@ -231,7 +231,7 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PholioTransactionType::TYPE_IMAGE_FILE:
case PholioTransaction::TYPE_IMAGE_FILE:
$old_map = array_fuse($xaction->getOldValue());
$new_map = array_fuse($xaction->getNewValue());
@ -246,7 +246,7 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
}
$object->attachImages($images);
break;
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case PholioTransaction::TYPE_IMAGE_REPLACE:
$old = $xaction->getOldValue();
$images = $object->getImages();
foreach ($images as $seq => $image) {
@ -258,19 +258,19 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
}
$object->attachImages($images);
break;
case PholioTransactionType::TYPE_IMAGE_NAME:
case PholioTransaction::TYPE_IMAGE_NAME:
$image = $this->getImageForXaction($object, $xaction);
$value = (string)head($xaction->getNewValue());
$image->setName($value);
$image->save();
break;
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case PholioTransaction::TYPE_IMAGE_DESCRIPTION:
$image = $this->getImageForXaction($object, $xaction);
$value = (string)head($xaction->getNewValue());
$image->setDescription($value);
$image->save();
break;
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case PholioTransaction::TYPE_IMAGE_SEQUENCE:
$image = $this->getImageForXaction($object, $xaction);
$value = (int)head($xaction->getNewValue());
$image->setSequence($value);
@ -298,22 +298,22 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
$type = $u->getTransactionType();
switch ($type) {
case PholioTransactionType::TYPE_NAME:
case PholioTransactionType::TYPE_DESCRIPTION:
case PholioTransactionType::TYPE_STATUS:
case PholioTransaction::TYPE_NAME:
case PholioTransaction::TYPE_DESCRIPTION:
case PholioTransaction::TYPE_STATUS:
return $v;
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case PholioTransaction::TYPE_IMAGE_REPLACE:
$u_img = $u->getNewValue();
$v_img = $v->getNewValue();
if ($u_img->getReplacesImagePHID() == $v_img->getReplacesImagePHID()) {
return $v;
}
break;
case PholioTransactionType::TYPE_IMAGE_FILE:
case PholioTransaction::TYPE_IMAGE_FILE:
return $this->mergePHIDOrEdgeTransactions($u, $v);
case PholioTransactionType::TYPE_IMAGE_NAME:
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case PholioTransaction::TYPE_IMAGE_NAME:
case PholioTransaction::TYPE_IMAGE_DESCRIPTION:
case PholioTransaction::TYPE_IMAGE_SEQUENCE:
$raw_new_value_u = $u->getNewValue();
$raw_new_value_v = $v->getNewValue();
$phid_u = key($raw_new_value_u);
@ -370,7 +370,7 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
}
$comment = $xaction->getComment();
switch ($xaction->getTransactionType()) {
case PholioTransactionType::TYPE_INLINE:
case PholioTransaction::TYPE_INLINE:
if ($comment && strlen($comment->getContent())) {
$inline_comments[] = $comment;
}
@ -418,13 +418,13 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
public function getMailTagsMap() {
return array(
MetaMTANotificationType::TYPE_PHOLIO_STATUS =>
PholioTransaction::MAILTAG_STATUS =>
pht("A mock's status changes."),
MetaMTANotificationType::TYPE_PHOLIO_COMMENT =>
PholioTransaction::MAILTAG_COMMENT =>
pht('Someone comments on a mock.'),
MetaMTANotificationType::TYPE_PHOLIO_UPDATED =>
PholioTransaction::MAILTAG_UPDATED =>
pht('Mock images or descriptions change.'),
MetaMTANotificationType::TYPE_PHOLIO_OTHER =>
PholioTransaction::MAILTAG_OTHER =>
pht('Other mock activity not listed above occurs.'),
);
}
@ -478,7 +478,7 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
// Move inline comments to the end, so the comments precede them.
foreach ($xactions as $xaction) {
$type = $xaction->getTransactionType();
if ($type == PholioTransactionType::TYPE_INLINE) {
if ($type == PholioTransaction::TYPE_INLINE) {
$tail[] = $xaction;
} else {
$head[] = $xaction;
@ -493,7 +493,7 @@ final class PholioMockEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case PholioTransactionType::TYPE_INLINE:
case PholioTransaction::TYPE_INLINE:
return true;
}

View file

@ -17,9 +17,9 @@ final class PhabricatorPholioMockTestDataGenerator
// Accumulate Transactions
$changes = array();
$changes[PholioTransactionType::TYPE_NAME] =
$changes[PholioTransaction::TYPE_NAME] =
$this->generateTitle();
$changes[PholioTransactionType::TYPE_DESCRIPTION] =
$changes[PholioTransaction::TYPE_DESCRIPTION] =
$this->generateDescription();
$changes[PhabricatorTransactions::TYPE_VIEW_POLICY] =
PhabricatorPolicies::POLICY_PUBLIC;

View file

@ -2,6 +2,26 @@
final class PholioTransaction extends PhabricatorApplicationTransaction {
// Edits to the high level mock
const TYPE_NAME = 'name';
const TYPE_DESCRIPTION = 'description';
const TYPE_STATUS = 'status';
// Edits to images within the mock
const TYPE_IMAGE_FILE = 'image-file';
const TYPE_IMAGE_NAME= 'image-name';
const TYPE_IMAGE_DESCRIPTION = 'image-description';
const TYPE_IMAGE_REPLACE = 'image-replace';
const TYPE_IMAGE_SEQUENCE = 'image-sequence';
// 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';
const MAILTAG_OTHER = 'pholio-other';
public function getApplicationName() {
return 'pholio';
}
@ -26,16 +46,16 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
$old = $this->getOldValue();
switch ($this->getTransactionType()) {
case PholioTransactionType::TYPE_IMAGE_FILE:
case self::TYPE_IMAGE_FILE:
$phids = array_merge($phids, $new, $old);
break;
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case self::TYPE_IMAGE_REPLACE:
$phids[] = $new;
$phids[] = $old;
break;
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case PholioTransactionType::TYPE_IMAGE_NAME:
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case self::TYPE_IMAGE_DESCRIPTION:
case self::TYPE_IMAGE_NAME:
case self::TYPE_IMAGE_SEQUENCE:
$phids[] = key($new);
break;
}
@ -47,13 +67,13 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
$old = $this->getOldValue();
switch ($this->getTransactionType()) {
case PholioTransactionType::TYPE_DESCRIPTION:
case self::TYPE_DESCRIPTION:
return ($old === null);
case PholioTransactionType::TYPE_IMAGE_NAME:
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case self::TYPE_IMAGE_NAME:
case self::TYPE_IMAGE_DESCRIPTION:
return ($old === array(null => null));
// this is boring / silly to surface; changing sequence is NBD
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case self::TYPE_IMAGE_SEQUENCE:
return true;
}
@ -62,17 +82,17 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
public function getIcon() {
switch ($this->getTransactionType()) {
case PholioTransactionType::TYPE_INLINE:
case self::TYPE_INLINE:
return 'fa-comment';
case PholioTransactionType::TYPE_NAME:
case PholioTransactionType::TYPE_DESCRIPTION:
case PholioTransactionType::TYPE_STATUS:
case PholioTransactionType::TYPE_IMAGE_NAME:
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case self::TYPE_NAME:
case self::TYPE_DESCRIPTION:
case self::TYPE_STATUS:
case self::TYPE_IMAGE_NAME:
case self::TYPE_IMAGE_DESCRIPTION:
case self::TYPE_IMAGE_SEQUENCE:
return 'fa-pencil';
case PholioTransactionType::TYPE_IMAGE_FILE:
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case self::TYPE_IMAGE_FILE:
case self::TYPE_IMAGE_REPLACE:
return 'fa-picture-o';
}
@ -82,24 +102,24 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
public function getMailTags() {
$tags = array();
switch ($this->getTransactionType()) {
case PholioTransactionType::TYPE_INLINE:
case self::TYPE_INLINE:
case PhabricatorTransactions::TYPE_COMMENT:
$tags[] = MetaMTANotificationType::TYPE_PHOLIO_COMMENT;
$tags[] = self::MAILTAG_COMMENT;
break;
case PholioTransactionType::TYPE_STATUS:
$tags[] = MetaMTANotificationType::TYPE_PHOLIO_STATUS;
case self::TYPE_STATUS:
$tags[] = self::MAILTAG_STATUS;
break;
case PholioTransactionType::TYPE_NAME:
case PholioTransactionType::TYPE_DESCRIPTION:
case PholioTransactionType::TYPE_IMAGE_NAME:
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case PholioTransactionType::TYPE_IMAGE_FILE:
case PholioTransactionType::TYPE_IMAGE_REPLACE:
$tags[] = MetaMTANotificationType::TYPE_PHOLIO_UPDATED;
case self::TYPE_NAME:
case self::TYPE_DESCRIPTION:
case self::TYPE_IMAGE_NAME:
case self::TYPE_IMAGE_DESCRIPTION:
case self::TYPE_IMAGE_SEQUENCE:
case self::TYPE_IMAGE_FILE:
case self::TYPE_IMAGE_REPLACE:
$tags[] = self::MAILTAG_UPDATED;
break;
default:
$tags[] = MetaMTANotificationType::TYPE_PHOLIO_OTHER;
$tags[] = self::MAILTAG_OTHER;
break;
}
return $tags;
@ -113,7 +133,7 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
$type = $this->getTransactionType();
switch ($type) {
case PholioTransactionType::TYPE_NAME:
case self::TYPE_NAME:
if ($old === null) {
return pht(
'%s created "%s".',
@ -127,17 +147,17 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
$new);
}
break;
case PholioTransactionType::TYPE_DESCRIPTION:
case self::TYPE_DESCRIPTION:
return pht(
"%s updated the mock's description.",
$this->renderHandleLink($author_phid));
break;
case PholioTransactionType::TYPE_STATUS:
case self::TYPE_STATUS:
return pht(
"%s updated the mock's status.",
$this->renderHandleLink($author_phid));
break;
case PholioTransactionType::TYPE_INLINE:
case self::TYPE_INLINE:
$count = 1;
foreach ($this->getTransactionGroup() as $xaction) {
if ($xaction->getTransactionType() == $type) {
@ -150,14 +170,14 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
$this->renderHandleLink($author_phid),
$count);
break;
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case self::TYPE_IMAGE_REPLACE:
return pht(
'%s replaced %s with %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($old),
$this->renderHandleLink($new));
break;
case PholioTransactionType::TYPE_IMAGE_FILE:
case self::TYPE_IMAGE_FILE:
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
@ -184,7 +204,7 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
}
break;
case PholioTransactionType::TYPE_IMAGE_NAME:
case self::TYPE_IMAGE_NAME:
return pht(
'%s renamed an image (%s) from "%s" to "%s".',
$this->renderHandleLink($author_phid),
@ -192,13 +212,13 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
reset($old),
reset($new));
break;
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case self::TYPE_IMAGE_DESCRIPTION:
return pht(
'%s updated an image\'s (%s) description.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink(key($new)));
break;
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case self::TYPE_IMAGE_SEQUENCE:
return pht(
'%s updated an image\'s (%s) sequence.',
$this->renderHandleLink($author_phid),
@ -218,7 +238,7 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
$type = $this->getTransactionType();
switch ($type) {
case PholioTransactionType::TYPE_NAME:
case self::TYPE_NAME:
if ($old === null) {
return pht(
'%s created %s.',
@ -233,44 +253,44 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
$new);
}
break;
case PholioTransactionType::TYPE_DESCRIPTION:
case self::TYPE_DESCRIPTION:
return pht(
'%s updated the description for %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
case PholioTransactionType::TYPE_STATUS:
case self::TYPE_STATUS:
return pht(
'%s updated the status for %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
case PholioTransactionType::TYPE_INLINE:
case self::TYPE_INLINE:
return pht(
'%s added an inline comment to %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case PholioTransactionType::TYPE_IMAGE_FILE:
case self::TYPE_IMAGE_REPLACE:
case self::TYPE_IMAGE_FILE:
return pht(
'%s updated images of %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
case PholioTransactionType::TYPE_IMAGE_NAME:
case self::TYPE_IMAGE_NAME:
return pht(
'%s updated the image names of %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case self::TYPE_IMAGE_DESCRIPTION:
return pht(
'%s updated image descriptions of %s.',
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
break;
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case self::TYPE_IMAGE_SEQUENCE:
return pht(
'%s updated image sequence of %s.',
$this->renderHandleLink($author_phid),
@ -284,13 +304,13 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
public function getBodyForFeed(PhabricatorFeedStory $story) {
$text = null;
switch ($this->getTransactionType()) {
case PholioTransactionType::TYPE_NAME:
case self::TYPE_NAME:
if ($this->getOldValue() === null) {
$mock = $story->getPrimaryObject();
$text = $mock->getDescription();
}
break;
case PholioTransactionType::TYPE_INLINE:
case self::TYPE_INLINE:
$text = $this->getComment()->getContent();
break;
}
@ -307,8 +327,8 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
public function hasChangeDetails() {
switch ($this->getTransactionType()) {
case PholioTransactionType::TYPE_DESCRIPTION:
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case self::TYPE_DESCRIPTION:
case self::TYPE_IMAGE_DESCRIPTION:
return true;
}
return parent::hasChangeDetails();
@ -318,7 +338,7 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
$old = $this->getOldValue();
$new = $this->getNewValue();
if ($this->getTransactionType() ==
PholioTransactionType::TYPE_IMAGE_DESCRIPTION) {
self::TYPE_IMAGE_DESCRIPTION) {
$old = reset($old);
$new = reset($new);
}
@ -334,19 +354,19 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case PholioTransactionType::TYPE_NAME:
case self::TYPE_NAME:
if ($old === null) {
return PhabricatorTransactions::COLOR_GREEN;
}
case PholioTransactionType::TYPE_DESCRIPTION:
case PholioTransactionType::TYPE_STATUS:
case PholioTransactionType::TYPE_IMAGE_NAME:
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case self::TYPE_DESCRIPTION:
case self::TYPE_STATUS:
case self::TYPE_IMAGE_NAME:
case self::TYPE_IMAGE_DESCRIPTION:
case self::TYPE_IMAGE_SEQUENCE:
return PhabricatorTransactions::COLOR_BLUE;
case PholioTransactionType::TYPE_IMAGE_REPLACE:
case self::TYPE_IMAGE_REPLACE:
return PhabricatorTransactions::COLOR_YELLOW;
case PholioTransactionType::TYPE_IMAGE_FILE:
case self::TYPE_IMAGE_FILE:
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
if ($add && $rem) {
@ -363,11 +383,11 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
public function getNoEffectDescription() {
switch ($this->getTransactionType()) {
case PholioTransactionType::TYPE_IMAGE_NAME:
case self::TYPE_IMAGE_NAME:
return pht('The image title was not updated.');
case PholioTransactionType::TYPE_IMAGE_DESCRIPTION:
case self::TYPE_IMAGE_DESCRIPTION:
return pht('The image description was not updated.');
case PholioTransactionType::TYPE_IMAGE_SEQUENCE:
case self::TYPE_IMAGE_SEQUENCE:
return pht('The image sequence was not updated.');
}

View file

@ -30,14 +30,14 @@ final class PholioTransactionView
switch ($u->getTransactionType()) {
case PhabricatorTransactions::TYPE_COMMENT:
case PholioTransactionType::TYPE_INLINE:
case PholioTransaction::TYPE_INLINE:
break;
default:
return false;
}
switch ($v->getTransactionType()) {
case PholioTransactionType::TYPE_INLINE:
case PholioTransaction::TYPE_INLINE:
return true;
}
@ -50,7 +50,7 @@ final class PholioTransactionView
$out = array();
$group = $xaction->getTransactionGroup();
if ($xaction->getTransactionType() == PholioTransactionType::TYPE_INLINE) {
if ($xaction->getTransactionType() == PholioTransaction::TYPE_INLINE) {
array_unshift($group, $xaction);
} else {
$out[] = parent::renderTransactionContent($xaction);
@ -63,7 +63,7 @@ final class PholioTransactionView
$inlines = array();
foreach ($group as $xaction) {
switch ($xaction->getTransactionType()) {
case PholioTransactionType::TYPE_INLINE:
case PholioTransaction::TYPE_INLINE:
$inlines[] = $xaction;
break;
default: