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

View file

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

View file

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

View file

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

View file

@ -71,7 +71,7 @@ final class ConpherenceUpdateThreadConduitAPIMethod
if ($add_participant_phids) { if ($add_participant_phids) {
$xactions[] = id(new ConpherenceTransaction()) $xactions[] = id(new ConpherenceTransaction())
->setTransactionType( ->setTransactionType(
ConpherenceTransactionType::TYPE_PARTICIPANTS) ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => $add_participant_phids)); ->setNewValue(array('+' => $add_participant_phids));
} }
if ($remove_participant_phid) { if ($remove_participant_phid) {
@ -80,12 +80,12 @@ final class ConpherenceUpdateThreadConduitAPIMethod
} }
$xactions[] = id(new ConpherenceTransaction()) $xactions[] = id(new ConpherenceTransaction())
->setTransactionType( ->setTransactionType(
ConpherenceTransactionType::TYPE_PARTICIPANTS) ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('-' => array($remove_participant_phid))); ->setNewValue(array('-' => array($remove_participant_phid)));
} }
if ($title) { if ($title) {
$xactions[] = id(new ConpherenceTransaction()) $xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE) ->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setNewValue($title); ->setNewValue($title);
} }
if ($message) { 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 = array();
$xactions[] = id(new ConpherenceTransaction()) $xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_PARTICIPANTS) ->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => array($user->getPHID()))); ->setNewValue(array('+' => array($user->getPHID())));
$xactions[] = id(new ConpherenceTransaction()) $xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransactionType::TYPE_TITLE) ->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setNewValue($request->getStr('title')); ->setNewValue($request->getStr('title'));
$xactions[] = id(new ConpherenceTransaction()) $xactions[] = id(new ConpherenceTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY) ->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
@ -41,7 +41,7 @@ final class ConpherenceNewRoomController extends ConpherenceController {
} catch (PhabricatorApplicationTransactionValidationException $ex) { } catch (PhabricatorApplicationTransactionValidationException $ex) {
$validation_exception = $ex; $validation_exception = $ex;
$e_title = $ex->getShortMessage(ConpherenceTransactionType::TYPE_TITLE); $e_title = $ex->getShortMessage(ConpherenceTransaction::TYPE_TITLE);
$conpherence->setViewPolicy($request->getStr('viewPolicy')); $conpherence->setViewPolicy($request->getStr('viewPolicy'));
$conpherence->setEditPolicy($request->getStr('editPolicy')); $conpherence->setEditPolicy($request->getStr('editPolicy'));

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,6 +4,19 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
private $isCommandeerSideEffect; 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) { public function setIsCommandeerSideEffect($is_side_effect) {
$this->isCommandeerSideEffect = $is_side_effect; $this->isCommandeerSideEffect = $is_side_effect;
@ -14,11 +27,6 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
return $this->isCommandeerSideEffect; 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() { public function getApplicationName() {
return 'differential'; return 'differential';
} }
@ -109,7 +117,6 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
} }
public function getActionStrength() { public function getActionStrength() {
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case self::TYPE_ACTION: case self::TYPE_ACTION:
return 3; return 3;
@ -160,38 +167,38 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorTransactions::TYPE_SUBSCRIBERS; case PhabricatorTransactions::TYPE_SUBSCRIBERS;
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CC; $tags[] = self::MAILTAG_CC;
break; break;
case self::TYPE_ACTION: case self::TYPE_ACTION:
switch ($this->getNewValue()) { switch ($this->getNewValue()) {
case DifferentialAction::ACTION_CLOSE: case DifferentialAction::ACTION_CLOSE:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_CLOSED; $tags[] = self::MAILTAG_CLOSED;
break; break;
} }
break; break;
case self::TYPE_UPDATE: case self::TYPE_UPDATE:
$old = $this->getOldValue(); $old = $this->getOldValue();
if ($old === null) { if ($old === null) {
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEW_REQUEST; $tags[] = self::MAILTAG_REVIEW_REQUEST;
} else { } else {
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_UPDATED; $tags[] = self::MAILTAG_UPDATED;
} }
break; break;
case PhabricatorTransactions::TYPE_EDGE: case PhabricatorTransactions::TYPE_EDGE:
switch ($this->getMetadataValue('edge:type')) { switch ($this->getMetadataValue('edge:type')) {
case DifferentialRevisionHasReviewerEdgeType::EDGECONST: case DifferentialRevisionHasReviewerEdgeType::EDGECONST:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_REVIEWERS; $tags[] = self::MAILTAG_REVIEWERS;
break; break;
} }
break; break;
case PhabricatorTransactions::TYPE_COMMENT: case PhabricatorTransactions::TYPE_COMMENT:
case self::TYPE_INLINE: case self::TYPE_INLINE:
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_COMMENT; $tags[] = self::MAILTAG_COMMENT;
break; break;
} }
if (!$tags) { if (!$tags) {
$tags[] = MetaMTANotificationType::TYPE_DIFFERENTIAL_OTHER; $tags[] = self::MAILTAG_OTHER;
} }
return $tags; return $tags;
@ -280,7 +287,7 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW: case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
return pht('This revision now requires review to proceed.'); return pht('This revision now requires review to proceed.');
} }
} }
return parent::getTitle(); return parent::getTitle();
} }
@ -438,7 +445,7 @@ final class DifferentialTransaction extends PhabricatorApplicationTransaction {
'%s now requires review to proceed.', '%s now requires review to proceed.',
$object_link); $object_link);
} }
} }
return parent::getTitleForFeed(); return parent::getTitleForFeed();
} }

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

View file

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

View file

@ -2,6 +2,12 @@
final class LegalpadTransaction extends PhabricatorApplicationTransaction { 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() { public function getApplicationName() {
return 'legalpad'; return 'legalpad';
} }
@ -22,10 +28,10 @@ final class LegalpadTransaction extends PhabricatorApplicationTransaction {
$old = $this->getOldValue(); $old = $this->getOldValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case LegalpadTransactionType::TYPE_TITLE: case self::TYPE_TITLE:
case LegalpadTransactionType::TYPE_TEXT: case self::TYPE_TEXT:
return ($old === null); return ($old === null);
case LegalpadTransactionType::TYPE_SIGNATURE_TYPE: case self::TYPE_SIGNATURE_TYPE:
return true; return true;
} }
@ -40,21 +46,21 @@ final class LegalpadTransaction extends PhabricatorApplicationTransaction {
$type = $this->getTransactionType(); $type = $this->getTransactionType();
switch ($type) { switch ($type) {
case LegalpadTransactionType::TYPE_TITLE: case self::TYPE_TITLE:
return pht( return pht(
'%s renamed this document from "%s" to "%s".', '%s renamed this document from "%s" to "%s".',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$old, $old,
$new); $new);
case LegalpadTransactionType::TYPE_TEXT: case self::TYPE_TEXT:
return pht( return pht(
"%s updated the document's text.", "%s updated the document's text.",
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
case LegalpadTransactionType::TYPE_PREAMBLE: case self::TYPE_PREAMBLE:
return pht( return pht(
'%s updated the preamble.', '%s updated the preamble.',
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
case LegalpadTransactionType::TYPE_REQUIRE_SIGNATURE: case self::TYPE_REQUIRE_SIGNATURE:
if ($new) { if ($new) {
$text = pht( $text = pht(
'%s set the document to require signatures.', '%s set the document to require signatures.',
@ -72,9 +78,9 @@ final class LegalpadTransaction extends PhabricatorApplicationTransaction {
public function hasChangeDetails() { public function hasChangeDetails() {
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case LegalpadTransactionType::TYPE_TITLE: case self::TYPE_TITLE:
case LegalpadTransactionType::TYPE_TEXT: case self::TYPE_TEXT:
case LegalpadTransactionType::TYPE_PREAMBLE: case self::TYPE_PREAMBLE:
return true; return true;
} }
return parent::hasChangeDetails(); 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')) { if ($request->getBool('behaviorForm')) {
$xactions[] = id(new PhabricatorMacroTransaction()) $xactions[] = id(new PhabricatorMacroTransaction())
->setTransactionType( ->setTransactionType(
PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR) PhabricatorMacroTransaction::TYPE_AUDIO_BEHAVIOR)
->setNewValue($request->getStr('audioBehavior')); ->setNewValue($request->getStr('audioBehavior'));
} else { } else {
$file = null; $file = null;
@ -60,7 +60,7 @@ final class PhabricatorMacroAudioController extends PhabricatorMacroController {
$e_file = pht('Invalid'); $e_file = pht('Invalid');
} else { } else {
$xactions[] = id(new PhabricatorMacroTransaction()) $xactions[] = id(new PhabricatorMacroTransaction())
->setTransactionType(PhabricatorMacroTransactionType::TYPE_AUDIO) ->setTransactionType(PhabricatorMacroTransaction::TYPE_AUDIO)
->setNewValue($file->getPHID()); ->setNewValue($file->getPHID());
} }
} else { } else {

View file

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

View file

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

View file

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

View file

@ -3,6 +3,13 @@
final class PhabricatorMacroTransaction final class PhabricatorMacroTransaction
extends PhabricatorApplicationTransaction { 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() { public function getApplicationName() {
return 'file'; return 'file';
} }
@ -26,8 +33,8 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_FILE: case self::TYPE_FILE:
case PhabricatorMacroTransactionType::TYPE_AUDIO: case self::TYPE_AUDIO:
if ($old !== null) { if ($old !== null) {
$phids[] = $old; $phids[] = $old;
} }
@ -43,7 +50,7 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME: case self::TYPE_NAME:
return ($old === null); return ($old === null);
} }
@ -57,14 +64,14 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME: case self::TYPE_NAME:
return pht( return pht(
'%s renamed this macro from "%s" to "%s".', '%s renamed this macro from "%s" to "%s".',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$old, $old,
$new); $new);
break; break;
case PhabricatorMacroTransactionType::TYPE_DISABLED: case self::TYPE_DISABLED:
if ($new) { if ($new) {
return pht( return pht(
'%s disabled this macro.', '%s disabled this macro.',
@ -76,7 +83,7 @@ final class PhabricatorMacroTransaction
} }
break; break;
case PhabricatorMacroTransactionType::TYPE_AUDIO: case self::TYPE_AUDIO:
if (!$old) { if (!$old) {
return pht( return pht(
'%s attached audio: %s.', '%s attached audio: %s.',
@ -90,7 +97,7 @@ final class PhabricatorMacroTransaction
$this->renderHandleLink($new)); $this->renderHandleLink($new));
} }
case PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR: case self::TYPE_AUDIO_BEHAVIOR:
switch ($new) { switch ($new) {
case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE: case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE:
return pht( return pht(
@ -106,7 +113,7 @@ final class PhabricatorMacroTransaction
$this->renderHandleLink($author_phid)); $this->renderHandleLink($author_phid));
} }
case PhabricatorMacroTransactionType::TYPE_FILE: case self::TYPE_FILE:
if ($old === null) { if ($old === null) {
return pht( return pht(
'%s created this macro.', '%s created this macro.',
@ -132,14 +139,14 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME: case self::TYPE_NAME:
return pht( return pht(
'%s renamed %s from "%s" to "%s".', '%s renamed %s from "%s" to "%s".',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid), $this->renderHandleLink($object_phid),
$old, $old,
$new); $new);
case PhabricatorMacroTransactionType::TYPE_DISABLED: case self::TYPE_DISABLED:
if ($new) { if ($new) {
return pht( return pht(
'%s disabled %s.', '%s disabled %s.',
@ -151,7 +158,7 @@ final class PhabricatorMacroTransaction
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid)); $this->renderHandleLink($object_phid));
} }
case PhabricatorMacroTransactionType::TYPE_FILE: case self::TYPE_FILE:
if ($old === null) { if ($old === null) {
return pht( return pht(
'%s created %s.', '%s created %s.',
@ -164,7 +171,7 @@ final class PhabricatorMacroTransaction
$this->renderHandleLink($object_phid)); $this->renderHandleLink($object_phid));
} }
case PhabricatorMacroTransactionType::TYPE_AUDIO: case self::TYPE_AUDIO:
if (!$old) { if (!$old) {
return pht( return pht(
'%s attached audio to %s: %s.', '%s attached audio to %s: %s.',
@ -180,7 +187,7 @@ final class PhabricatorMacroTransaction
$this->renderHandleLink($new)); $this->renderHandleLink($new));
} }
case PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR: case self::TYPE_AUDIO_BEHAVIOR:
switch ($new) { switch ($new) {
case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE: case PhabricatorFileImageMacro::AUDIO_BEHAVIOR_ONCE:
return pht( return pht(
@ -209,29 +216,29 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME: case self::TYPE_NAME:
if ($old === null) { if ($old === null) {
return pht('Created'); return pht('Created');
} else { } else {
return pht('Renamed'); return pht('Renamed');
} }
case PhabricatorMacroTransactionType::TYPE_DISABLED: case self::TYPE_DISABLED:
if ($new) { if ($new) {
return pht('Disabled'); return pht('Disabled');
} else { } else {
return pht('Restored'); return pht('Restored');
} }
case PhabricatorMacroTransactionType::TYPE_FILE: case self::TYPE_FILE:
if ($old === null) { if ($old === null) {
return pht('Created'); return pht('Created');
} else { } else {
return pht('Edited Image'); return pht('Edited Image');
} }
case PhabricatorMacroTransactionType::TYPE_AUDIO: case self::TYPE_AUDIO:
return pht('Audio'); return pht('Audio');
case PhabricatorMacroTransactionType::TYPE_AUDIO_BEHAVIOR: case self::TYPE_AUDIO_BEHAVIOR:
return pht('Audio Behavior'); return pht('Audio Behavior');
} }
@ -241,9 +248,9 @@ final class PhabricatorMacroTransaction
public function getActionStrength() { public function getActionStrength() {
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_DISABLED: case self::TYPE_DISABLED:
return 2.0; return 2.0;
case PhabricatorMacroTransactionType::TYPE_FILE: case self::TYPE_FILE:
return 1.5; return 1.5;
} }
return parent::getActionStrength(); return parent::getActionStrength();
@ -254,21 +261,21 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME: case self::TYPE_NAME:
return 'fa-pencil'; return 'fa-pencil';
case PhabricatorMacroTransactionType::TYPE_FILE: case self::TYPE_FILE:
if ($old === null) { if ($old === null) {
return 'fa-plus'; return 'fa-plus';
} else { } else {
return 'fa-pencil'; return 'fa-pencil';
} }
case PhabricatorMacroTransactionType::TYPE_DISABLED: case self::TYPE_DISABLED:
if ($new) { if ($new) {
return 'fa-times'; return 'fa-times';
} else { } else {
return 'fa-undo'; return 'fa-undo';
} }
case PhabricatorMacroTransactionType::TYPE_AUDIO: case self::TYPE_AUDIO:
return 'fa-headphones'; return 'fa-headphones';
} }
@ -280,15 +287,15 @@ final class PhabricatorMacroTransaction
$new = $this->getNewValue(); $new = $this->getNewValue();
switch ($this->getTransactionType()) { switch ($this->getTransactionType()) {
case PhabricatorMacroTransactionType::TYPE_NAME: case self::TYPE_NAME:
return PhabricatorTransactions::COLOR_BLUE; return PhabricatorTransactions::COLOR_BLUE;
case PhabricatorMacroTransactionType::TYPE_FILE: case self::TYPE_FILE:
if ($old === null) { if ($old === null) {
return PhabricatorTransactions::COLOR_GREEN; return PhabricatorTransactions::COLOR_GREEN;
} else { } else {
return PhabricatorTransactions::COLOR_BLUE; return PhabricatorTransactions::COLOR_BLUE;
} }
case PhabricatorMacroTransactionType::TYPE_DISABLED: case self::TYPE_DISABLED:
if ($new) { if ($new) {
return PhabricatorTransactions::COLOR_RED; return PhabricatorTransactions::COLOR_RED;
} else { } 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 * These tags are used to allow users to opt out of receiving certain types
* content of this mail in a general way. These tags are used to allow users * of mail, like updates when a task's projects change.
* 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 * @return this
*/ */
public function setMailTags(array $tags) { 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) { foreach ($inline_comments as $inline_comment) {
$xactions[] = id(new PholioTransaction()) $xactions[] = id(new PholioTransaction())
->setTransactionType(PholioTransactionType::TYPE_INLINE) ->setTransactionType(PholioTransaction::TYPE_INLINE)
->attachComment($inline_comment); ->attachComment($inline_comment);
} }

View file

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

View file

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

View file

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

View file

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

View file

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