Don't store empty drafts
Summary: We have lots of empty drafts in DB. Test Plan: Wrote revision comment, deleted it, checked db. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3591
This commit is contained in:
@@ -39,18 +39,11 @@ final class ManiphestTransactionPreviewController extends ManiphestController {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$draft = id(new PhabricatorDraft())->loadOneWhere(
|
||||
'authorPHID = %s AND draftKey = %s',
|
||||
$user->getPHID(),
|
||||
$task->getPHID());
|
||||
if (!$draft) {
|
||||
$draft = new PhabricatorDraft();
|
||||
$draft->setAuthorPHID($user->getPHID());
|
||||
$draft->setDraftKey($task->getPHID());
|
||||
}
|
||||
$draft->setDraft($comments);
|
||||
$draft->save();
|
||||
|
||||
id(new PhabricatorDraft())
|
||||
->setAuthorPHID($user->getPHID())
|
||||
->setDraftKey($task->getPHID())
|
||||
->setDraft($comments)
|
||||
->replaceOrDelete();
|
||||
|
||||
$action = $request->getStr('action');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user