1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Clean up legalpad transaction copy

Summary: Ref T12685, adds more informative transaction copy, fixes bugs.

Test Plan: Create various documents and edit them.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12685

Differential Revision: https://secure.phabricator.com/D17860
This commit is contained in:
Chad Little 2017-05-09 10:41:06 -07:00
parent c4aa0a9b9a
commit 437a843a8e
4 changed files with 42 additions and 17 deletions

View file

@ -6,7 +6,7 @@ final class LegalpadDocumentRequireSignatureTransaction
const TRANSACTIONTYPE = 'legalpad:require-signature';
public function generateOldValue($object) {
return $object->getRequireSignature();
return (int)$object->getRequireSignature();
}
public function applyInternalEffects($object, $value) {

View file

@ -15,13 +15,13 @@ final class LegalpadDocumentSignatureTypeTransaction
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());
}

View file

@ -17,9 +17,17 @@ final class LegalpadDocumentTextTransaction
}
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() {

View file

@ -17,20 +17,37 @@ final class LegalpadDocumentTitleTransaction
}
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) {