mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Modernize Conpherence with Modular Transactions
Summary: Begin converting Conpherence to ModularTransactions, this converts title, topic, and picture to use modular transactions. Participants seems hairy so I'll do that in another diff Test Plan: Create a room with a topic, change room name, topic. Add people, remove people. Set a room image. Unset topic. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17668
This commit is contained in:
parent
a9845b0b1d
commit
a7ebfc12c0
16 changed files with 248 additions and 192 deletions
|
@ -9,7 +9,7 @@ return array(
|
||||||
'names' => array(
|
'names' => array(
|
||||||
'conpherence.pkg.css' => 'b5ee2073',
|
'conpherence.pkg.css' => 'b5ee2073',
|
||||||
'conpherence.pkg.js' => '281b1a73',
|
'conpherence.pkg.js' => '281b1a73',
|
||||||
'core.pkg.css' => '476a4ec7',
|
'core.pkg.css' => '30a64ed6',
|
||||||
'core.pkg.js' => 'fbc1c380',
|
'core.pkg.js' => 'fbc1c380',
|
||||||
'darkconsole.pkg.js' => 'e7393ebb',
|
'darkconsole.pkg.js' => 'e7393ebb',
|
||||||
'differential.pkg.css' => '90b30783',
|
'differential.pkg.css' => '90b30783',
|
||||||
|
@ -167,7 +167,7 @@ return array(
|
||||||
'rsrc/css/phui/phui-spacing.css' => '042804d6',
|
'rsrc/css/phui/phui-spacing.css' => '042804d6',
|
||||||
'rsrc/css/phui/phui-status.css' => 'd5263e49',
|
'rsrc/css/phui/phui-status.css' => 'd5263e49',
|
||||||
'rsrc/css/phui/phui-tag-view.css' => '84d65f26',
|
'rsrc/css/phui/phui-tag-view.css' => '84d65f26',
|
||||||
'rsrc/css/phui/phui-timeline-view.css' => 'bf45789e',
|
'rsrc/css/phui/phui-timeline-view.css' => '1d7ef61d',
|
||||||
'rsrc/css/phui/phui-two-column-view.css' => 'ce9fa0b7',
|
'rsrc/css/phui/phui-two-column-view.css' => 'ce9fa0b7',
|
||||||
'rsrc/css/phui/workboards/phui-workboard-color.css' => '783cdff5',
|
'rsrc/css/phui/workboards/phui-workboard-color.css' => '783cdff5',
|
||||||
'rsrc/css/phui/workboards/phui-workboard.css' => '3bc85455',
|
'rsrc/css/phui/workboards/phui-workboard.css' => '3bc85455',
|
||||||
|
@ -877,7 +877,7 @@ return array(
|
||||||
'phui-status-list-view-css' => 'd5263e49',
|
'phui-status-list-view-css' => 'd5263e49',
|
||||||
'phui-tag-view-css' => '84d65f26',
|
'phui-tag-view-css' => '84d65f26',
|
||||||
'phui-theme-css' => '9f261c6b',
|
'phui-theme-css' => '9f261c6b',
|
||||||
'phui-timeline-view-css' => 'bf45789e',
|
'phui-timeline-view-css' => '1d7ef61d',
|
||||||
'phui-two-column-view-css' => 'ce9fa0b7',
|
'phui-two-column-view-css' => 'ce9fa0b7',
|
||||||
'phui-workboard-color-css' => '783cdff5',
|
'phui-workboard-color-css' => '783cdff5',
|
||||||
'phui-workboard-view-css' => '3bc85455',
|
'phui-workboard-view-css' => '3bc85455',
|
||||||
|
|
|
@ -320,11 +320,15 @@ phutil_register_library_map(array(
|
||||||
'ConpherenceThreadListView' => 'applications/conpherence/view/ConpherenceThreadListView.php',
|
'ConpherenceThreadListView' => 'applications/conpherence/view/ConpherenceThreadListView.php',
|
||||||
'ConpherenceThreadMailReceiver' => 'applications/conpherence/mail/ConpherenceThreadMailReceiver.php',
|
'ConpherenceThreadMailReceiver' => 'applications/conpherence/mail/ConpherenceThreadMailReceiver.php',
|
||||||
'ConpherenceThreadMembersPolicyRule' => 'applications/conpherence/policyrule/ConpherenceThreadMembersPolicyRule.php',
|
'ConpherenceThreadMembersPolicyRule' => 'applications/conpherence/policyrule/ConpherenceThreadMembersPolicyRule.php',
|
||||||
|
'ConpherenceThreadPictureTransaction' => 'applications/conpherence/xaction/ConpherenceThreadPictureTransaction.php',
|
||||||
'ConpherenceThreadQuery' => 'applications/conpherence/query/ConpherenceThreadQuery.php',
|
'ConpherenceThreadQuery' => 'applications/conpherence/query/ConpherenceThreadQuery.php',
|
||||||
'ConpherenceThreadRemarkupRule' => 'applications/conpherence/remarkup/ConpherenceThreadRemarkupRule.php',
|
'ConpherenceThreadRemarkupRule' => 'applications/conpherence/remarkup/ConpherenceThreadRemarkupRule.php',
|
||||||
'ConpherenceThreadSearchController' => 'applications/conpherence/controller/ConpherenceThreadSearchController.php',
|
'ConpherenceThreadSearchController' => 'applications/conpherence/controller/ConpherenceThreadSearchController.php',
|
||||||
'ConpherenceThreadSearchEngine' => 'applications/conpherence/query/ConpherenceThreadSearchEngine.php',
|
'ConpherenceThreadSearchEngine' => 'applications/conpherence/query/ConpherenceThreadSearchEngine.php',
|
||||||
'ConpherenceThreadTitleNgrams' => 'applications/conpherence/storage/ConpherenceThreadTitleNgrams.php',
|
'ConpherenceThreadTitleNgrams' => 'applications/conpherence/storage/ConpherenceThreadTitleNgrams.php',
|
||||||
|
'ConpherenceThreadTitleTransaction' => 'applications/conpherence/xaction/ConpherenceThreadTitleTransaction.php',
|
||||||
|
'ConpherenceThreadTopicTransaction' => 'applications/conpherence/xaction/ConpherenceThreadTopicTransaction.php',
|
||||||
|
'ConpherenceThreadTransactionType' => 'applications/conpherence/xaction/ConpherenceThreadTransactionType.php',
|
||||||
'ConpherenceTransaction' => 'applications/conpherence/storage/ConpherenceTransaction.php',
|
'ConpherenceTransaction' => 'applications/conpherence/storage/ConpherenceTransaction.php',
|
||||||
'ConpherenceTransactionComment' => 'applications/conpherence/storage/ConpherenceTransactionComment.php',
|
'ConpherenceTransactionComment' => 'applications/conpherence/storage/ConpherenceTransactionComment.php',
|
||||||
'ConpherenceTransactionQuery' => 'applications/conpherence/query/ConpherenceTransactionQuery.php',
|
'ConpherenceTransactionQuery' => 'applications/conpherence/query/ConpherenceTransactionQuery.php',
|
||||||
|
@ -5099,12 +5103,16 @@ phutil_register_library_map(array(
|
||||||
'ConpherenceThreadListView' => 'AphrontView',
|
'ConpherenceThreadListView' => 'AphrontView',
|
||||||
'ConpherenceThreadMailReceiver' => 'PhabricatorObjectMailReceiver',
|
'ConpherenceThreadMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||||
'ConpherenceThreadMembersPolicyRule' => 'PhabricatorPolicyRule',
|
'ConpherenceThreadMembersPolicyRule' => 'PhabricatorPolicyRule',
|
||||||
|
'ConpherenceThreadPictureTransaction' => 'ConpherenceThreadTransactionType',
|
||||||
'ConpherenceThreadQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'ConpherenceThreadQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'ConpherenceThreadRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
'ConpherenceThreadRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
||||||
'ConpherenceThreadSearchController' => 'ConpherenceController',
|
'ConpherenceThreadSearchController' => 'ConpherenceController',
|
||||||
'ConpherenceThreadSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'ConpherenceThreadSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'ConpherenceThreadTitleNgrams' => 'PhabricatorSearchNgrams',
|
'ConpherenceThreadTitleNgrams' => 'PhabricatorSearchNgrams',
|
||||||
'ConpherenceTransaction' => 'PhabricatorApplicationTransaction',
|
'ConpherenceThreadTitleTransaction' => 'ConpherenceThreadTransactionType',
|
||||||
|
'ConpherenceThreadTopicTransaction' => 'ConpherenceThreadTransactionType',
|
||||||
|
'ConpherenceThreadTransactionType' => 'PhabricatorModularTransactionType',
|
||||||
|
'ConpherenceTransaction' => 'PhabricatorModularTransaction',
|
||||||
'ConpherenceTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
'ConpherenceTransactionComment' => 'PhabricatorApplicationTransactionComment',
|
||||||
'ConpherenceTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
'ConpherenceTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||||
'ConpherenceTransactionRenderer' => 'Phobject',
|
'ConpherenceTransactionRenderer' => 'Phobject',
|
||||||
|
|
|
@ -123,7 +123,8 @@ final class ConpherenceRoomTestCase extends ConpherenceTestCase {
|
||||||
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
|
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
|
||||||
->setNewValue(array('+' => $participant_phids));
|
->setNewValue(array('+' => $participant_phids));
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
|
->setTransactionType(
|
||||||
|
ConpherenceThreadTitleTransaction::TRANSACTIONTYPE)
|
||||||
->setNewValue(pht('Test'));
|
->setNewValue(pht('Test'));
|
||||||
|
|
||||||
id(new ConpherenceEditor())
|
id(new ConpherenceEditor())
|
||||||
|
|
|
@ -83,7 +83,8 @@ final class ConpherenceUpdateThreadConduitAPIMethod
|
||||||
}
|
}
|
||||||
if ($title) {
|
if ($title) {
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
|
->setTransactionType(
|
||||||
|
ConpherenceThreadTitleTransaction::TRANSACTIONTYPE)
|
||||||
->setNewValue($title);
|
->setNewValue($title);
|
||||||
}
|
}
|
||||||
if ($message) {
|
if ($message) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ final class ConpherenceNewRoomController extends ConpherenceController {
|
||||||
$xactions = array();
|
$xactions = array();
|
||||||
|
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
|
->setTransactionType(ConpherenceThreadTitleTransaction::TRANSACTIONTYPE)
|
||||||
->setNewValue($request->getStr('title'));
|
->setNewValue($request->getStr('title'));
|
||||||
|
|
||||||
$participants = $request->getArr('participants');
|
$participants = $request->getArr('participants');
|
||||||
|
@ -26,7 +26,7 @@ final class ConpherenceNewRoomController extends ConpherenceController {
|
||||||
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
|
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
|
||||||
->setNewValue(array('+' => $participants));
|
->setNewValue(array('+' => $participants));
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(ConpherenceTransaction::TYPE_TOPIC)
|
->setTransactionType(ConpherenceThreadTopicTransaction::TRANSACTIONTYPE)
|
||||||
->setNewValue($request->getStr('topic'));
|
->setNewValue($request->getStr('topic'));
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
|
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
|
||||||
|
@ -50,7 +50,8 @@ final class ConpherenceNewRoomController extends ConpherenceController {
|
||||||
} catch (PhabricatorApplicationTransactionValidationException $ex) {
|
} catch (PhabricatorApplicationTransactionValidationException $ex) {
|
||||||
$validation_exception = $ex;
|
$validation_exception = $ex;
|
||||||
|
|
||||||
$e_title = $ex->getShortMessage(ConpherenceTransaction::TYPE_TITLE);
|
$e_title = $ex->getShortMessage(
|
||||||
|
ConpherenceThreadTitleTransaction::TRANSACTIONTYPE);
|
||||||
|
|
||||||
$conpherence->setViewPolicy($request->getStr('viewPolicy'));
|
$conpherence->setViewPolicy($request->getStr('viewPolicy'));
|
||||||
$conpherence->setEditPolicy($request->getStr('editPolicy'));
|
$conpherence->setEditPolicy($request->getStr('editPolicy'));
|
||||||
|
|
|
@ -76,7 +76,8 @@ final class ConpherenceRoomPictureController
|
||||||
|
|
||||||
$xactions = array();
|
$xactions = array();
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(ConpherenceTransaction::TYPE_PICTURE)
|
->setTransactionType(
|
||||||
|
ConpherenceThreadPictureTransaction::TRANSACTIONTYPE)
|
||||||
->setNewValue($new_value);
|
->setNewValue($new_value);
|
||||||
|
|
||||||
$editor = id(new ConpherenceEditor())
|
$editor = id(new ConpherenceEditor())
|
||||||
|
|
|
@ -140,10 +140,12 @@ final class ConpherenceUpdateController
|
||||||
$title = $request->getStr('title');
|
$title = $request->getStr('title');
|
||||||
$topic = $request->getStr('topic');
|
$topic = $request->getStr('topic');
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
|
->setTransactionType(
|
||||||
|
ConpherenceThreadTitleTransaction::TRANSACTIONTYPE)
|
||||||
->setNewValue($title);
|
->setNewValue($title);
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(ConpherenceTransaction::TYPE_TOPIC)
|
->setTransactionType(
|
||||||
|
ConpherenceThreadTopicTransaction::TRANSACTIONTYPE)
|
||||||
->setNewValue($topic);
|
->setNewValue($topic);
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
|
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
|
||||||
|
|
|
@ -41,12 +41,14 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
->setNewValue(array('+' => $participant_phids));
|
->setNewValue(array('+' => $participant_phids));
|
||||||
if ($title) {
|
if ($title) {
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
|
->setTransactionType(
|
||||||
|
ConpherenceThreadTitleTransaction::TRANSACTIONTYPE)
|
||||||
->setNewValue($title);
|
->setNewValue($title);
|
||||||
}
|
}
|
||||||
if (strlen($topic)) {
|
if (strlen($topic)) {
|
||||||
$xactions[] = id(new ConpherenceTransaction())
|
$xactions[] = id(new ConpherenceTransaction())
|
||||||
->setTransactionType(ConpherenceTransaction::TYPE_TOPIC)
|
->setTransactionType(
|
||||||
|
ConpherenceThreadTopicTransaction::TRANSACTIONTYPE)
|
||||||
->setNewValue($topic);
|
->setNewValue($topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,10 +89,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
|
|
||||||
$types[] = PhabricatorTransactions::TYPE_COMMENT;
|
$types[] = PhabricatorTransactions::TYPE_COMMENT;
|
||||||
|
|
||||||
$types[] = ConpherenceTransaction::TYPE_TITLE;
|
|
||||||
$types[] = ConpherenceTransaction::TYPE_TOPIC;
|
|
||||||
$types[] = ConpherenceTransaction::TYPE_PARTICIPANTS;
|
$types[] = ConpherenceTransaction::TYPE_PARTICIPANTS;
|
||||||
$types[] = ConpherenceTransaction::TYPE_PICTURE;
|
|
||||||
$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;
|
||||||
|
@ -98,17 +97,34 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
return $types;
|
return $types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCreateObjectTitle($author, $object) {
|
||||||
|
return pht('%s created this room.', $author);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function shouldPublishFeedStory(
|
||||||
|
PhabricatorLiskDAO $object,
|
||||||
|
array $xactions) {
|
||||||
|
|
||||||
|
foreach ($xactions as $xaction) {
|
||||||
|
switch ($xaction->getTransactionType()) {
|
||||||
|
case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE:
|
||||||
|
case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE:
|
||||||
|
case ConpherenceThreadPictureTransaction::TRANSACTIONTYPE:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected function getCustomTransactionOldValue(
|
protected function getCustomTransactionOldValue(
|
||||||
PhabricatorLiskDAO $object,
|
PhabricatorLiskDAO $object,
|
||||||
PhabricatorApplicationTransaction $xaction) {
|
PhabricatorApplicationTransaction $xaction) {
|
||||||
|
|
||||||
switch ($xaction->getTransactionType()) {
|
switch ($xaction->getTransactionType()) {
|
||||||
case ConpherenceTransaction::TYPE_TITLE:
|
|
||||||
return $object->getTitle();
|
|
||||||
case ConpherenceTransaction::TYPE_TOPIC:
|
|
||||||
return $object->getTopic();
|
|
||||||
case ConpherenceTransaction::TYPE_PICTURE:
|
|
||||||
return $object->getProfileImagePHID();
|
|
||||||
case ConpherenceTransaction::TYPE_PARTICIPANTS:
|
case ConpherenceTransaction::TYPE_PARTICIPANTS:
|
||||||
if ($this->getIsNewObject()) {
|
if ($this->getIsNewObject()) {
|
||||||
return array();
|
return array();
|
||||||
|
@ -122,10 +138,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
PhabricatorApplicationTransaction $xaction) {
|
PhabricatorApplicationTransaction $xaction) {
|
||||||
|
|
||||||
switch ($xaction->getTransactionType()) {
|
switch ($xaction->getTransactionType()) {
|
||||||
case ConpherenceTransaction::TYPE_TITLE:
|
|
||||||
case ConpherenceTransaction::TYPE_TOPIC:
|
|
||||||
case ConpherenceTransaction::TYPE_PICTURE:
|
|
||||||
return $xaction->getNewValue();
|
|
||||||
case ConpherenceTransaction::TYPE_PARTICIPANTS:
|
case ConpherenceTransaction::TYPE_PARTICIPANTS:
|
||||||
return $this->getPHIDTransactionNewValue($xaction);
|
return $this->getPHIDTransactionNewValue($xaction);
|
||||||
}
|
}
|
||||||
|
@ -211,15 +223,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
|
|
||||||
$make_author_recent_participant = true;
|
$make_author_recent_participant = true;
|
||||||
switch ($xaction->getTransactionType()) {
|
switch ($xaction->getTransactionType()) {
|
||||||
case ConpherenceTransaction::TYPE_TITLE:
|
|
||||||
$object->setTitle($xaction->getNewValue());
|
|
||||||
break;
|
|
||||||
case ConpherenceTransaction::TYPE_TOPIC:
|
|
||||||
$object->setTopic($xaction->getNewValue());
|
|
||||||
break;
|
|
||||||
case ConpherenceTransaction::TYPE_PICTURE:
|
|
||||||
$object->setProfileImagePHID($xaction->getNewValue());
|
|
||||||
break;
|
|
||||||
case ConpherenceTransaction::TYPE_PARTICIPANTS:
|
case ConpherenceTransaction::TYPE_PARTICIPANTS:
|
||||||
if (!$this->getIsNewObject()) {
|
if (!$this->getIsNewObject()) {
|
||||||
$old_map = array_fuse($xaction->getOldValue());
|
$old_map = array_fuse($xaction->getOldValue());
|
||||||
|
@ -418,8 +421,8 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
PhabricatorPolicyCapability::CAN_EDIT);
|
PhabricatorPolicyCapability::CAN_EDIT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ConpherenceTransaction::TYPE_TITLE:
|
case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE:
|
||||||
case ConpherenceTransaction::TYPE_TOPIC:
|
case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE:
|
||||||
PhabricatorPolicyFilter::requireCapability(
|
PhabricatorPolicyFilter::requireCapability(
|
||||||
$this->requireActor(),
|
$this->requireActor(),
|
||||||
$object,
|
$object,
|
||||||
|
@ -434,8 +437,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
|
|
||||||
$type = $u->getTransactionType();
|
$type = $u->getTransactionType();
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case ConpherenceTransaction::TYPE_TITLE:
|
|
||||||
return $v;
|
|
||||||
case ConpherenceTransaction::TYPE_PARTICIPANTS:
|
case ConpherenceTransaction::TYPE_PARTICIPANTS:
|
||||||
return $this->mergePHIDOrEdgeTransactions($u, $v);
|
return $this->mergePHIDOrEdgeTransactions($u, $v);
|
||||||
}
|
}
|
||||||
|
@ -541,23 +542,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
return PhabricatorEnv::getEnvConfig('metamta.conpherence.subject-prefix');
|
return PhabricatorEnv::getEnvConfig('metamta.conpherence.subject-prefix');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function shouldPublishFeedStory(
|
|
||||||
PhabricatorLiskDAO $object,
|
|
||||||
array $xactions) {
|
|
||||||
|
|
||||||
foreach ($xactions as $xaction) {
|
|
||||||
switch ($xaction->getTransactionType()) {
|
|
||||||
case ConpherenceTransaction::TYPE_TITLE:
|
|
||||||
case ConpherenceTransaction::TYPE_TOPIC:
|
|
||||||
case ConpherenceTransaction::TYPE_PICTURE:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function supportsSearch() {
|
protected function supportsSearch() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -570,26 +554,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
||||||
$errors = parent::validateTransaction($object, $type, $xactions);
|
$errors = parent::validateTransaction($object, $type, $xactions);
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case ConpherenceTransaction::TYPE_TITLE:
|
|
||||||
if (empty($xactions)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$missing = $this->validateIsEmptyTextField(
|
|
||||||
$object->getTitle(),
|
|
||||||
$xactions);
|
|
||||||
|
|
||||||
if ($missing) {
|
|
||||||
$detail = pht('Room title is required.');
|
|
||||||
$error = new PhabricatorApplicationTransactionValidationError(
|
|
||||||
$type,
|
|
||||||
pht('Required'),
|
|
||||||
$detail,
|
|
||||||
last($xactions));
|
|
||||||
|
|
||||||
$error->setIsMissingFieldError(true);
|
|
||||||
$errors[] = $error;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ConpherenceTransaction::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());
|
||||||
|
|
|
@ -268,9 +268,9 @@ final class ConpherenceThread extends ConpherenceDAO
|
||||||
case PhabricatorTransactions::TYPE_COMMENT:
|
case PhabricatorTransactions::TYPE_COMMENT:
|
||||||
$message_transaction = $transaction;
|
$message_transaction = $transaction;
|
||||||
break;
|
break;
|
||||||
case ConpherenceTransaction::TYPE_TITLE:
|
case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE:
|
||||||
case ConpherenceTransaction::TYPE_TOPIC:
|
case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE:
|
||||||
case ConpherenceTransaction::TYPE_PICTURE:
|
case ConpherenceThreadPictureTransaction::TRANSACTIONTYPE:
|
||||||
case ConpherenceTransaction::TYPE_PARTICIPANTS:
|
case ConpherenceTransaction::TYPE_PARTICIPANTS:
|
||||||
$action_transaction = $transaction;
|
$action_transaction = $transaction;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
|
final class ConpherenceTransaction
|
||||||
|
extends PhabricatorModularTransaction {
|
||||||
|
|
||||||
const TYPE_TITLE = 'title';
|
|
||||||
const TYPE_TOPIC = 'topic';
|
|
||||||
const TYPE_PARTICIPANTS = 'participants';
|
const TYPE_PARTICIPANTS = 'participants';
|
||||||
const TYPE_DATE_MARKER = 'date-marker';
|
const TYPE_DATE_MARKER = 'date-marker';
|
||||||
const TYPE_PICTURE = 'picture';
|
|
||||||
|
|
||||||
public function getApplicationName() {
|
public function getApplicationName() {
|
||||||
return 'conpherence';
|
return 'conpherence';
|
||||||
|
@ -20,6 +18,10 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
|
||||||
return new ConpherenceTransactionComment();
|
return new ConpherenceTransactionComment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBaseTransactionClass() {
|
||||||
|
return 'ConpherenceThreadTransactionType';
|
||||||
|
}
|
||||||
|
|
||||||
public function getNoEffectDescription() {
|
public function getNoEffectDescription() {
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_PARTICIPANTS:
|
case self::TYPE_PARTICIPANTS:
|
||||||
|
@ -37,9 +39,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_PARTICIPANTS:
|
case self::TYPE_PARTICIPANTS:
|
||||||
return ($old === null);
|
return ($old === null);
|
||||||
case self::TYPE_TITLE:
|
|
||||||
case self::TYPE_TOPIC:
|
|
||||||
case self::TYPE_PICTURE:
|
|
||||||
case self::TYPE_DATE_MARKER:
|
case self::TYPE_DATE_MARKER:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -54,12 +53,9 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
|
||||||
$new = $this->getNewValue();
|
$new = $this->getNewValue();
|
||||||
|
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_TITLE:
|
|
||||||
case self::TYPE_TOPIC:
|
|
||||||
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 self::TYPE_PICTURE:
|
|
||||||
return $this->getRoomTitle();
|
return $this->getRoomTitle();
|
||||||
break;
|
break;
|
||||||
case self::TYPE_PARTICIPANTS:
|
case self::TYPE_PARTICIPANTS:
|
||||||
|
@ -94,55 +90,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
|
||||||
return parent::getTitle();
|
return parent::getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTitleForFeed() {
|
|
||||||
$author_phid = $this->getAuthorPHID();
|
|
||||||
$object_phid = $this->getObjectPHID();
|
|
||||||
|
|
||||||
$old = $this->getOldValue();
|
|
||||||
$new = $this->getNewValue();
|
|
||||||
|
|
||||||
$type = $this->getTransactionType();
|
|
||||||
switch ($type) {
|
|
||||||
case self::TYPE_TITLE:
|
|
||||||
if (strlen($old) && strlen($new)) {
|
|
||||||
return pht(
|
|
||||||
'%s renamed %s from "%s" to "%s".',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$this->renderHandleLink($object_phid),
|
|
||||||
$old,
|
|
||||||
$new);
|
|
||||||
} else {
|
|
||||||
return pht(
|
|
||||||
'%s created the room %s.',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$this->renderHandleLink($object_phid));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
break;
|
|
||||||
case self::TYPE_TOPIC:
|
|
||||||
if (strlen($new)) {
|
|
||||||
return pht(
|
|
||||||
'%s set the topic of %s to "%s".',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$this->renderHandleLink($object_phid),
|
|
||||||
$new);
|
|
||||||
} else if (strlen($old)) {
|
|
||||||
return pht(
|
|
||||||
'%s deleted the topic in %s',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$this->renderHandleLink($object_phid));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case self::TYPE_PICTURE:
|
|
||||||
return pht(
|
|
||||||
'%s updated the room image for %s.',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$this->renderHandleLink($object_phid));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return parent::getTitleForFeed();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getRoomTitle() {
|
private function getRoomTitle() {
|
||||||
$author_phid = $this->getAuthorPHID();
|
$author_phid = $this->getAuthorPHID();
|
||||||
|
|
||||||
|
@ -150,45 +97,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
|
||||||
$new = $this->getNewValue();
|
$new = $this->getNewValue();
|
||||||
|
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_TITLE:
|
|
||||||
if ($old && $new) {
|
|
||||||
$title = pht(
|
|
||||||
'%s renamed this room from "%s" to "%s".',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$old,
|
|
||||||
$new);
|
|
||||||
} else if ($old) {
|
|
||||||
$title = pht(
|
|
||||||
'%s deleted the room name "%s".',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$old);
|
|
||||||
} else {
|
|
||||||
$title = pht(
|
|
||||||
'%s named this room "%s".',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$new);
|
|
||||||
}
|
|
||||||
return $title;
|
|
||||||
break;
|
|
||||||
case self::TYPE_TOPIC:
|
|
||||||
if ($new) {
|
|
||||||
$title = pht(
|
|
||||||
'%s set the topic of this room to "%s".',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$new);
|
|
||||||
} else if ($old) {
|
|
||||||
$title = pht(
|
|
||||||
'%s deleted the room topic "%s"',
|
|
||||||
$this->renderHandleLink($author_phid),
|
|
||||||
$old);
|
|
||||||
}
|
|
||||||
return $title;
|
|
||||||
break;
|
|
||||||
case self::TYPE_PICTURE:
|
|
||||||
return pht(
|
|
||||||
'%s updated the room image.',
|
|
||||||
$this->renderHandleLink($author_phid));
|
|
||||||
break;
|
|
||||||
case PhabricatorTransactions::TYPE_VIEW_POLICY:
|
case PhabricatorTransactions::TYPE_VIEW_POLICY:
|
||||||
return pht(
|
return pht(
|
||||||
'%s changed the visibility of this room from "%s" to "%s".',
|
'%s changed the visibility of this room from "%s" to "%s".',
|
||||||
|
@ -221,8 +129,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
|
||||||
|
|
||||||
$phids[] = $this->getAuthorPHID();
|
$phids[] = $this->getAuthorPHID();
|
||||||
switch ($this->getTransactionType()) {
|
switch ($this->getTransactionType()) {
|
||||||
case self::TYPE_TITLE:
|
|
||||||
case self::TYPE_PICTURE:
|
|
||||||
case self::TYPE_DATE_MARKER:
|
case self::TYPE_DATE_MARKER:
|
||||||
break;
|
break;
|
||||||
case self::TYPE_PARTICIPANTS:
|
case self::TYPE_PARTICIPANTS:
|
||||||
|
|
|
@ -216,17 +216,6 @@ final class ConpherenceTransactionView extends AphrontView {
|
||||||
$content = null;
|
$content = null;
|
||||||
$handles = $this->getHandles();
|
$handles = $this->getHandles();
|
||||||
switch ($transaction->getTransactionType()) {
|
switch ($transaction->getTransactionType()) {
|
||||||
case ConpherenceTransaction::TYPE_TITLE:
|
|
||||||
case ConpherenceTransaction::TYPE_TOPIC:
|
|
||||||
case ConpherenceTransaction::TYPE_PICTURE:
|
|
||||||
case ConpherenceTransaction::TYPE_PARTICIPANTS:
|
|
||||||
case PhabricatorTransactions::TYPE_VIEW_POLICY:
|
|
||||||
case PhabricatorTransactions::TYPE_EDIT_POLICY:
|
|
||||||
case PhabricatorTransactions::TYPE_JOIN_POLICY:
|
|
||||||
case PhabricatorTransactions::TYPE_EDGE:
|
|
||||||
$content = $transaction->getTitle();
|
|
||||||
$this->addClass('conpherence-edited');
|
|
||||||
break;
|
|
||||||
case PhabricatorTransactions::TYPE_COMMENT:
|
case PhabricatorTransactions::TYPE_COMMENT:
|
||||||
$this->addClass('conpherence-comment');
|
$this->addClass('conpherence-comment');
|
||||||
$author = $handles[$transaction->getAuthorPHID()];
|
$author = $handles[$transaction->getAuthorPHID()];
|
||||||
|
@ -236,6 +225,10 @@ final class ConpherenceTransactionView extends AphrontView {
|
||||||
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
|
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
|
||||||
$content_class = 'conpherence-message';
|
$content_class = 'conpherence-message';
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
$content = $transaction->getTitle();
|
||||||
|
$this->addClass('conpherence-edited');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$view = phutil_tag(
|
$view = phutil_tag(
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ConpherenceThreadPictureTransaction
|
||||||
|
extends ConpherenceThreadTransactionType {
|
||||||
|
|
||||||
|
const TRANSACTIONTYPE = 'picture';
|
||||||
|
|
||||||
|
public function generateOldValue($object) {
|
||||||
|
return $object->getProfileImagePHID();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function applyInternalEffects($object, $value) {
|
||||||
|
$object->setProfileImagePHID($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle() {
|
||||||
|
return pht(
|
||||||
|
'%s updated the room image.',
|
||||||
|
$this->renderAuthor());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitleForFeed() {
|
||||||
|
return pht(
|
||||||
|
'%s updated the room image for %s.',
|
||||||
|
$this->renderAuthor(),
|
||||||
|
$this->renderObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ConpherenceThreadTitleTransaction
|
||||||
|
extends ConpherenceThreadTransactionType {
|
||||||
|
|
||||||
|
const TRANSACTIONTYPE = 'title';
|
||||||
|
|
||||||
|
public function generateOldValue($object) {
|
||||||
|
return $object->getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function applyInternalEffects($object, $value) {
|
||||||
|
$object->setTitle($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle() {
|
||||||
|
$old = $this->getOldValue();
|
||||||
|
$new = $this->getNewValue();
|
||||||
|
|
||||||
|
if (strlen($old) && strlen($new)) {
|
||||||
|
return pht(
|
||||||
|
'%s renamed this room from %s to %s.',
|
||||||
|
$this->renderAuthor(),
|
||||||
|
$this->renderOldValue(),
|
||||||
|
$this->renderNewValue());
|
||||||
|
} else {
|
||||||
|
return pht(
|
||||||
|
'%s created this room.',
|
||||||
|
$this->renderAuthor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitleForFeed() {
|
||||||
|
$old = $this->getOldValue();
|
||||||
|
$new = $this->getNewValue();
|
||||||
|
|
||||||
|
if (strlen($old) && strlen($new)) {
|
||||||
|
return pht(
|
||||||
|
'%s renamed %s from %s to %s.',
|
||||||
|
$this->renderAuthor(),
|
||||||
|
$this->renderObject(),
|
||||||
|
$this->renderOldValue(),
|
||||||
|
$this->renderNewValue());
|
||||||
|
} else {
|
||||||
|
return pht(
|
||||||
|
'%s created %s.',
|
||||||
|
$this->renderAuthor(),
|
||||||
|
$this->renderObject());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function validateTransactions($object, array $xactions) {
|
||||||
|
$errors = array();
|
||||||
|
|
||||||
|
if ($this->isEmptyTextTransaction($object->getTitle(), $xactions)) {
|
||||||
|
$errors[] = $this->newRequiredError(
|
||||||
|
pht('Rooms must have a title.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$max_length = $object->getColumnMaximumByteLength('title');
|
||||||
|
foreach ($xactions as $xaction) {
|
||||||
|
$new_value = $xaction->getNewValue();
|
||||||
|
$new_length = strlen($new_value);
|
||||||
|
if ($new_length > $max_length) {
|
||||||
|
$errors[] = $this->newInvalidError(
|
||||||
|
pht('The title can be no longer than %s characters.',
|
||||||
|
new PhutilNumber($max_length)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ConpherenceThreadTopicTransaction
|
||||||
|
extends ConpherenceThreadTransactionType {
|
||||||
|
|
||||||
|
const TRANSACTIONTYPE = 'topic';
|
||||||
|
|
||||||
|
public function generateOldValue($object) {
|
||||||
|
return $object->getTopic();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function applyInternalEffects($object, $value) {
|
||||||
|
$object->setTopic($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitle() {
|
||||||
|
$old = $this->getOldValue();
|
||||||
|
$new = $this->getNewValue();
|
||||||
|
|
||||||
|
if (strlen($new)) {
|
||||||
|
return pht(
|
||||||
|
'%s set the room topic to %s.',
|
||||||
|
$this->renderAuthor(),
|
||||||
|
$this->renderNewValue());
|
||||||
|
} else {
|
||||||
|
return pht(
|
||||||
|
'%s removed the room topic.',
|
||||||
|
$this->renderAuthor());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTitleForFeed() {
|
||||||
|
$old = $this->getOldValue();
|
||||||
|
$new = $this->getNewValue();
|
||||||
|
|
||||||
|
if (strlen($new)) {
|
||||||
|
return pht(
|
||||||
|
'%s set the room topic to %s in %s.',
|
||||||
|
$this->renderAuthor(),
|
||||||
|
$this->renderNewValue(),
|
||||||
|
$this->renderObject());
|
||||||
|
} else {
|
||||||
|
return pht(
|
||||||
|
'%s removed the room topic for %s.',
|
||||||
|
$this->renderAuthor(),
|
||||||
|
$this->renderObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validateTransactions($object, array $xactions) {
|
||||||
|
$errors = array();
|
||||||
|
|
||||||
|
$max_length = $object->getColumnMaximumByteLength('topic');
|
||||||
|
foreach ($xactions as $xaction) {
|
||||||
|
$new_value = $xaction->getNewValue();
|
||||||
|
$new_length = strlen($new_value);
|
||||||
|
if ($new_length > $max_length) {
|
||||||
|
$errors[] = $this->newInvalidError(
|
||||||
|
pht('The topic can be no longer than %s characters.',
|
||||||
|
new PhutilNumber($max_length)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class ConpherenceThreadTransactionType
|
||||||
|
extends PhabricatorModularTransactionType {}
|
|
@ -256,7 +256,9 @@
|
||||||
color: {$lightgreytext};
|
color: {$lightgreytext};
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-timeline-title .phui-timeline-value {
|
.phui-timeline-title .phui-timeline-value,
|
||||||
|
.conpherence-transaction-content .phui-timeline-value,
|
||||||
|
.phui-feed-story-head .phui-timeline-value {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue