mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20: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);
|
||||
}
|
||||
|
||||
$answer = PonderAnswer::initializeNewAnswer($viewer);
|
||||
$answer = PonderAnswer::initializeNewAnswer($viewer, $question);
|
||||
|
||||
// Question Editor
|
||||
|
||||
|
|
|
@ -26,15 +26,18 @@ final class PonderAnswer extends PonderDAO
|
|||
|
||||
private $userVotes = array();
|
||||
|
||||
public static function initializeNewAnswer(PhabricatorUser $actor) {
|
||||
public static function initializeNewAnswer(
|
||||
PhabricatorUser $actor,
|
||||
PonderQuestion $question) {
|
||||
$app = id(new PhabricatorApplicationQuery())
|
||||
->setViewer($actor)
|
||||
->withClasses(array('PhabricatorPonderApplication'))
|
||||
->executeOne();
|
||||
|
||||
return id(new PonderAnswer())
|
||||
->setQuestionID(0)
|
||||
->setQuestionID($question->getID())
|
||||
->setContent('')
|
||||
->attachQuestion($question)
|
||||
->setAuthorPHID($actor->getPHID())
|
||||
->setVoteCount(0)
|
||||
->setStatus(PonderAnswerStatus::ANSWER_STATUS_VISIBLE);
|
||||
|
|
Loading…
Reference in a new issue