Page MenuHomePhabricator

Make the default behavior of getApplicationTransactionCommentObject() "return null" instead of "throw"
ClosedPublic

Authored by epriestley on Feb 7 2019, 3:43 AM.
Tags
None
Referenced Files
F19049460: D20121.diff
Thu, Nov 27, 5:20 PM
F18968758: D20121.diff
Sat, Nov 15, 4:07 AM
F18849523: D20121.id.diff
Oct 30 2025, 10:27 AM
F18847358: D20121.diff
Oct 30 2025, 12:14 AM
F18846577: D20121.diff
Oct 29 2025, 7:49 PM
F18845810: D20121.id48057.diff
Oct 29 2025, 2:30 PM
F18842283: D20121.id48036.diff
Oct 28 2025, 2:40 PM
F18799290: D20121.id48036.diff
Oct 17 2025, 1:04 PM
Subscribers

Details

Summary

Depends on D20115. See https://discourse.phabricator-community.org/t/transaction-search-endpoint-does-not-work-on-differential-diffs/2369/.

Currently, getApplicationTransactionCommentObject() throws by default. Subclasses must override it to return null to indicate that they don't support comments.

This is silly, and leads to a bunch of code that does a try / catch around it, and at least some code (here, transaction.search) which doesn't try / catch and gets the wrong behavior as a result.

Just make it return null by default, meaning "no support for comments". Then remove the try / catch stuff and all the return null implementations.

Test Plan
  • Grepped for getApplicationTransactionCommentObject(), fixed each callsite / definition.
  • Called transaction.search on a diff with transactions (i.e., not a sourced-from-commit diff).

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

src/applications/transactions/storage/PhabricatorApplicationTransaction.php
79

This is the culprit responsible for this mess.

This revision is now accepted and ready to land.Feb 7 2019, 8:47 PM
This revision was automatically updated to reflect the committed changes.