Add Discord gig status updates#301
Conversation
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 51 minutes and 35 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR adds a Discord slash command to update gig engagement status with thread-title synchronization, enables dashboard notifications to route directly to specific gig detail views, and includes unit and integration tests validating both workflows. Build artifacts reflect the rebuilt dashboard bundle. ChangesDiscord Gig Status Update Command
Dashboard Notification Routing
Build Asset Updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
91aff75 to
ea35d47
Compare
There was a problem hiding this comment.
Pull request overview
Adds a Discord slash command to update a gig’s dashboard engagement status and synchronize the visible status marker in the corresponding Discord forum thread title, while also improving stale recruiting notifications in the admin dashboard.
Changes:
- Add
/update-gig-statusto update a gig’s engagement status (with permission checks) and rename the Discord thread title marker. - Update stale recruiting reminder copy and improve stale recruiting notifications to deep-link directly to the gig detail view.
- Extend unit/integration tests to cover the new permission logic, thread renaming behavior, and notification click-through.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_jobs.py | Adds unit coverage for gig status update permissions and thread title marker renaming. |
| tests/integration/test_dashboard_playwright.py | Updates dashboard integration test to validate stale recruiting notification navigation to gig detail. |
| apps/discord_bot/src/five08/discord_bot/cogs/jobs.py | Implements /update-gig-status, helper methods for authorization and thread renaming, and updates recruiting reminder text. |
| apps/api/src/five08/backend/static/dashboard/index.html | Updates bundled dashboard asset reference. |
| apps/api/src/five08/backend/static/dashboard/.vite/manifest.json | Updates Vite manifest entry to match new bundle output. |
| apps/admin_dashboard/src/main.tsx | Changes stale recruiting notification click handling to open gig detail directly when possible. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/discord_bot/src/five08/discord_bot/cogs/jobs.py (1)
3552-3554: 💤 Low valuePotential None dereference when checking poster permissions.
At line 3553,
post.starteris accessed within the_interaction_user_can_update_gig_threadcall, butpostis only checked forNonelater at line 3573. If_read_thread_postreturnsNone, this will raise anAttributeError.The code does handle
postbeingNonein the ternary (post.starter if post else None), soposter_idwill beNonein that case. The permission check then proceeds, allowing Steering Committee+ to pass even with aNoneposter_id, which may be intentional. However, ifpostisNoneand the user is not Steering Committee+, they'll be rejected with a "forbidden" error before seeing the more specific "Could not read the original gig post" message at line 3585.Consider reordering to check post availability before authorization so users get a clearer error message.
Suggested reorder
+ post = await self._read_thread_post(thread) + if post is None: + self._audit_command_safe( + interaction=interaction, + action="crm.update_gig_status", + result="error", + metadata={ + "stage": "starter_message_unavailable", + "status": normalized_status.value, + "guild_id": str(guild.id), + "thread_id": str(thread.id), + }, + ) + await interaction.response.send_message( + "❌ Could not read the original gig post for this thread.", + ephemeral=True, + ) + return + - post = await self._read_thread_post(thread) poster_id = self._thread_poster_id(thread, post.starter if post else None) + poster_id = self._thread_poster_id(thread, post.starter) if not self._interaction_user_can_update_gig_thread(interaction, poster_id): ... - - if post is None: - ...🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/discord_bot/src/five08/discord_bot/cogs/jobs.py` around lines 3552 - 3554, The code calls _read_thread_post and then immediately runs _interaction_user_can_update_gig_thread using post.starter (via poster_id), which can lead to a confusing forbidden error if post is None; reorder the logic so you first await _read_thread_post and if the returned post is None raise/return the "Could not read the original gig post" error before performing permission checks; update the poster_id calculation to use _thread_poster_id(thread, post.starter) only after confirming post is not None and then call _interaction_user_can_update_gig_thread(interaction, poster_id) to decide authorization.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/discord_bot/src/five08/discord_bot/cogs/jobs.py`:
- Around line 3552-3554: The code calls _read_thread_post and then immediately
runs _interaction_user_can_update_gig_thread using post.starter (via poster_id),
which can lead to a confusing forbidden error if post is None; reorder the logic
so you first await _read_thread_post and if the returned post is None
raise/return the "Could not read the original gig post" error before performing
permission checks; update the poster_id calculation to use
_thread_poster_id(thread, post.starter) only after confirming post is not None
and then call _interaction_user_can_update_gig_thread(interaction, poster_id) to
decide authorization.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 12785d58-9908-4b1d-b9c1-587f69c61e7d
📒 Files selected for processing (7)
apps/admin_dashboard/src/main.tsxapps/api/src/five08/backend/static/dashboard/.vite/manifest.jsonapps/api/src/five08/backend/static/dashboard/assets/index-DAy1pv-J.jsapps/api/src/five08/backend/static/dashboard/index.htmlapps/discord_bot/src/five08/discord_bot/cogs/jobs.pytests/integration/test_dashboard_playwright.pytests/unit/test_jobs.py
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 91aff75bf2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ea35d47 to
06468a1
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 06468a1757
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if thread.archived: | ||
| await thread.edit(archived=False, reason=reason) | ||
| await thread.edit(name=next_name, reason=reason) |
There was a problem hiding this comment.
Preserve archive state when renaming gig threads
When /update-gig-status runs on an archived forum thread, _rename_gig_thread_for_status always unarchives it before renaming and never restores the previous archived state. This means a status-only edit permanently reopens old threads (and can also leave them reopened even if the later rename call fails), which changes channel behavior beyond the requested status update.
Useful? React with 👍 / 👎.
Summary
/update-gig-statusfor registered gig forum threadsStatus input handling
Discord slash commands use fixed choices for the command input, which gives users an enum-like picker. The implementation still validates server-side and rejects unexpected statuses instead of accepting arbitrary values or adding enum fields from user input. That keeps dashboard reporting and thread title markers canonical while avoiding silent autocorrection to the wrong state.
Validation
uv run pytest tests/unit/test_jobs.py -quv run pytest tests/unit/test_discord_command_metadata.py -quv run pytest tests/integration/test_dashboard_playwright.py -q./scripts/lint.shbun run --cwd apps/admin_dashboard lintbun run --cwd apps/admin_dashboard typecheckbun run --cwd apps/admin_dashboard buildgit diff --checkSummary by CodeRabbit
Release Notes
New Features
Improvements
Tests