1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-01 19:22:42 +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', 'ConpherenceTestCase' => 'applications/conpherence/__tests__/ConpherenceTestCase.php',
'ConpherenceThread' => 'applications/conpherence/storage/ConpherenceThread.php', 'ConpherenceThread' => 'applications/conpherence/storage/ConpherenceThread.php',
'ConpherenceThreadDatasource' => 'applications/conpherence/typeahead/ConpherenceThreadDatasource.php', 'ConpherenceThreadDatasource' => 'applications/conpherence/typeahead/ConpherenceThreadDatasource.php',
'ConpherenceThreadDateMarkerTransaction' => 'applications/conpherence/xaction/ConpherenceThreadDateMarkerTransaction.php',
'ConpherenceThreadIndexEngineExtension' => 'applications/conpherence/engineextension/ConpherenceThreadIndexEngineExtension.php', 'ConpherenceThreadIndexEngineExtension' => 'applications/conpherence/engineextension/ConpherenceThreadIndexEngineExtension.php',
'ConpherenceThreadListView' => 'applications/conpherence/view/ConpherenceThreadListView.php', 'ConpherenceThreadListView' => 'applications/conpherence/view/ConpherenceThreadListView.php',
'ConpherenceThreadMailReceiver' => 'applications/conpherence/mail/ConpherenceThreadMailReceiver.php', 'ConpherenceThreadMailReceiver' => 'applications/conpherence/mail/ConpherenceThreadMailReceiver.php',
@ -5107,6 +5108,7 @@ phutil_register_library_map(array(
'PhabricatorNgramsInterface', 'PhabricatorNgramsInterface',
), ),
'ConpherenceThreadDatasource' => 'PhabricatorTypeaheadDatasource', 'ConpherenceThreadDatasource' => 'PhabricatorTypeaheadDatasource',
'ConpherenceThreadDateMarkerTransaction' => 'ConpherenceThreadTransactionType',
'ConpherenceThreadIndexEngineExtension' => 'PhabricatorIndexEngineExtension', 'ConpherenceThreadIndexEngineExtension' => 'PhabricatorIndexEngineExtension',
'ConpherenceThreadListView' => 'AphrontView', 'ConpherenceThreadListView' => 'AphrontView',
'ConpherenceThreadMailReceiver' => 'PhabricatorObjectMailReceiver', 'ConpherenceThreadMailReceiver' => 'PhabricatorObjectMailReceiver',

View file

@ -60,7 +60,8 @@ final class ConpherenceTransactionRenderer extends Phobject {
// 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(ConpherenceTransaction::TYPE_DATE_MARKER) ->setTransactionType(
ConpherenceThreadDateMarkerTransaction::TRANSACTIONTYPE)
->makeEphemeral(); ->makeEphemeral();
$date_marker_transaction_view = id(new ConpherenceTransactionView()) $date_marker_transaction_view = id(new ConpherenceTransactionView())
->setUser($user) ->setUser($user)

View file

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

View file

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

View file

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