From 00a7071e2d1d3f25ec445430708b7a426298b2a1 Mon Sep 17 00:00:00 2001 From: Austin McKinley Date: Mon, 10 Dec 2018 12:47:54 -0800 Subject: [PATCH] Fix handling of Phriction conduit edits Summary: See https://discourse.phabricator-community.org/t/conduit-method-phriction-edit-requires-title-while-the-docs-say-its-optional/2176. Make code consistent with documentation by not requiring either `content` or `title`. Test Plan: Hit the method via the UI and no longer got an error on missing `content` or `title` fields. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D19862 --- .../conduit/PhrictionEditConduitAPIMethod.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php b/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php index 9d97ed7f8c..d1e400a485 100644 --- a/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php +++ b/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php @@ -41,12 +41,19 @@ final class PhrictionEditConduitAPIMethod extends PhrictionConduitAPIMethod { } $xactions = array(); - $xactions[] = id(new PhrictionTransaction()) - ->setTransactionType(PhrictionDocumentTitleTransaction::TRANSACTIONTYPE) - ->setNewValue($request->getValue('title')); - $xactions[] = id(new PhrictionTransaction()) - ->setTransactionType(PhrictionDocumentContentTransaction::TRANSACTIONTYPE) - ->setNewValue($request->getValue('content')); + if ($request->getValue('title')) { + $xactions[] = id(new PhrictionTransaction()) + ->setTransactionType( + PhrictionDocumentTitleTransaction::TRANSACTIONTYPE) + ->setNewValue($request->getValue('title')); + } + + if ($request->getValue('content')) { + $xactions[] = id(new PhrictionTransaction()) + ->setTransactionType( + PhrictionDocumentContentTransaction::TRANSACTIONTYPE) + ->setNewValue($request->getValue('content')); + } $editor = id(new PhrictionTransactionEditor()) ->setActor($request->getUser())