Path: blob/master/src/applications/conpherence/xaction/ConpherenceThreadTopicTransaction.php
12256 views
<?php12final class ConpherenceThreadTopicTransaction3extends ConpherenceThreadTransactionType {45const TRANSACTIONTYPE = 'topic';67public function generateOldValue($object) {8return $object->getTopic();9}1011public function applyInternalEffects($object, $value) {12$object->setTopic($value);13}1415public function getTitle() {16$old = $this->getOldValue();17$new = $this->getNewValue();1819if (strlen($new)) {20return pht(21'%s set the room topic to %s.',22$this->renderAuthor(),23$this->renderNewValue());24} else {25return pht(26'%s removed the room topic.',27$this->renderAuthor());28}2930}3132public function getTitleForFeed() {33$old = $this->getOldValue();34$new = $this->getNewValue();3536if (strlen($new)) {37return pht(38'%s set the room topic to %s in %s.',39$this->renderAuthor(),40$this->renderNewValue(),41$this->renderObject());42} else {43return pht(44'%s removed the room topic for %s.',45$this->renderAuthor(),46$this->renderObject());47}4849}5051public function validateTransactions($object, array $xactions) {52$errors = array();5354$max_length = $object->getColumnMaximumByteLength('topic');55foreach ($xactions as $xaction) {56$new_value = $xaction->getNewValue();57$new_length = strlen($new_value);58if ($new_length > $max_length) {59$errors[] = $this->newInvalidError(60pht('The topic can be no longer than %s characters.',61new PhutilNumber($max_length)));62}63}6465return $errors;66}6768}697071