1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

Convert date-marker to ModularTransaction in Conpherence

Summary: Swaps this transaction over.

Test Plan: Load up a few rooms with date markers, still render as expected.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12550

Differential Revision: https://secure.phabricator.com/D17680
This commit is contained in:
Chad Little 2017-04-13 12:58:08 -07:00
parent d902d2ac6b
commit 5c5d3c35a7
5 changed files with 13 additions and 7 deletions

View file

@ -316,6 +316,7 @@ phutil_register_library_map(array(
'ConpherenceTestCase' => 'applications/conpherence/__tests__/ConpherenceTestCase.php',
'ConpherenceThread' => 'applications/conpherence/storage/ConpherenceThread.php',
'ConpherenceThreadDatasource' => 'applications/conpherence/typeahead/ConpherenceThreadDatasource.php',
'ConpherenceThreadDateMarkerTransaction' => 'applications/conpherence/xaction/ConpherenceThreadDateMarkerTransaction.php',
'ConpherenceThreadIndexEngineExtension' => 'applications/conpherence/engineextension/ConpherenceThreadIndexEngineExtension.php',
'ConpherenceThreadListView' => 'applications/conpherence/view/ConpherenceThreadListView.php',
'ConpherenceThreadMailReceiver' => 'applications/conpherence/mail/ConpherenceThreadMailReceiver.php',
@ -5107,6 +5108,7 @@ phutil_register_library_map(array(
'PhabricatorNgramsInterface',
),
'ConpherenceThreadDatasource' => 'PhabricatorTypeaheadDatasource',
'ConpherenceThreadDateMarkerTransaction' => 'ConpherenceThreadTransactionType',
'ConpherenceThreadIndexEngineExtension' => 'PhabricatorIndexEngineExtension',
'ConpherenceThreadListView' => 'AphrontView',
'ConpherenceThreadMailReceiver' => 'PhabricatorObjectMailReceiver',

View file

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

View file

@ -4,7 +4,6 @@ final class ConpherenceTransaction
extends PhabricatorModularTransaction {
const TYPE_PARTICIPANTS = 'participants';
const TYPE_DATE_MARKER = 'date-marker';
public function getApplicationName() {
return 'conpherence';
@ -39,8 +38,6 @@ final class ConpherenceTransaction
switch ($this->getTransactionType()) {
case self::TYPE_PARTICIPANTS:
return ($old === null);
case self::TYPE_DATE_MARKER:
return false;
}
return parent::shouldHide();
@ -93,8 +90,6 @@ final class ConpherenceTransaction
$phids[] = $this->getAuthorPHID();
switch ($this->getTransactionType()) {
case self::TYPE_DATE_MARKER:
break;
case self::TYPE_PARTICIPANTS:
$phids = array_merge($phids, $this->getOldValue());
$phids = array_merge($phids, $this->getNewValue());

View file

@ -67,7 +67,7 @@ final class ConpherenceTransactionView extends AphrontView {
$transaction = $this->getConpherenceTransaction();
switch ($transaction->getTransactionType()) {
case ConpherenceTransaction::TYPE_DATE_MARKER:
case ConpherenceThreadDateMarkerTransaction::TRANSACTIONTYPE:
return javelin_tag(
'div',
array(

View file

@ -0,0 +1,8 @@
<?php
final class ConpherenceThreadDateMarkerTransaction
extends ConpherenceThreadTransactionType {
const TRANSACTIONTYPE = 'date-marker';
}