Skip to content
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

feat: keep manual comments working when commenting draft MRs #1177

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

paolomainardi
Copy link
Contributor

@paolomainardi paolomainardi commented Aug 26, 2024

User description

closes #1160


PR Type

Enhancement


Description

  • Removed the check for draft status in the GitLab webhook handler
  • Allows manual comments to be processed for both draft and non-draft merge requests
  • Improves user experience by enabling interaction with draft merge requests
  • Addresses issue Gitlab server should handle the draft status  #1160

Changes walkthrough 📝

Relevant files
Enhancement
gitlab_webhook.py
Enable manual comments on draft merge requests                     

pr_agent/servers/gitlab_webhook.py

  • Removed code that skipped processing draft merge requests
  • Enabled manual comments to work on draft merge requests
  • +1/-5     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @codiumai-pr-agent-pro codiumai-pr-agent-pro bot added the enhancement New feature or request label Aug 26, 2024
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🏅 Score: 95
    🧪 No relevant tests
    🔒 No security concerns identified
    🔀 No multiple PR themes
    ⚡ No key issues to review

    Copy link
    Contributor

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Improve error handling when accessing nested dictionary keys

    Consider handling potential KeyError exceptions when accessing nested dictionary
    keys using the get() method with a default value.

    pr_agent/servers/gitlab_webhook.py [143-145]

    -body = data.get('object_attributes', {}).get('note')
    -if data.get('object_attributes', {}).get('type') == 'DiffNote' and '/ask' in body: # /ask_line
    +body = data.get('object_attributes', {}).get('note', '')
    +if data.get('object_attributes', {}).get('type') == 'DiffNote' and body and '/ask' in body: # /ask_line
         body = handle_ask_line(body, data)
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: The suggestion improves robustness by handling potential KeyError exceptions, which is a good practice for working with nested dictionaries.

    7

    @mrT23 mrT23 merged commit 53a974c into Codium-ai:main Aug 26, 2024
    2 checks passed
    @paolomainardi
    Copy link
    Contributor Author

    Thanks @mrT23

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    Gitlab server should handle the draft status
    2 participants