1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-29 17:00:59 +01:00

Fix errors when mentioning others in Ponder

Summary: Fixes T9552. We need to set a questionID and the question object (for policy) when initializing a new Answer.

Test Plan: Write an answer that mentions another user.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T9552

Differential Revision: https://secure.phabricator.com/D14263
This commit is contained in:
Chad Little 2015-10-13 09:09:07 -07:00
parent 0b6c031042
commit 6ff1354ac1
2 changed files with 6 additions and 3 deletions

View file

@ -32,7 +32,7 @@ final class PonderAnswerSaveController extends PonderController {
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
} }
$answer = PonderAnswer::initializeNewAnswer($viewer); $answer = PonderAnswer::initializeNewAnswer($viewer, $question);
// Question Editor // Question Editor

View file

@ -26,15 +26,18 @@ final class PonderAnswer extends PonderDAO
private $userVotes = array(); private $userVotes = array();
public static function initializeNewAnswer(PhabricatorUser $actor) { public static function initializeNewAnswer(
PhabricatorUser $actor,
PonderQuestion $question) {
$app = id(new PhabricatorApplicationQuery()) $app = id(new PhabricatorApplicationQuery())
->setViewer($actor) ->setViewer($actor)
->withClasses(array('PhabricatorPonderApplication')) ->withClasses(array('PhabricatorPonderApplication'))
->executeOne(); ->executeOne();
return id(new PonderAnswer()) return id(new PonderAnswer())
->setQuestionID(0) ->setQuestionID($question->getID())
->setContent('') ->setContent('')
->attachQuestion($question)
->setAuthorPHID($actor->getPHID()) ->setAuthorPHID($actor->getPHID())
->setVoteCount(0) ->setVoteCount(0)
->setStatus(PonderAnswerStatus::ANSWER_STATUS_VISIBLE); ->setStatus(PonderAnswerStatus::ANSWER_STATUS_VISIBLE);