-
Notifications
You must be signed in to change notification settings - Fork 15
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
base: main
Are you sure you want to change the base?
Conversation
Hi @kitallis, PR is ready for review. |
There was a problem hiding this 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.
app/models/integration.rb
Outdated
@@ -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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Hi @kitallis, requested changes have been addressed. Please review |
Reuse integrations across apps
Loom
https://www.loom.com/share/9028f0fc57834f13b549535f4b150b5a?sid=72f8c918-987e-419e-80ae-a5451ec29c13