mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 12:30:56 +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:
parent
0b6c031042
commit
6ff1354ac1
2 changed files with 6 additions and 3 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue