etcinit / phabulous

A Phabricator bot for Slack
MIT License
218 stars 47 forks source link

Posts about adding a comment (and other task ops?) should include comment as slack "attachment" #14

Closed donaldguy closed 5 years ago

donaldguy commented 8 years ago

As it stands I find "added a comment" messages more annoying than helpful. I think this would just be a regex match (or maybe not depending whats in the webhook payload - is there docs on that?), a conduit fetch and a little refactor to FeedPost to use the Attachments field of the PostMessageParameters.

I might get you a PR for this in the medium-distant future. But if you wanna implement first that's cool too :smile:

dvcrn commented 8 years ago

Giving my +1 on this one

grrrreg commented 8 years ago

Me too +1

jaapdeheer commented 7 years ago

+1 here.

In case it's useful to anyone, I did some digging on what this would require:

The incoming webhook payload does not contain any reference to comments. It does however include an objectPHID (id of the task/revision/... in question) as storyData[objectPHID], and 1 or more transactionPHIDs in storyData[transactionPHIDs]. Those transactionPHIDs (or, the transactions they refer to) are the comments in question, one transaction per comment. (So if there's a bunch of inline comments on a revision, for example, that's one story with a number of transactions, one per inline comment and one for the general comment.)

I couldn't find an API method for looking up those transactionPHIDs directly, but if you call transaction.search with the storyData[objectPHID], you'll get a list of transactions back, including the transaction(s) in question. These contain the comment text.

So, it doesn't seem like this should be too difficult - just a call to transaction.search to look up the comments. I don't have time for it in the foreseeable future though, so if anyone else does... :)