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

[FEATURE] Gorgias: New Ticket source - Add Tags prop for filtering tags #14130

Conversation

jcortes
Copy link
Collaborator

@jcortes jcortes commented Sep 27, 2024

WHY

Added new tagIds filter prop in Ticker Created source
Resolves #14108

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new property tagId for enhanced ticket management.
    • Added a new method listTags to facilitate tag retrieval.
    • Implemented a tagIds property to filter tickets by specific tag IDs in the ticket creation source.
  • Version Updates

    • Incremented version numbers for multiple components to reflect updates, including:
      • gorgias_oauth-create-customer: 0.0.4 → 0.0.5
      • gorgias_oauth-create-ticket: 0.0.5 → 0.0.6
      • gorgias_oauth-list-tickets: 0.0.5 → 0.0.6
      • gorgias_oauth-retrieve-customer: 0.0.4 → 0.0.5
      • gorgias_oauth-update-customer: 0.0.4 → 0.0.5
      • gorgias_oauth-update-ticket: 0.0.1 → 0.0.2
      • Package version for @pipedream/gorgias_oauth: 0.4.0 → 0.4.1
      • ticket-created: 0.1.5 → 0.1.6
      • ticket-message-created: 0.1.5 → 0.1.6
      • ticket-updated: 0.1.5 → 0.1.6

@jcortes jcortes added the enhancement New feature or request label Sep 27, 2024
@jcortes jcortes self-assigned this Sep 27, 2024
Copy link
Contributor

coderabbitai bot commented Sep 27, 2024

Walkthrough

The pull request introduces several version updates across various components of the Gorgias OAuth module, including actions for creating, updating, and retrieving customers and tickets. Notably, it adds a new property tagId and a method listTags in the main application file, enhancing functionality for tag management. Additionally, the ticket-created source is updated to include a tagIds property for filtering tickets by tags, addressing user requests for improved filtering capabilities.

Changes

File Change Summary
components/gorgias_oauth/actions/create-customer/create-customer.mjs Version updated from 0.0.4 to 0.0.5
components/gorgias_oauth/actions/create-ticket/create-ticket.mjs Version updated from 0.0.5 to 0.0.6
components/gorgias_oauth/actions/list-tickets/list-tickets.mjs Version updated from 0.0.5 to 0.0.6
components/gorgias_oauth/actions/retrieve-customer/retrieve-customer.mjs Version updated from 0.0.4 to 0.0.5
components/gorgias_oauth/actions/update-customer/update-customer.mjs Version updated from 0.0.4 to 0.0.5
components/gorgias_oauth/actions/update-ticket/update-ticket.mjs Version updated from 0.0.1 to 0.0.2
components/gorgias_oauth/gorgias_oauth.app.mjs Added tagId property and listTags method
components/gorgias_oauth/package.json Version updated from 0.4.0 to 0.4.1
components/gorgias_oauth/sources/ticket-created/ticket-created.mjs Added tagIds property and updated version from 0.1.5 to 0.1.6
components/gorgias_oauth/sources/ticket-message-created/ticket-message-created.mjs Version updated from 0.1.5 to 0.1.6
components/gorgias_oauth/sources/ticket-updated/ticket-updated.mjs Version updated from 0.1.5 to 0.1.6

Assessment against linked issues

Objective Addressed Explanation
Add the Tags prop for filtering tickets by tags (#[14108])

Possibly related PRs

Suggested labels

User submitted, ai-assisted

Suggested reviewers

  • GTFalcao
  • luancazarine

Poem

🐰 In the garden where the code does grow,
New tags and versions, watch them flow!
With each little hop, improvements we see,
Filtering tickets, as easy as can be!
A sprinkle of updates, a dash of delight,
Hooray for the changes, all shiny and bright! 🌼


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?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

Copy link

vercel bot commented Sep 27, 2024

@jcortes is attempting to deploy a commit to the Pipedreamers Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Sep 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
pipedream-docs ⬜️ Ignored (Inspect) Sep 27, 2024 4:28pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Sep 27, 2024 4:28pm

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (3)
components/gorgias_oauth/sources/ticket-created/ticket-created.mjs (2)

36-44: New tagIds property looks good, with a minor suggestion.

The new tagIds property is well-defined and aligns with the PR objective. The use of the base component's tagId prop definition ensures consistency.

Consider slightly modifying the description for clarity:

-      description: "The tag ids to filter tickets by.",
+      description: "The tag IDs to filter tickets by. Only tickets with at least one of these tags will be processed.",

This change provides users with a clearer understanding of how the filter works.


52-56: isRelevant method update looks good, with a minor optimization suggestion.

The addition of tag filtering to the isRelevant method is well-implemented and aligns with the PR objective. The logic correctly handles the new tagIds property while maintaining backwards compatibility.

Consider this minor optimization to avoid unnecessary tag ID mapping when this.tagIds is not provided:

-      const tagIds = ticket.tags.map(({ id }) => id);
       return (!this.channel || ticket.channel === this.channel)
         && (!this.via || ticket.via === this.via)
         && (!this.assigneeId || ticket?.assignee_user_id === this.assigneeId)
-        && (!this.tagIds || this.tagIds.some((tagId) => tagIds.includes(tagId)));
+        && (!this.tagIds || this.tagIds.some((tagId) => ticket.tags.some(tag => tag.id === tagId)));

This change avoids creating an unnecessary array when tag filtering is not being used, potentially improving performance for those cases.

components/gorgias_oauth/gorgias_oauth.app.mjs (1)

390-395: Ensure error handling in listTags method

The listTags method is correctly implemented to retrieve tags from the /tags endpoint. However, consider adding error handling to manage potential API request failures, such as network issues or invalid responses. This will enhance the robustness of your application.

You could modify the method as follows to include a try-catch block:

     listTags(opts = {}) {
+      try {
         return this._makeRequest({
           path: "/tags",
           ...opts,
         });
+      } catch (error) {
+        throw new Error(`Failed to list tags: ${error.message}`);
+      }
     },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 08b948b and 0c6c5b8.

📒 Files selected for processing (11)
  • components/gorgias_oauth/actions/create-customer/create-customer.mjs (1 hunks)
  • components/gorgias_oauth/actions/create-ticket/create-ticket.mjs (1 hunks)
  • components/gorgias_oauth/actions/list-tickets/list-tickets.mjs (1 hunks)
  • components/gorgias_oauth/actions/retrieve-customer/retrieve-customer.mjs (1 hunks)
  • components/gorgias_oauth/actions/update-customer/update-customer.mjs (1 hunks)
  • components/gorgias_oauth/actions/update-ticket/update-ticket.mjs (1 hunks)
  • components/gorgias_oauth/gorgias_oauth.app.mjs (2 hunks)
  • components/gorgias_oauth/package.json (1 hunks)
  • components/gorgias_oauth/sources/ticket-created/ticket-created.mjs (2 hunks)
  • components/gorgias_oauth/sources/ticket-message-created/ticket-message-created.mjs (1 hunks)
  • components/gorgias_oauth/sources/ticket-updated/ticket-updated.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (9)
  • components/gorgias_oauth/actions/create-customer/create-customer.mjs
  • components/gorgias_oauth/actions/create-ticket/create-ticket.mjs
  • components/gorgias_oauth/actions/list-tickets/list-tickets.mjs
  • components/gorgias_oauth/actions/retrieve-customer/retrieve-customer.mjs
  • components/gorgias_oauth/actions/update-customer/update-customer.mjs
  • components/gorgias_oauth/actions/update-ticket/update-ticket.mjs
  • components/gorgias_oauth/package.json
  • components/gorgias_oauth/sources/ticket-message-created/ticket-message-created.mjs
  • components/gorgias_oauth/sources/ticket-updated/ticket-updated.mjs
🔇 Additional comments (2)
components/gorgias_oauth/sources/ticket-created/ticket-created.mjs (2)

10-10: Version bump looks good.

The increment from 0.1.5 to 0.1.6 is appropriate for adding the new tag filtering feature. This change indicates a backwards-compatible update, which aligns with the nature of the modification.


Line range hint 1-76: Overall, the changes look good and meet the PR objectives.

The implementation successfully adds tag filtering capability to the Gorgias ticket source while maintaining backwards compatibility. The code is well-structured and aligns with the existing patterns in the file.

Key points:

  1. Version bump is appropriate.
  2. New tagIds property is well-defined.
  3. isRelevant method correctly implements tag filtering.

Consider the minor suggestions provided in the previous comments to further improve the code. Great job on implementing this feature!

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

LGTM!

@vunguyenhung vunguyenhung merged commit cb08b73 into PipedreamHQ:master Sep 30, 2024
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

[FEATURE] Gorgias: New Ticket source - Add Tags prop for filtering tags
3 participants