Page MenuHomePhorge

Fix PonderQuestionCreateMailReceiver accessing non-existing PonderQuestionTransaction constants
ClosedPublic

Authored by aklapper on May 17 2024, 09:20.
Tags
None
Referenced Files
F3295877: D25656.1742962904.diff
Tue, Mar 25, 04:21
F3294094: D25656.1742929300.diff
Mon, Mar 24, 19:01
F3249524: D25656.1742286452.diff
Mon, Mar 17, 08:27
F3225493: D25656.1742121282.diff
Sat, Mar 15, 10:34
F3220655: D25656.1741811426.diff
Tue, Mar 11, 20:30
F3216824: D25656.1741716485.diff
Mon, Mar 10, 18:08
F3178731: D25656.1741312573.diff
Thu, Mar 6, 01:56
F2999481: D25656.1740426837.diff
Sun, Feb 23, 19:53

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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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