Reduce the amount of Reports a user can make#1194
Conversation
WalkthroughThis PR adds a pre-check in the Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🧬 Code graph analysis (1)django/thunderstore/api/cyberstorm/services/package_listing.py (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1194 +/- ##
=======================================
Coverage 92.81% 92.81%
=======================================
Files 337 337
Lines 10355 10359 +4
Branches 937 938 +1
=======================================
+ Hits 9611 9615 +4
Misses 617 617
Partials 127 127 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
django/thunderstore/api/cyberstorm/services/package_listing.py(1 hunks)django/thunderstore/api/cyberstorm/tests/services/test_package_listing_services.py(2 hunks)django/thunderstore/api/cyberstorm/tests/test_package_listing_actions.py(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
django/thunderstore/api/cyberstorm/tests/services/test_package_listing_services.py (4)
django/thunderstore/api/cyberstorm/services/package_listing.py (1)
report_package_listing(61-89)django/thunderstore/core/exceptions.py (1)
PermissionValidationError(4-7)django/thunderstore/ts_reports/models/package_report.py (1)
PackageReport(14-88)django/conftest.py (2)
user(116-121)active_package_listing(245-249)
django/thunderstore/api/cyberstorm/tests/test_package_listing_actions.py (2)
django/conftest.py (3)
user(116-121)TestUserTypes(566-601)get_user_by_type(580-601)django/thunderstore/api/cyberstorm/views/package_listing_actions.py (5)
post(56-71)post(84-101)post(114-130)post(142-161)post(173-180)
django/thunderstore/api/cyberstorm/services/package_listing.py (2)
django/thunderstore/ts_reports/models/package_report.py (1)
PackageReport(14-88)django/thunderstore/core/exceptions.py (1)
PermissionValidationError(4-7)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Analyze (javascript)
- GitHub Check: Analyze (python)
- GitHub Check: Build docker image
- GitHub Check: Build docker image
🔇 Additional comments (2)
django/thunderstore/api/cyberstorm/services/package_listing.py (1)
71-80: LGTM!The duplicate report check is correctly implemented. The logic filters for existing non-automated, active reports by the same user for the listing, and exempts superusers as intended. The error message is clear and user-friendly.
django/thunderstore/api/cyberstorm/tests/services/test_package_listing_services.py (1)
179-230: LGTM!Both tests are well-structured and comprehensive.
test_report_package_listing_successverifies the happy path, whiletest_report_package_listing_report_limitconfirms that duplicate reports are properly rejected and only a single report exists afterward.
|
This implementation is a bad idea. People frequently make reports with no reason, then make a second report later with an updated reason. Maybe make it so you can only have one report for a given reason and additional reports are updated and appended to the description? Or just leave things as they are, as any sort of spam is better addressed globally rather than on a per-object basis. |
Redeuce the amount of Reports a user can create per package listing to one with exception for superusers. Refs. TS-2742
783ebf9 to
90d4b14
Compare
I don’t have specific requirements for this yet, other than the need to restrict reports. The goal was to use this as a starting point for discussion and to further refine the task. You suggestion sounds like a good idea. |
Redeuce the amount of Reports a user can create per package listing to one with exception for superusers.
Refs. TS-2742