Scenario 1
Steps to replicate the issue:
- Create an event with contribution tracking enabled
- Make an edit somewhere, choose NOT to associate it with the event
- Go to the contribution tab for that event in Special:EventDetails
- Open the dialog to add a contribution
- Paste the revision ID of the edit you previously made
- Click "Add edit" multiple times quickly
What happens?:
Multiple requests to associate the edit will be sent, once for every click. These result in a database error like the following:
Error 19 from MediaWiki\Extension\CampaignEvents\EventContribution\EventContributionStore::saveEventContribution, UNIQUE constraint failed: ce_event_contributions.cec_wiki, ce_event_contributions.cec_revision_id INSERT INTO "ce_event_contributions" ...
What should have happened instead?:
No uncaught DB error.
Scenario 2
Same as scenario 1, but for two different events at the same time. (Needs separate handling because job deduplication alone wouldn't fix this)