Page MenuHomePhorge

Fix PonderQuestionCreateMailReceiver accessing non-existing PonderQuestionTransaction constants
ClosedPublic

Authored by aklapper on May 17 2024, 09:20.

Details

Summary

The transaction types TYPE_TITLE and TYPE_CONTENT were removed from PonderQuestionTransaction in rPdff028c4907dd1959859733ea0d947f244559e7f.
Thus update PonderQuestionCreateMailReceiver to use the corresponding modular transactions PonderQuestionTitleTransaction and PonderQuestionContentTransaction instead.

Test Plan

Carefully read the code, grep the code base, use the test case in D25656#18162.

Diff Detail

Repository
rP Phorge
Branch
NEponderQuestionTransactionConstants (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1279
Build 1279: arc lint + arc unit

Event Timeline

Thanks :)

I tested this with the following snippet:

<?php
require_once dirname(__FILE__).'/scripts/init/init-script.php';

$viewer = PhabricatorUser::getOmnipotentUser();

$author = id(new PhabricatorPeopleQuery())
	->setViewer($viewer)
	->setLimit(1)
	->executeOne();

$content_source =
PhabricatorContentSource::newForSource(
    PhabricatorOldWorldContentSource::SOURCECONST);


$title = "ASD";
$content = "LOL";

$xactions = array();

    $xactions[] = id(new PonderQuestionTransaction())
      ->setTransactionType(PonderQuestionTitleTransaction::TRANSACTIONTYPE)
      ->setNewValue($title);

    $xactions[] = id(new PonderQuestionTransaction())
      ->setTransactionType(PonderQuestionContentTransaction::TRANSACTIONTYPE)
      ->setNewValue($content);

    $question = PonderQuestion::initializeNewQuestion($author);

    $editor = id(new PonderQuestionEditor())
      ->setActor($author)
      ->setContentSource($content_source)
      ->setContinueOnNoEffect(true);
    $xactions = $editor->applyTransactions($question, $xactions);

And it correctly created a Ponder question with "ASD" as title and "LOL" as content.

This revision is now accepted and ready to land.May 18 2024, 18:51