Skip to content

fix: enable targeted notifications for auto-created bounties#3280

Open
jeevan6996 wants to merge 2 commits intoResearchHub:mainfrom
jeevan6996:fix/auto-bounty-targeted-notifications
Open

fix: enable targeted notifications for auto-created bounties#3280
jeevan6996 wants to merge 2 commits intoResearchHub:mainfrom
jeevan6996:fix/auto-bounty-targeted-notifications

Conversation

@jeevan6996
Copy link
Copy Markdown

@jeevan6996 jeevan6996 commented Apr 7, 2026

Summary

Wires targeted bounty notifications into the /api/bounty/ create path so bounties created through the generic bounty endpoint can notify qualified users when target_hub_ids are provided.

Closes ResearchHub/issues#260

What changed

  • BountyViewSet.create now accepts target_hub_ids from request data
  • uses existing find_qualified_users_and_notify task/pipeline after bounty creation
  • mirrors the behavior already present in create_comment_with_bounty
  • adds test coverage for notification creation when targeted hubs are passed

Files

  • src/reputation/views/bounty_view.py
  • src/reputation/tests/test_bounties.py

Checks run

  • python3 -m py_compile reputation/views/bounty_view.py reputation/tests/test_bounties.py

Checks attempted but blocked by environment

  • python3 manage.py test reputation.tests.test_bounties.BountyViewTests.test_user_can_create_bounty_with_targeted_notifications --keepdb
    • blocked: Django dependencies are not installed in this environment (ModuleNotFoundError: No module named 'django')

Note

Medium Risk
Changes the bounty creation request handling and introduces conditional synchronous/asynchronous notification dispatch, which could affect API behavior and notification volume if misconfigured.

Overview
POST /api/bounty/ now accepts target_hub_ids and, after creating the bounty, triggers the existing find_qualified_users_and_notify pipeline to send BOUNTY_FOR_YOU notifications to qualified users (excluding the creator). In TESTING it runs inline; otherwise it dispatches the Celery task asynchronously.

Adds test coverage to verify notifications are created when target_hub_ids are provided and that no targeted notifications are sent when they’re omitted.

Reviewed by Cursor Bugbot for commit f6deed8. Bugbot is set up for automated code reviews on this repo. Configure here.

@jeevan6996 jeevan6996 requested a review from a team as a code owner April 7, 2026 07:27
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 12240d0. Configure here.

Comment thread src/reputation/views/bounty_view.py Outdated
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 9, 2026

@jeevan6996
Copy link
Copy Markdown
Author

Implemented the requested behavior change and pushed updates. Notifications are now sent only when target_hub_ids are provided (if target_hubs guard), and I added a regression test to assert no BOUNTY_FOR_YOU notification is created when target_hub_ids is omitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Targeted notification on auto-created bounties

1 participant