mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +01:00
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
This commit is contained in:
parent
f742d00c28
commit
a965d8d6ae
7 changed files with 17 additions and 16 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
UPDATE {$NAMESPACE}_phriction.phriction_content
|
||||||
|
SET description = '' WHERE description IS NULL;
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE {$NAMESPACE}_phriction.phriction_content
|
||||||
|
CHANGE description description LONGTEXT NOT NULL COLLATE {$COLLATE_TEXT};
|
|
@ -57,7 +57,7 @@ final class PhrictionCreateConduitAPIMethod extends PhrictionConduitAPIMethod {
|
||||||
->setActor($request->getUser())
|
->setActor($request->getUser())
|
||||||
->setContentSource($request->newContentSource())
|
->setContentSource($request->newContentSource())
|
||||||
->setContinueOnNoEffect(true)
|
->setContinueOnNoEffect(true)
|
||||||
->setDescription($request->getValue('description'));
|
->setDescription((string)$request->getValue('description'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$editor->applyTransactions($doc, $xactions);
|
$editor->applyTransactions($doc, $xactions);
|
||||||
|
|
|
@ -52,7 +52,7 @@ final class PhrictionEditConduitAPIMethod extends PhrictionConduitAPIMethod {
|
||||||
->setActor($request->getUser())
|
->setActor($request->getUser())
|
||||||
->setContentSource($request->newContentSource())
|
->setContentSource($request->newContentSource())
|
||||||
->setContinueOnNoEffect(true)
|
->setContinueOnNoEffect(true)
|
||||||
->setDescription($request->getValue('description'));
|
->setDescription((string)$request->getValue('description'));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$editor->applyTransactions($doc, $xactions);
|
$editor->applyTransactions($doc, $xactions);
|
||||||
|
|
|
@ -22,16 +22,13 @@ final class PhrictionHistoryController
|
||||||
|
|
||||||
$current = $document->getContent();
|
$current = $document->getContent();
|
||||||
|
|
||||||
$pager = new PHUIPagerView();
|
$pager = id(new AphrontCursorPagerView())
|
||||||
$pager->setOffset($request->getInt('page'));
|
->readFromRequest($request);
|
||||||
$pager->setURI($request->getRequestURI(), 'page');
|
|
||||||
|
|
||||||
$history = id(new PhrictionContent())->loadAllWhere(
|
$history = id(new PhrictionContentQuery())
|
||||||
'documentID = %d ORDER BY version DESC LIMIT %d, %d',
|
->setViewer($viewer)
|
||||||
$document->getID(),
|
->withDocumentPHIDs(array($document->getPHID()))
|
||||||
$pager->getOffset(),
|
->executeWithCursorPager($pager);
|
||||||
$pager->getPageSize() + 1);
|
|
||||||
$history = $pager->sliceResults($history);
|
|
||||||
|
|
||||||
$author_phids = mpull($history, 'getAuthorPHID');
|
$author_phids = mpull($history, 'getAuthorPHID');
|
||||||
$handles = $this->loadViewerHandles($author_phids);
|
$handles = $this->loadViewerHandles($author_phids);
|
||||||
|
|
|
@ -596,10 +596,13 @@ final class PhrictionTransactionEditor
|
||||||
->setAuthorPHID($this->getActor()->getPHID())
|
->setAuthorPHID($this->getActor()->getPHID())
|
||||||
->setChangeType(PhrictionChangeType::CHANGE_EDIT)
|
->setChangeType(PhrictionChangeType::CHANGE_EDIT)
|
||||||
->setTitle($this->getOldContent()->getTitle())
|
->setTitle($this->getOldContent()->getTitle())
|
||||||
->setContent($this->getOldContent()->getContent());
|
->setContent($this->getOldContent()->getContent())
|
||||||
|
->setDescription('');
|
||||||
|
|
||||||
if (strlen($this->getDescription())) {
|
if (strlen($this->getDescription())) {
|
||||||
$new_content->setDescription($this->getDescription());
|
$new_content->setDescription($this->getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_content->setVersion($this->getOldContent()->getVersion() + 1);
|
$new_content->setVersion($this->getOldContent()->getVersion() + 1);
|
||||||
|
|
||||||
return $new_content;
|
return $new_content;
|
||||||
|
|
|
@ -30,10 +30,7 @@ final class PhrictionContent
|
||||||
'content' => 'text',
|
'content' => 'text',
|
||||||
'changeType' => 'uint32',
|
'changeType' => 'uint32',
|
||||||
'changeRef' => 'uint32?',
|
'changeRef' => 'uint32?',
|
||||||
|
'description' => 'text',
|
||||||
// T6203/NULLABILITY
|
|
||||||
// This should just be empty if not provided?
|
|
||||||
'description' => 'text?',
|
|
||||||
),
|
),
|
||||||
self::CONFIG_KEY_SCHEMA => array(
|
self::CONFIG_KEY_SCHEMA => array(
|
||||||
'documentID' => array(
|
'documentID' => array(
|
||||||
|
|
Loading…
Reference in a new issue