fix: delete webhook for issues, issue_comments, projects#6539
fix: delete webhook for issues, issue_comments, projects#6539sriramveeraghanta merged 3 commits intomakeplane:previewfrom
Conversation
|
Warning Rate limit exceeded@shuaixr has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 31 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, 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 the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
WalkthroughThe pull request introduces logging for deletion events via webhooks. In two project-related endpoints, a call to Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API
participant WebhookService
Client->>API: Request deletion of project
API->>API: Delete project record
API->>WebhookService: Call webhook_activity.delay(event, "deleted", actor, site, ...)
WebhookService->>WebhookService: If verb=="deleted"
WebhookService->>WebhookService: Prepare payload: {"id": event_id}
WebhookService-->>API: Process deletion webhook
sequenceDiagram
participant Client
participant IssueTask
Client->>IssueTask: Request deletion of comment (with JSON data)
IssueTask->>IssueTask: Parse JSON from requested_data (if present)
IssueTask->>IssueTask: Append activity with issue_comment_id
IssueTask-->>Client: Confirm deletion logging
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apiserver/plane/app/views/project/base.py (1)
465-477: Consider moving the webhook call after cleanup operations.While the webhook activity logging is correct, it should ideally be placed after all cleanup operations (DeployBoard and UserFavorite deletions) to ensure the webhook represents the complete deletion process.
Apply this diff to reorder the operations:
project = Project.objects.get(pk=pk) project.delete() - webhook_activity.delay( - event="project", - verb="deleted", - field=None, - old_value=None, - new_value=None, - actor_id=request.user.id, - slug=slug, - current_site=request.META.get("HTTP_ORIGIN"), - event_id=project.id, - old_identifier=None, - new_identifier=None, - ) # Delete the project members DeployBoard.objects.filter(project_id=pk, workspace__slug=slug).delete() # Delete the user favorite UserFavorite.objects.filter(project_id=pk, workspace__slug=slug).delete() + webhook_activity.delay( + event="project", + verb="deleted", + field=None, + old_value=None, + new_value=None, + actor_id=request.user.id, + slug=slug, + current_site=request.META.get("HTTP_ORIGIN"), + event_id=project.id, + old_identifier=None, + new_identifier=None, + )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apiserver/plane/api/views/project.py(2 hunks)apiserver/plane/app/views/project/base.py(2 hunks)apiserver/plane/bgtasks/issue_activities_task.py(1 hunks)apiserver/plane/bgtasks/webhook_task.py(1 hunks)
🔇 Additional comments (3)
apiserver/plane/api/views/project.py (1)
329-341: LGTM! Webhook activity is properly logged after project deletion.The webhook_activity call is correctly placed after the project deletion and includes all necessary parameters for tracking the deletion event.
apiserver/plane/bgtasks/webhook_task.py (1)
390-394: LGTM! Simplified event data for deletion events.The conditional event_data construction prevents attempts to access deleted model data by sending only the ID for deletion events. This is a robust solution that avoids potential errors when the model data is no longer available.
apiserver/plane/bgtasks/issue_activities_task.py (1)
741-741: LGTM! Properly tracking deleted comment IDs.The changes ensure that comment deletion activities include the comment ID, which helps maintain a proper audit trail of deleted comments. The JSON parsing is correctly added to access the comment_id from the requested data.
Also applies to: 744-744
The deletion webhook was not firing because it attempted to retrieve data after deletion, causing a failure. According to the webhook documentation https://developers.plane.so/webhooks/intro-webhooks, the delete event should only contain id, so the fix aligns with this expected behavior.
25d7bda to
26e2692
Compare
The delete issues comment webhook requires comment_id
26e2692 to
f04dc5d
Compare
) * fix: prevent error when triggering deletion webhook The deletion webhook was not firing because it attempted to retrieve data after deletion, causing a failure. According to the webhook documentation https://developers.plane.so/webhooks/intro-webhooks, the delete event should only contain id, so the fix aligns with this expected behavior. * fix: make delete_comment_activity include comment_id The delete issues comment webhook requires comment_id * fix: trigger webhook on project delete
Description
This PR fixes three issues:
Type of Change
References
close #6302
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes