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

Temporary change to integration page #279

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions recipes/VideoBots.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os.path
import typing

from django.db.models import QuerySet
from django.db.models import QuerySet, Q
from furl import furl
from pydantic import BaseModel, Field

Expand Down Expand Up @@ -972,11 +972,11 @@ def render_selected_tab(self, selected_tab):
unsafe_allow_html=True,
)

st.write("---")
st.text_input(
"###### 🤖 [Landbot](https://landbot.io/) URL", key="landbot_url"
)
show_landbot_widget()
# st.write("---")
# st.text_input(
# "###### 🤖 [Landbot](https://landbot.io/) URL", key="landbot_url"
# )
# show_landbot_widget()

def messenger_bot_integration(self):
from routers.facebook_api import ig_connect_url, fb_connect_url
Expand Down Expand Up @@ -1025,15 +1025,28 @@ def messenger_bot_integration(self):

st.button("🔄 Refresh")

current_run, published_run = self.get_runs_from_query_params(
*extract_query_params(gooey_get_query_params())
) # type: ignore

integrations_q = Q(billing_account_uid=self.request.user.uid)

# show admins all the bots connected to the current run
if self.is_current_user_admin():
integrations_q |= Q(saved_run=current_run)
if published_run:
integrations_q |= Q(
saved_run__example_id=published_run.published_run_id
)
integrations_q |= Q(published_run=published_run)

integrations: QuerySet[BotIntegration] = BotIntegration.objects.filter(
billing_account_uid=self.request.user.uid
integrations_q
).order_by("platform", "-created_at")

if not integrations:
return

current_run, published_run = self.get_runs_from_query_params(
*extract_query_params(gooey_get_query_params())
)
for bi in integrations:
is_connected = (bi.saved_run == current_run) or (
(
Expand Down
Loading