mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-08 22:01:03 +01:00
81a475d5a6
Summary: Ref T6403. This was actually simple stuff. Test Plan: changed the edit policy of a paste. changed the edit and join policy of a phame blog. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6403 Differential Revision: https://secure.phabricator.com/D12933
72 lines
2.2 KiB
PHP
72 lines
2.2 KiB
PHP
<?php
|
|
|
|
final class PhluxVariableEditor
|
|
extends PhabricatorApplicationTransactionEditor {
|
|
|
|
public function getEditorApplicationClass() {
|
|
return 'PhabricatorPhluxApplication';
|
|
}
|
|
|
|
public function getEditorObjectsDescription() {
|
|
return pht('Phlux Variables');
|
|
}
|
|
|
|
public function getTransactionTypes() {
|
|
$types = parent::getTransactionTypes();
|
|
$types[] = PhluxTransaction::TYPE_EDIT_KEY;
|
|
$types[] = PhluxTransaction::TYPE_EDIT_VALUE;
|
|
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
|
|
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
|
|
return $types;
|
|
}
|
|
|
|
protected function getCustomTransactionOldValue(
|
|
PhabricatorLiskDAO $object,
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
switch ($xaction->getTransactionType()) {
|
|
case PhluxTransaction::TYPE_EDIT_KEY:
|
|
return $object->getVariableKey();
|
|
case PhluxTransaction::TYPE_EDIT_VALUE:
|
|
return $object->getVariableValue();
|
|
}
|
|
|
|
return parent::getCustomTransactionOldValue($object, $xaction);
|
|
}
|
|
|
|
protected function getCustomTransactionNewValue(
|
|
PhabricatorLiskDAO $object,
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
switch ($xaction->getTransactionType()) {
|
|
case PhluxTransaction::TYPE_EDIT_KEY:
|
|
case PhluxTransaction::TYPE_EDIT_VALUE:
|
|
return $xaction->getNewValue();
|
|
}
|
|
return parent::getCustomTransactionNewValue($object, $xaction);
|
|
}
|
|
|
|
protected function applyCustomInternalTransaction(
|
|
PhabricatorLiskDAO $object,
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
switch ($xaction->getTransactionType()) {
|
|
case PhluxTransaction::TYPE_EDIT_KEY:
|
|
$object->setVariableKey($xaction->getNewValue());
|
|
return;
|
|
case PhluxTransaction::TYPE_EDIT_VALUE:
|
|
$object->setVariableValue($xaction->getNewValue());
|
|
return;
|
|
}
|
|
return parent::applyCustomInternalTransaction($object, $xaction);
|
|
}
|
|
|
|
protected function applyCustomExternalTransaction(
|
|
PhabricatorLiskDAO $object,
|
|
PhabricatorApplicationTransaction $xaction) {
|
|
switch ($xaction->getTransactionType()) {
|
|
case PhluxTransaction::TYPE_EDIT_KEY:
|
|
case PhluxTransaction::TYPE_EDIT_VALUE:
|
|
return;
|
|
}
|
|
return parent::applyCustomExternalTransaction($object, $xaction);
|
|
}
|
|
|
|
}
|