Differential D13754 Diff 33231 src/applications/conpherence/controller/ConpherenceNewRoomController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conpherence/controller/ConpherenceNewRoomController.php
<?php | <?php | ||||
final class ConpherenceNewRoomController extends ConpherenceController { | final class ConpherenceNewRoomController extends ConpherenceController { | ||||
public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$user = $request->getUser(); | $user = $request->getUser(); | ||||
$title = pht('New Room'); | $title = pht('New Room'); | ||||
$e_title = true; | $e_title = true; | ||||
$v_message = null; | |||||
$validation_exception = null; | $validation_exception = null; | ||||
$conpherence = ConpherenceThread::initializeNewRoom($user); | $conpherence = ConpherenceThread::initializeNewRoom($user); | ||||
$participants = array(); | $participants = array(); | ||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
$editor = new ConpherenceEditor(); | $editor = new ConpherenceEditor(); | ||||
$xactions = array(); | $xactions = array(); | ||||
Show All 12 Lines | if ($request->isFormPost()) { | ||||
->setNewValue($request->getStr('viewPolicy')); | ->setNewValue($request->getStr('viewPolicy')); | ||||
$xactions[] = id(new ConpherenceTransaction()) | $xactions[] = id(new ConpherenceTransaction()) | ||||
->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) | ->setTransactionType(PhabricatorTransactions::TYPE_EDIT_POLICY) | ||||
->setNewValue($request->getStr('editPolicy')); | ->setNewValue($request->getStr('editPolicy')); | ||||
$xactions[] = id(new ConpherenceTransaction()) | $xactions[] = id(new ConpherenceTransaction()) | ||||
->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY) | ->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY) | ||||
->setNewValue($request->getStr('joinPolicy')); | ->setNewValue($request->getStr('joinPolicy')); | ||||
$message = $request->getStr('message'); | $v_message = $request->getStr('message'); | ||||
if ($message) { | if (strlen($v_message)) { | ||||
epriestley: This test should probably be `if (strlen($v_message))` -- users may not be able to send the… | |||||
$message_xactions = $editor->generateTransactionsFromText( | $message_xactions = $editor->generateTransactionsFromText( | ||||
$user, | $user, | ||||
$conpherence, | $conpherence, | ||||
$message); | $v_message); | ||||
$xactions = array_merge($xactions, $message_xactions); | $xactions = array_merge($xactions, $message_xactions); | ||||
} | } | ||||
try { | try { | ||||
$editor | $editor | ||||
->setContentSourceFromRequest($request) | ->setContentSourceFromRequest($request) | ||||
->setContinueOnNoEffect(true) | ->setContinueOnNoEffect(true) | ||||
->setActor($user) | ->setActor($user) | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | $form = id(new PHUIFormLayoutView()) | ||||
->setName('joinPolicy') | ->setName('joinPolicy') | ||||
->setPolicyObject($conpherence) | ->setPolicyObject($conpherence) | ||||
->setCapability(PhabricatorPolicyCapability::CAN_JOIN) | ->setCapability(PhabricatorPolicyCapability::CAN_JOIN) | ||||
->setPolicies($policies)) | ->setPolicies($policies)) | ||||
->appendChild( | ->appendChild( | ||||
id(new PhabricatorRemarkupControl()) | id(new PhabricatorRemarkupControl()) | ||||
->setUser($user) | ->setUser($user) | ||||
->setName('message') | ->setName('message') | ||||
->setLabel(pht('First Message'))); | ->setLabel(pht('First Message')) | ||||
->setValue($v_message)); | |||||
$dialog->appendChild($form); | $dialog->appendChild($form); | ||||
return id(new AphrontDialogResponse())->setDialog($dialog); | return id(new AphrontDialogResponse())->setDialog($dialog); | ||||
} | } | ||||
} | } |
This test should probably be if (strlen($v_message)) -- users may not be able to send the message "0" (no quotes) otherwise because of PHP being special.