Skip to content

[WEB-4435] bug: trigger event for work item comment#7331

Merged
sriramveeraghanta merged 1 commit intopreviewfrom
fix-issue-comment-webhook-trigger
Jul 3, 2025
Merged

[WEB-4435] bug: trigger event for work item comment#7331
sriramveeraghanta merged 1 commit intopreviewfrom
fix-issue-comment-webhook-trigger

Conversation

@NarayanBavisetti
Copy link
Copy Markdown
Collaborator

@NarayanBavisetti NarayanBavisetti commented Jul 3, 2025

Description

this pull request fixes the issue where the webhook event was not being triggered when adding or updating work item comments.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Summary by CodeRabbit

  • New Features
    • Improved tracking of activity related to issue comments, both when creating and updating comments. This enhancement provides more comprehensive activity monitoring for users interacting with issue comments.

@NarayanBavisetti NarayanBavisetti requested a review from Copilot July 3, 2025 09:23
@NarayanBavisetti NarayanBavisetti linked an issue Jul 3, 2025 that may be closed by this pull request
1 task
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jul 3, 2025

Walkthrough

Asynchronous calls to a new model_activity.delay() task have been added to both the API and app layer views responsible for creating and updating issue comments. These calls are placed immediately after existing activity-tracking tasks, ensuring that model activity is now logged on both creation and update events. No other logic or method signatures were changed.

Changes

File(s) Change Summary
apps/server/plane/api/views/issue.py Added model_activity.delay() calls in post and patch methods of IssueCommentAPIEndpoint.
apps/server/plane/app/views/issue/comment.py Added model_activity.delay() calls after create and partial update in IssueCommentViewSet.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API_View
    participant App_View
    participant issue_activity (async)
    participant model_activity (async)

    Client->>API_View: POST/PATCH Issue Comment
    API_View->>issue_activity: Enqueue activity (async)
    API_View->>model_activity: Enqueue model activity (async)
    API_View->>Client: Return response

    Client->>App_View: Create/Update Issue Comment
    App_View->>issue_activity: Enqueue activity (async)
    App_View->>model_activity: Enqueue model activity (async)
    App_View->>Client: Return response
Loading

Poem

A rabbit hopped through code today,
And left some tasks along the way.
Now every comment, fresh or old,
Has its model story told.
Async logs will never tire—
Activity tracked, as teams require!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Pylint (3.3.7)
apps/server/plane/api/views/issue.py
apps/server/plane/app/views/issue/comment.py

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6f27ec0 and 860beba.

📒 Files selected for processing (2)
  • apps/server/plane/api/views/issue.py (2 hunks)
  • apps/server/plane/app/views/issue/comment.py (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
apps/server/plane/app/views/issue/comment.py (3)

21-21: LGTM: Correct import added for webhook functionality.

The import of model_activity from plane.bgtasks.webhook_task is properly placed and necessary for the webhook event triggering implementation.


94-103: LGTM: Well-implemented webhook event triggering for comment creation.

The model_activity.delay() call is correctly placed after the existing issue_activity.delay() call and uses appropriate parameters for webhook event processing. The parameters properly identify the comment model, pass the request data, and include necessary context.


138-147: LGTM: Proper webhook event triggering for comment updates.

The implementation correctly includes both the current instance state and request data, which is essential for webhook consumers to understand what changed. The parameter consistency with the create method is well maintained.

apps/server/plane/api/views/issue.py (2)

860-869: LGTM: Consistent webhook implementation in API layer for comment creation.

The model_activity.delay() call correctly mirrors the app layer implementation with consistent parameter usage. The placement ensures webhook events are triggered after successful comment creation and activity logging.


917-926: LGTM: Proper webhook event triggering for comment updates in API layer.

The implementation maintains consistency with both the app layer and the create method, properly including the current instance data for comprehensive webhook event information.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@makeplane
Copy link
Copy Markdown

makeplane bot commented Jul 3, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that a webhook event (model_activity) is triggered whenever a work item comment is created or updated.

  • Adds model_activity.delay calls to both the Django app view and the API view for comment create/update flows
  • Imports model_activity in the app view to enable the new calls

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/server/plane/app/views/issue/comment.py Imported model_activity and added calls to trigger the webhook on comment create/update
apps/server/plane/api/views/issue.py Added calls to trigger the webhook on comment create/update (ensure model_activity import)
Comments suppressed due to low confidence (2)

apps/server/plane/app/views/issue/comment.py:94

  • Consider adding or updating unit tests to verify that model_activity.delay is called with the correct parameters when comments are created or updated.
            # Send the model activity

apps/server/plane/api/views/issue.py:861

  • It looks like model_activity isn't imported in this file, which will cause a NameError at runtime. Please add from plane.bgtasks.webhook_task import model_activity at the top.
            model_activity.delay(

@sriramveeraghanta sriramveeraghanta merged commit 59919d3 into preview Jul 3, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-issue-comment-webhook-trigger branch July 3, 2025 09:36
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.

[bug]: Webhook for "Work item comments" is not firing after upgrade

4 participants