Page MenuHomePhabricator

D19096.id45762.diff
No OneTemporary

D19096.id45762.diff

diff --git a/resources/sql/autopatches/20180215.phriction.03.descempty.sql b/resources/sql/autopatches/20180215.phriction.03.descempty.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180215.phriction.03.descempty.sql
@@ -0,0 +1,2 @@
+UPDATE {$NAMESPACE}_phriction.phriction_content
+ SET description = '' WHERE description IS NULL;
diff --git a/resources/sql/autopatches/20180215.phriction.04.descnull.sql b/resources/sql/autopatches/20180215.phriction.04.descnull.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180215.phriction.04.descnull.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_phriction.phriction_content
+ CHANGE description description LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT};
diff --git a/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php b/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php
--- a/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php
+++ b/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php
@@ -57,7 +57,7 @@
->setActor($request->getUser())
->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true)
- ->setDescription($request->getValue('description'));
+ ->setDescription((string)$request->getValue('description'));
try {
$editor->applyTransactions($doc, $xactions);
diff --git a/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php b/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php
--- a/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php
+++ b/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php
@@ -52,7 +52,7 @@
->setActor($request->getUser())
->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true)
- ->setDescription($request->getValue('description'));
+ ->setDescription((string)$request->getValue('description'));
try {
$editor->applyTransactions($doc, $xactions);
diff --git a/src/applications/phriction/controller/PhrictionHistoryController.php b/src/applications/phriction/controller/PhrictionHistoryController.php
--- a/src/applications/phriction/controller/PhrictionHistoryController.php
+++ b/src/applications/phriction/controller/PhrictionHistoryController.php
@@ -22,16 +22,13 @@
$current = $document->getContent();
- $pager = new PHUIPagerView();
- $pager->setOffset($request->getInt('page'));
- $pager->setURI($request->getRequestURI(), 'page');
-
- $history = id(new PhrictionContent())->loadAllWhere(
- 'documentID = %d ORDER BY version DESC LIMIT %d, %d',
- $document->getID(),
- $pager->getOffset(),
- $pager->getPageSize() + 1);
- $history = $pager->sliceResults($history);
+ $pager = id(new AphrontCursorPagerView())
+ ->readFromRequest($request);
+
+ $history = id(new PhrictionContentQuery())
+ ->setViewer($viewer)
+ ->withDocumentPHIDs(array($document->getPHID()))
+ ->executeWithCursorPager($pager);
$author_phids = mpull($history, 'getAuthorPHID');
$handles = $this->loadViewerHandles($author_phids);
diff --git a/src/applications/phriction/editor/PhrictionTransactionEditor.php b/src/applications/phriction/editor/PhrictionTransactionEditor.php
--- a/src/applications/phriction/editor/PhrictionTransactionEditor.php
+++ b/src/applications/phriction/editor/PhrictionTransactionEditor.php
@@ -596,10 +596,13 @@
->setAuthorPHID($this->getActor()->getPHID())
->setChangeType(PhrictionChangeType::CHANGE_EDIT)
->setTitle($this->getOldContent()->getTitle())
- ->setContent($this->getOldContent()->getContent());
+ ->setContent($this->getOldContent()->getContent())
+ ->setDescription('');
+
if (strlen($this->getDescription())) {
$new_content->setDescription($this->getDescription());
}
+
$new_content->setVersion($this->getOldContent()->getVersion() + 1);
return $new_content;
diff --git a/src/applications/phriction/storage/PhrictionContent.php b/src/applications/phriction/storage/PhrictionContent.php
--- a/src/applications/phriction/storage/PhrictionContent.php
+++ b/src/applications/phriction/storage/PhrictionContent.php
@@ -30,10 +30,7 @@
'content' => 'text',
'changeType' => 'uint32',
'changeRef' => 'uint32?',
-
- // T6203/NULLABILITY
- // This should just be empty if not provided?
- 'description' => 'text?',
+ 'description' => 'text',
),
self::CONFIG_KEY_SCHEMA => array(
'documentID' => array(

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 10, 9:02 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7472421
Default Alt Text
D19096.id45762.diff (4 KB)

Event Timeline