-
-
Notifications
You must be signed in to change notification settings - Fork 3
Webhook Support for New World Records #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds Discord webhook notifications and an admin test interface for world record events.
- Prevents horizontal overflow in the base template and enforces navbar wrapping rules.
- Introduces an
admin_requireddecorator, awebhook_testview, URL routing, and a test page for Discord webhooks. - Implements
send_world_record_webhookandtest_world_record_webhookinhighscores/lib.pyand hooks intoapprove_score.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| home/templates/home/base.html | Added CSS to prevent horizontal overflow and force navbar nowrap. |
| highscores/views.py | Added admin_required decorator and webhook_test admin view. |
| highscores/urls.py | Registered the webhook_test/ endpoint. |
| highscores/templates/highscores/webhook_test.html | Created admin UI for sending test webhooks. |
| highscores/lib.py | Added webhook-sending functions and integrated them into score approval. |
Comments suppressed due to low confidence (2)
highscores/lib.py:120
- The
loggingmodule is used here but not imported; addimport loggingat the top to avoid aNameError.
logging.error(f"Discord webhook failed with status: {response.status}")
highscores/urls.py:14
- [nitpick] Indentation is inconsistent with other routes in
urlpatterns; align this line with the others for readability.
path('webhook-test/', views.webhook_test, name='webhook-test'),
|
|
||
|
|
||
| def admin_required(view_func): | ||
| """Custom decorator to require admin access (staff or superuser)""" |
Copilot
AI
Jun 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use functools.wraps on the wrapper to preserve the original view function's metadata (name, docstring, etc.).
| """Custom decorator to require admin access (staff or superuser)""" | |
| """Custom decorator to require admin access (staff or superuser)""" | |
| @functools.wraps(view_func) |
…mport what you need
NicholasBottone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
@NicholasBottone probably good to merge if you think is good, need to put the webhook url in prod env vars. I did notice the test is failing now for the home page, but I don't really understand why. The text it's looking for is still the same. |
Adds support to send notifications when a world record is set to a discord web hook.