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

Reuse integrations from across apps #712

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Reuse integrations from across apps #712

wants to merge 5 commits into from

Conversation

gitstart-app[bot]
Copy link
Contributor

@gitstart-app gitstart-app bot commented Jan 3, 2025

@gitstart-tramline
Copy link

Hi @kitallis, PR is ready for review.

Copy link
Member

@kitallis kitallis left a comment

Choose a reason for hiding this comment

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

Mostly looks good, I think the UI needs work, but I'll take over fixing that in a separate PR. I've left a couple of suggestions.

@@ -201,6 +201,11 @@ def existing_integration(app, providable_type)
app.integrations.connected.find_by(providable_type: providable_type)
end

# This method retrieves a list of existing integrations for apps within the same organization
def existing_integrations_across_app(app, providable_type)
Integration.connected.where(integrable_id: app.organization.apps.where.not(id: app.id), providable_type: providable_type).select("DISTINCT ON (providable_id, integrable_id) id, providable_id, integrable_id, providable_type, created_at, updated_at, metadata, integrable_type")
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: let's change the DISTINCT ON to do DISTINCT ON (providable_id, integrable_id) id, * so we don't have to keep this query updated as new columns are added.

Choose a reason for hiding this comment

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

sure

@@ -17,6 +18,18 @@ def index
set_integrations_by_categories
end

# This method handles the process of reusing an existing app integration to create a new one
# Attempts to create a new integration based on the existing one across app
def reuse_integration_across_app
Copy link
Member

Choose a reason for hiding this comment

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

suggestion: I think we can use the reuse action here, afaict, they do the same thing; we don't need a separate route for it.

Choose a reason for hiding this comment

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

Sure. We will make the changes and get back to you.

@gitstart-app gitstart-app bot marked this pull request as draft January 6, 2025 12:36
@gitstart-app gitstart-app bot marked this pull request as ready for review January 7, 2025 12:13
@gitstart-tramline
Copy link

Hi @kitallis, requested changes have been addressed. Please review

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.

2 participants