diff --git a/src/applications/legalpad/xaction/LegalpadDocumentRequireSignatureTransaction.php b/src/applications/legalpad/xaction/LegalpadDocumentRequireSignatureTransaction.php index ffef42f0ce..2122ff10fa 100644 --- a/src/applications/legalpad/xaction/LegalpadDocumentRequireSignatureTransaction.php +++ b/src/applications/legalpad/xaction/LegalpadDocumentRequireSignatureTransaction.php @@ -1,58 +1,58 @@ getRequireSignature(); + return (int)$object->getRequireSignature(); } public function applyInternalEffects($object, $value) { $object->setRequireSignature($value); } public function applyExternalEffects($object, $value) { if (strlen($value)) { $session = new PhabricatorAuthSession(); queryfx( $session->establishConnection('w'), 'UPDATE %T SET signedLegalpadDocuments = 0', $session->getTableName()); } } public function getTitle() { $new = $this->getNewValue(); if ($new) { return pht( '%s set the document to require signatures.', $this->renderAuthor()); } else { return pht( '%s set the document to not require signatures.', $this->renderAuthor()); } } public function getTitleForFeed() { $new = $this->getNewValue(); if ($new) { return pht( '%s set the document %s to require signatures.', $this->renderAuthor(), $this->renderObject()); } else { return pht( '%s set the document %s to not require signatures.', $this->renderAuthor(), $this->renderObject()); } } public function getIcon() { return 'fa-pencil-square'; } } diff --git a/src/applications/legalpad/xaction/LegalpadDocumentSignatureTypeTransaction.php b/src/applications/legalpad/xaction/LegalpadDocumentSignatureTypeTransaction.php index df9cf60457..0fe42f0a6f 100644 --- a/src/applications/legalpad/xaction/LegalpadDocumentSignatureTypeTransaction.php +++ b/src/applications/legalpad/xaction/LegalpadDocumentSignatureTypeTransaction.php @@ -1,29 +1,29 @@ getSignatureType(); } public function applyInternalEffects($object, $value) { $object->setSignatureType($value); } public function getTitle() { return pht( - '%s set the document signature type.', + '%s updated the document signature type.', $this->renderAuthor()); } public function getTitleForFeed() { return pht( - '%s set the document signature type for %s.', + '%s updated the document signature type for %s.', $this->renderAuthor(), $this->renderObject()); } } diff --git a/src/applications/legalpad/xaction/LegalpadDocumentTextTransaction.php b/src/applications/legalpad/xaction/LegalpadDocumentTextTransaction.php index c17ebc890d..7c28002da2 100644 --- a/src/applications/legalpad/xaction/LegalpadDocumentTextTransaction.php +++ b/src/applications/legalpad/xaction/LegalpadDocumentTextTransaction.php @@ -1,60 +1,68 @@ getDocumentBody(); return $body->getText(); } public function applyInternalEffects($object, $value) { $body = $object->getDocumentBody(); $body->setText($value); $object->attachDocumentBody($body); } public function getTitle() { - return pht( - '%s updated the document text.', - $this->renderAuthor()); + $old = $this->getOldValue(); + + if (!strlen($old)) { + return pht( + '%s set the document text.', + $this->renderAuthor()); + } else { + return pht( + '%s updated the document text.', + $this->renderAuthor()); + } } public function getTitleForFeed() { return pht( '%s updated the document text for %s.', $this->renderAuthor(), $this->renderObject()); } public function hasChangeDetailView() { return true; } public function getMailDiffSectionHeader() { return pht('CHANGES TO DOCUMENT TEXT'); } public function newChangeDetailView() { $viewer = $this->getViewer(); return id(new PhabricatorApplicationTransactionTextDiffDetailView()) ->setViewer($viewer) ->setOldText($this->getOldValue()) ->setNewText($this->getNewValue()); } public function newRemarkupChanges() { $changes = array(); $changes[] = $this->newRemarkupChange() ->setOldValue($this->getOldValue()) ->setNewValue($this->getNewValue()); return $changes; } } diff --git a/src/applications/legalpad/xaction/LegalpadDocumentTitleTransaction.php b/src/applications/legalpad/xaction/LegalpadDocumentTitleTransaction.php index c6a4b5b509..725f4f4d4c 100644 --- a/src/applications/legalpad/xaction/LegalpadDocumentTitleTransaction.php +++ b/src/applications/legalpad/xaction/LegalpadDocumentTitleTransaction.php @@ -1,58 +1,75 @@ getTitle(); } public function applyInternalEffects($object, $value) { $object->setTitle($value); $body = $object->getDocumentBody(); $body->setTitle($value); $object->attachDocumentBody($body); } public function getTitle() { - return pht( - '%s renamed this document from %s to %s.', - $this->renderAuthor(), - $this->renderOldValue(), - $this->renderNewValue()); + $old = $this->getOldValue(); + + if (!strlen($old)) { + return pht( + '%s created this document.', + $this->renderAuthor()); + } else { + return pht( + '%s renamed this document from %s to %s.', + $this->renderAuthor(), + $this->renderOldValue(), + $this->renderNewValue()); + } } public function getTitleForFeed() { - return pht( - '%s renamed document %s from %s to %s.', - $this->renderAuthor(), - $this->renderObject(), - $this->renderOldValue(), - $this->renderNewValue()); + $old = $this->getOldValue(); + + if (!strlen($old)) { + return pht( + '%s created %s.', + $this->renderAuthor(), + $this->renderObject()); + } else { + return pht( + '%s renamed %s from %s to %s.', + $this->renderAuthor(), + $this->renderObject(), + $this->renderOldValue(), + $this->renderNewValue()); + } } public function validateTransactions($object, array $xactions) { $errors = array(); if ($this->isEmptyTextTransaction($object->getTitle(), $xactions)) { $errors[] = $this->newRequiredError( pht('Documents 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; } }