Page MenuHomePhorge

Fix PonderQuestionCreateMailReceiver accessing non-existing PonderQuestionTransaction constants
ClosedPublic

Authored by aklapper on May 17 2024, 09:20.
Tags
None
Referenced Files
F2963626: D25656.1739215826.diff
Sun, Feb 9, 19:30
F2948051: D25656.1738528837.diff
Sat, Feb 1, 20:40
F2944559: D25656.1738273084.diff
Wed, Jan 29, 21:38
F2938395: D25656.1737994455.diff
Sun, Jan 26, 16:14
F2938300: D25656.1737993891.diff
Sun, Jan 26, 16:04
F2933018: D25656.1737750934.diff
Thu, Jan 23, 20:35
F2933016: D25656.1737750932.diff
Thu, Jan 23, 20:35
F2932937: D25656.1737746986.diff
Thu, Jan 23, 19:29

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