1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +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:
Chad Little 2017-04-12 16:33:43 -07:00
parent a9845b0b1d
commit a7ebfc12c0
16 changed files with 248 additions and 192 deletions

View file

@ -9,7 +9,7 @@ return array(
'names' => array(
'conpherence.pkg.css' => 'b5ee2073',
'conpherence.pkg.js' => '281b1a73',
'core.pkg.css' => '476a4ec7',
'core.pkg.css' => '30a64ed6',
'core.pkg.js' => 'fbc1c380',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '90b30783',
@ -167,7 +167,7 @@ return array(
'rsrc/css/phui/phui-spacing.css' => '042804d6',
'rsrc/css/phui/phui-status.css' => 'd5263e49',
'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/workboards/phui-workboard-color.css' => '783cdff5',
'rsrc/css/phui/workboards/phui-workboard.css' => '3bc85455',
@ -877,7 +877,7 @@ return array(
'phui-status-list-view-css' => 'd5263e49',
'phui-tag-view-css' => '84d65f26',
'phui-theme-css' => '9f261c6b',
'phui-timeline-view-css' => 'bf45789e',
'phui-timeline-view-css' => '1d7ef61d',
'phui-two-column-view-css' => 'ce9fa0b7',
'phui-workboard-color-css' => '783cdff5',
'phui-workboard-view-css' => '3bc85455',

View file

@ -320,11 +320,15 @@ phutil_register_library_map(array(
'ConpherenceThreadListView' => 'applications/conpherence/view/ConpherenceThreadListView.php',
'ConpherenceThreadMailReceiver' => 'applications/conpherence/mail/ConpherenceThreadMailReceiver.php',
'ConpherenceThreadMembersPolicyRule' => 'applications/conpherence/policyrule/ConpherenceThreadMembersPolicyRule.php',
'ConpherenceThreadPictureTransaction' => 'applications/conpherence/xaction/ConpherenceThreadPictureTransaction.php',
'ConpherenceThreadQuery' => 'applications/conpherence/query/ConpherenceThreadQuery.php',
'ConpherenceThreadRemarkupRule' => 'applications/conpherence/remarkup/ConpherenceThreadRemarkupRule.php',
'ConpherenceThreadSearchController' => 'applications/conpherence/controller/ConpherenceThreadSearchController.php',
'ConpherenceThreadSearchEngine' => 'applications/conpherence/query/ConpherenceThreadSearchEngine.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',
'ConpherenceTransactionComment' => 'applications/conpherence/storage/ConpherenceTransactionComment.php',
'ConpherenceTransactionQuery' => 'applications/conpherence/query/ConpherenceTransactionQuery.php',
@ -5099,12 +5103,16 @@ phutil_register_library_map(array(
'ConpherenceThreadListView' => 'AphrontView',
'ConpherenceThreadMailReceiver' => 'PhabricatorObjectMailReceiver',
'ConpherenceThreadMembersPolicyRule' => 'PhabricatorPolicyRule',
'ConpherenceThreadPictureTransaction' => 'ConpherenceThreadTransactionType',
'ConpherenceThreadQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'ConpherenceThreadRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'ConpherenceThreadSearchController' => 'ConpherenceController',
'ConpherenceThreadSearchEngine' => 'PhabricatorApplicationSearchEngine',
'ConpherenceThreadTitleNgrams' => 'PhabricatorSearchNgrams',
'ConpherenceTransaction' => 'PhabricatorApplicationTransaction',
'ConpherenceThreadTitleTransaction' => 'ConpherenceThreadTransactionType',
'ConpherenceThreadTopicTransaction' => 'ConpherenceThreadTransactionType',
'ConpherenceThreadTransactionType' => 'PhabricatorModularTransactionType',
'ConpherenceTransaction' => 'PhabricatorModularTransaction',
'ConpherenceTransactionComment' => 'PhabricatorApplicationTransactionComment',
'ConpherenceTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'ConpherenceTransactionRenderer' => 'Phobject',

View file

@ -123,7 +123,8 @@ final class ConpherenceRoomTestCase extends ConpherenceTestCase {
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => $participant_phids));
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setTransactionType(
ConpherenceThreadTitleTransaction::TRANSACTIONTYPE)
->setNewValue(pht('Test'));
id(new ConpherenceEditor())

View file

@ -83,7 +83,8 @@ final class ConpherenceUpdateThreadConduitAPIMethod
}
if ($title) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setTransactionType(
ConpherenceThreadTitleTransaction::TRANSACTIONTYPE)
->setNewValue($title);
}
if ($message) {

View file

@ -16,7 +16,7 @@ final class ConpherenceNewRoomController extends ConpherenceController {
$xactions = array();
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setTransactionType(ConpherenceThreadTitleTransaction::TRANSACTIONTYPE)
->setNewValue($request->getStr('title'));
$participants = $request->getArr('participants');
@ -26,7 +26,7 @@ final class ConpherenceNewRoomController extends ConpherenceController {
->setTransactionType(ConpherenceTransaction::TYPE_PARTICIPANTS)
->setNewValue(array('+' => $participants));
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TOPIC)
->setTransactionType(ConpherenceThreadTopicTransaction::TRANSACTIONTYPE)
->setNewValue($request->getStr('topic'));
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)
@ -50,7 +50,8 @@ final class ConpherenceNewRoomController extends ConpherenceController {
} catch (PhabricatorApplicationTransactionValidationException $ex) {
$validation_exception = $ex;
$e_title = $ex->getShortMessage(ConpherenceTransaction::TYPE_TITLE);
$e_title = $ex->getShortMessage(
ConpherenceThreadTitleTransaction::TRANSACTIONTYPE);
$conpherence->setViewPolicy($request->getStr('viewPolicy'));
$conpherence->setEditPolicy($request->getStr('editPolicy'));

View file

@ -76,7 +76,8 @@ final class ConpherenceRoomPictureController
$xactions = array();
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_PICTURE)
->setTransactionType(
ConpherenceThreadPictureTransaction::TRANSACTIONTYPE)
->setNewValue($new_value);
$editor = id(new ConpherenceEditor())

View file

@ -140,10 +140,12 @@ final class ConpherenceUpdateController
$title = $request->getStr('title');
$topic = $request->getStr('topic');
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setTransactionType(
ConpherenceThreadTitleTransaction::TRANSACTIONTYPE)
->setNewValue($title);
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TOPIC)
->setTransactionType(
ConpherenceThreadTopicTransaction::TRANSACTIONTYPE)
->setNewValue($topic);
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(PhabricatorTransactions::TYPE_VIEW_POLICY)

View file

@ -41,12 +41,14 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
->setNewValue(array('+' => $participant_phids));
if ($title) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TITLE)
->setTransactionType(
ConpherenceThreadTitleTransaction::TRANSACTIONTYPE)
->setNewValue($title);
}
if (strlen($topic)) {
$xactions[] = id(new ConpherenceTransaction())
->setTransactionType(ConpherenceTransaction::TYPE_TOPIC)
->setTransactionType(
ConpherenceThreadTopicTransaction::TRANSACTIONTYPE)
->setNewValue($topic);
}
@ -87,10 +89,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$types[] = PhabricatorTransactions::TYPE_COMMENT;
$types[] = ConpherenceTransaction::TYPE_TITLE;
$types[] = ConpherenceTransaction::TYPE_TOPIC;
$types[] = ConpherenceTransaction::TYPE_PARTICIPANTS;
$types[] = ConpherenceTransaction::TYPE_PICTURE;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
$types[] = PhabricatorTransactions::TYPE_JOIN_POLICY;
@ -98,17 +97,34 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
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(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
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:
if ($this->getIsNewObject()) {
return array();
@ -122,10 +138,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
case ConpherenceTransaction::TYPE_TITLE:
case ConpherenceTransaction::TYPE_TOPIC:
case ConpherenceTransaction::TYPE_PICTURE:
return $xaction->getNewValue();
case ConpherenceTransaction::TYPE_PARTICIPANTS:
return $this->getPHIDTransactionNewValue($xaction);
}
@ -211,15 +223,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$make_author_recent_participant = true;
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:
if (!$this->getIsNewObject()) {
$old_map = array_fuse($xaction->getOldValue());
@ -418,8 +421,8 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
PhabricatorPolicyCapability::CAN_EDIT);
}
break;
case ConpherenceTransaction::TYPE_TITLE:
case ConpherenceTransaction::TYPE_TOPIC:
case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE:
case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE:
PhabricatorPolicyFilter::requireCapability(
$this->requireActor(),
$object,
@ -434,8 +437,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$type = $u->getTransactionType();
switch ($type) {
case ConpherenceTransaction::TYPE_TITLE:
return $v;
case ConpherenceTransaction::TYPE_PARTICIPANTS:
return $this->mergePHIDOrEdgeTransactions($u, $v);
}
@ -541,23 +542,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
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() {
return true;
}
@ -570,26 +554,6 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
$errors = parent::validateTransaction($object, $type, $xactions);
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:
foreach ($xactions as $xaction) {
$new_phids = $this->getPHIDTransactionNewValue($xaction, array());

View file

@ -268,9 +268,9 @@ final class ConpherenceThread extends ConpherenceDAO
case PhabricatorTransactions::TYPE_COMMENT:
$message_transaction = $transaction;
break;
case ConpherenceTransaction::TYPE_TITLE:
case ConpherenceTransaction::TYPE_TOPIC:
case ConpherenceTransaction::TYPE_PICTURE:
case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE:
case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE:
case ConpherenceThreadPictureTransaction::TRANSACTIONTYPE:
case ConpherenceTransaction::TYPE_PARTICIPANTS:
$action_transaction = $transaction;
break;

View file

@ -1,12 +1,10 @@
<?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_DATE_MARKER = 'date-marker';
const TYPE_PICTURE = 'picture';
public function getApplicationName() {
return 'conpherence';
@ -20,6 +18,10 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
return new ConpherenceTransactionComment();
}
public function getBaseTransactionClass() {
return 'ConpherenceThreadTransactionType';
}
public function getNoEffectDescription() {
switch ($this->getTransactionType()) {
case self::TYPE_PARTICIPANTS:
@ -37,9 +39,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
switch ($this->getTransactionType()) {
case self::TYPE_PARTICIPANTS:
return ($old === null);
case self::TYPE_TITLE:
case self::TYPE_TOPIC:
case self::TYPE_PICTURE:
case self::TYPE_DATE_MARKER:
return false;
}
@ -54,12 +53,9 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
case self::TYPE_TITLE:
case self::TYPE_TOPIC:
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_JOIN_POLICY:
case self::TYPE_PICTURE:
return $this->getRoomTitle();
break;
case self::TYPE_PARTICIPANTS:
@ -94,55 +90,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
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() {
$author_phid = $this->getAuthorPHID();
@ -150,45 +97,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
$new = $this->getNewValue();
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:
return pht(
'%s changed the visibility of this room from "%s" to "%s".',
@ -221,8 +129,6 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
$phids[] = $this->getAuthorPHID();
switch ($this->getTransactionType()) {
case self::TYPE_TITLE:
case self::TYPE_PICTURE:
case self::TYPE_DATE_MARKER:
break;
case self::TYPE_PARTICIPANTS:

View file

@ -216,17 +216,6 @@ final class ConpherenceTransactionView extends AphrontView {
$content = null;
$handles = $this->getHandles();
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:
$this->addClass('conpherence-comment');
$author = $handles[$transaction->getAuthorPHID()];
@ -236,6 +225,10 @@ final class ConpherenceTransactionView extends AphrontView {
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
$content_class = 'conpherence-message';
break;
default:
$content = $transaction->getTitle();
$this->addClass('conpherence-edited');
break;
}
$view = phutil_tag(

View file

@ -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());
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -0,0 +1,4 @@
<?php
abstract class ConpherenceThreadTransactionType
extends PhabricatorModularTransactionType {}

View file

@ -256,7 +256,9 @@
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;
color: black;
}