groovecoder / discord

GitHub webhook that analyzes pull requests and adds comments about incompatible CSS
Mozilla Public License 2.0
29 stars 13 forks source link

Closing and re-opening a pull request causes double/triple commenting. #151

Closed groovecoder closed 8 years ago

groovecoder commented 9 years ago

STR:

  1. Create a PR with the hook enabled
  2. Close the PR
  3. Re-open the PR

Expected results: Only opening a PR should add a comment

Actual results: Closing the PR created another batch of line-by-line comments

Example: https://github.com/groovecoder/discord-test/pull/1

openjck commented 9 years ago

Thanks for the detailed STR! This might be related to #79.

Faeranne commented 9 years ago

opening and creating a PR both initiate the same API Action. We need to be tracking comments to fix this properly. I assume fixing #79 should make this issue go away, even though they are technically different issues. Going to leave this issue open in-case the fix is not enough.

groovecoder commented 8 years ago

@openjck and I thought a solution may be:

  1. Create a comments table in our shiny new postgres database
  2. Update the comment code to store a hash of the url, file name, line number, and line contents
  3. Before making a comment, make sure there isn't already a comment record with the same hash

That file name, line number, and line contents combination seems to be the same keys that GitHub uses to decide whether to collapse comments in the PR interface. But we can tweak the hash components as needed.

openjck commented 8 years ago

It sounds like this issue and #79 share the same underlying cause. We should never post the same comment twice. I'll update the language of #79 to be more general and call this a duplicate.