Add the comment inline suggestion to the transaction.search conduit endpoint#28
Conversation
…ndpoint It was mentioned that this doesn't exist in this API endpoint at the moment. It would be very helpful, so let's add it
| ); | ||
| } else { | ||
| $inline_suggestion = null; | ||
| $comment_state = $comment->getContentState(); |
There was a problem hiding this comment.
We may need to check first if comment is an instance of PhabricatorInlineCommentInterface, instantiate a newInlineCommentObject(), on which we can then call getContentState() and do if getContentHasSuggestion()... ; i'd need to test this locally and see what the api returns for other objects with comments (it may complain about missing getContentState(), but I may be wrong)
I'm rusty on this, so take it with 2 pinches of salt: not all PhabricatorApplicationTransactionComments may implement getContentState()
~/src/phorge$ cat src/applications/differential/storage/DifferentialTransactionComment.php | grep -B 1 -A 2 getContentState
return $this->newInlineCommentObject()
->getContentState()
->isEmptyContentState();
}
(I suspect comments are rows from the db,
~/src/phorge$ cat src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php | grep -A4 PhabricatorApplicationTransactionComment
abstract class PhabricatorApplicationTransactionComment
extends PhabricatorLiskDAO
implements
<..>
```)
There was a problem hiding this comment.
Ah yeah, might not be right with the PhabricatorInlineComment type here, especially if we're looking at a non-differential object, hmm
…ifferential comment and grab inline suggestions
It was mentioned that this doesn't exist in this API endpoint at the moment. It would be very helpful, so let's add it!
Here's the method to fetch the inline suggestion:
https://github.com/thought-machine/phorge/blob/tm-master/src/infrastructure/diff/inline/PhabricatorDiffInlineCommentContentState.php#L28
And here's the method to get that comment state:
https://github.com/thought-machine/phorge/blob/tm-master/src/infrastructure/diff/interface/PhabricatorInlineComment.php#L362
I'm not able to test locally, but we can test this on our dev environment after landing (or before if we want to deploy from a fork)