@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make PhrictionContent "description" non-nullable

Summary:
Depends on D19095. Ref T6203. Ref T13077. This column is nullable in an inconsistent way. Make it non-nullable.

Also clean up one more content query on the history view.

Test Plan: Ran migration, then created and edited documents without providing a descriptino or hitting `NULL` exceptions.

Maniphest Tasks: T13077, T6203

Differential Revision: https://secure.phabricator.com/D19096

+17 -16
+2
resources/sql/autopatches/20180215.phriction.03.descempty.sql
··· 1 + UPDATE {$NAMESPACE}_phriction.phriction_content 2 + SET description = '' WHERE description IS NULL;
+2
resources/sql/autopatches/20180215.phriction.04.descnull.sql
··· 1 + ALTER TABLE {$NAMESPACE}_phriction.phriction_content 2 + CHANGE description description LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT};
+1 -1
src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php
··· 57 57 ->setActor($request->getUser()) 58 58 ->setContentSource($request->newContentSource()) 59 59 ->setContinueOnNoEffect(true) 60 - ->setDescription($request->getValue('description')); 60 + ->setDescription((string)$request->getValue('description')); 61 61 62 62 try { 63 63 $editor->applyTransactions($doc, $xactions);
+1 -1
src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php
··· 52 52 ->setActor($request->getUser()) 53 53 ->setContentSource($request->newContentSource()) 54 54 ->setContinueOnNoEffect(true) 55 - ->setDescription($request->getValue('description')); 55 + ->setDescription((string)$request->getValue('description')); 56 56 57 57 try { 58 58 $editor->applyTransactions($doc, $xactions);
+6 -9
src/applications/phriction/controller/PhrictionHistoryController.php
··· 22 22 23 23 $current = $document->getContent(); 24 24 25 - $pager = new PHUIPagerView(); 26 - $pager->setOffset($request->getInt('page')); 27 - $pager->setURI($request->getRequestURI(), 'page'); 25 + $pager = id(new AphrontCursorPagerView()) 26 + ->readFromRequest($request); 28 27 29 - $history = id(new PhrictionContent())->loadAllWhere( 30 - 'documentID = %d ORDER BY version DESC LIMIT %d, %d', 31 - $document->getID(), 32 - $pager->getOffset(), 33 - $pager->getPageSize() + 1); 34 - $history = $pager->sliceResults($history); 28 + $history = id(new PhrictionContentQuery()) 29 + ->setViewer($viewer) 30 + ->withDocumentPHIDs(array($document->getPHID())) 31 + ->executeWithCursorPager($pager); 35 32 36 33 $author_phids = mpull($history, 'getAuthorPHID'); 37 34 $handles = $this->loadViewerHandles($author_phids);
+4 -1
src/applications/phriction/editor/PhrictionTransactionEditor.php
··· 596 596 ->setAuthorPHID($this->getActor()->getPHID()) 597 597 ->setChangeType(PhrictionChangeType::CHANGE_EDIT) 598 598 ->setTitle($this->getOldContent()->getTitle()) 599 - ->setContent($this->getOldContent()->getContent()); 599 + ->setContent($this->getOldContent()->getContent()) 600 + ->setDescription(''); 601 + 600 602 if (strlen($this->getDescription())) { 601 603 $new_content->setDescription($this->getDescription()); 602 604 } 605 + 603 606 $new_content->setVersion($this->getOldContent()->getVersion() + 1); 604 607 605 608 return $new_content;
+1 -4
src/applications/phriction/storage/PhrictionContent.php
··· 30 30 'content' => 'text', 31 31 'changeType' => 'uint32', 32 32 'changeRef' => 'uint32?', 33 - 34 - // T6203/NULLABILITY 35 - // This should just be empty if not provided? 36 - 'description' => 'text?', 33 + 'description' => 'text', 37 34 ), 38 35 self::CONFIG_KEY_SCHEMA => array( 39 36 'documentID' => array(