Conpherence - add draft support
Summary: Fixes T3497. Test Plan: on conpherence 1, typed some stuff. clicked conpherence 2 - observed some stuff gone. clicked conpherence 1 - stuff came back! submitted conpherence 1 and reloaded - stuff did not come back. (Generally played around a bunch like this) Reviewers: epriestley Reviewed By: epriestley CC: Korvin, epriestley, aran Maniphest Tasks: T3497 Differential Revision: https://secure.phabricator.com/D8266
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @group conpherence
|
||||
*/
|
||||
final class ConpherenceUpdateController
|
||||
extends ConpherenceController {
|
||||
|
||||
@@ -39,6 +36,7 @@ final class ConpherenceUpdateController
|
||||
$error_view = null;
|
||||
$e_file = array();
|
||||
$errors = array();
|
||||
$delete_draft = false;
|
||||
if ($request->isFormPost()) {
|
||||
$editor = id(new ConpherenceEditor())
|
||||
->setContinueOnNoEffect($request->isContinueRequest())
|
||||
@@ -46,11 +44,19 @@ final class ConpherenceUpdateController
|
||||
->setActor($user);
|
||||
|
||||
switch ($action) {
|
||||
case ConpherenceUpdateActions::DRAFT:
|
||||
$draft = PhabricatorDraft::newFromUserAndKey(
|
||||
$user,
|
||||
$conpherence->getPHID());
|
||||
$draft->setDraft($request->getStr('text'));
|
||||
$draft->replaceOrDelete();
|
||||
break;
|
||||
case ConpherenceUpdateActions::MESSAGE:
|
||||
$message = $request->getStr('text');
|
||||
$xactions = $editor->generateTransactionsFromText(
|
||||
$conpherence,
|
||||
$message);
|
||||
$delete_draft = true;
|
||||
break;
|
||||
case ConpherenceUpdateActions::ADD_PERSON:
|
||||
$xactions = array();
|
||||
@@ -116,6 +122,12 @@ final class ConpherenceUpdateController
|
||||
if ($xactions) {
|
||||
try {
|
||||
$xactions = $editor->applyTransactions($conpherence, $xactions);
|
||||
if ($delete_draft) {
|
||||
$draft = PhabricatorDraft::newFromUserAndKey(
|
||||
$user,
|
||||
$conpherence->getPHID());
|
||||
$draft->delete();
|
||||
}
|
||||
} catch (PhabricatorApplicationTransactionNoEffectException $ex) {
|
||||
return id(new PhabricatorApplicationTransactionNoEffectResponse())
|
||||
->setCancelURI($this->getApplicationURI($conpherence_id.'/'))
|
||||
|
||||
Reference in New Issue
Block a user