[WIKI-338] regression: adding back LIVE_URL #3125
This commit is contained in:
@@ -67,10 +67,10 @@ def sync_with_external_service(entity_name, description_html):
|
||||
"description_html": description_html,
|
||||
"variant": "rich" if entity_name == "PAGE" else "document",
|
||||
}
|
||||
if not settings.LIVE_URL:
|
||||
return {}
|
||||
response = requests.post(
|
||||
f"{settings.LIVE_URL}/convert-document/",
|
||||
json=data,
|
||||
headers=None,
|
||||
f"{settings.LIVE_URL}/convert-document/", json=data, headers=None
|
||||
)
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
|
||||
@@ -76,7 +76,9 @@ def nested_page_update(
|
||||
|
||||
if action == PageAction.ARCHIVED:
|
||||
Page.objects.filter(id__in=descendants_ids).update(
|
||||
archived_at=timezone.now(), updated_at=timezone.now(), updated_by=user_id
|
||||
archived_at=timezone.now(),
|
||||
updated_at=timezone.now(),
|
||||
updated_by=user_id,
|
||||
)
|
||||
UserFavorite.objects.filter(
|
||||
entity_type="page",
|
||||
@@ -86,19 +88,29 @@ def nested_page_update(
|
||||
).delete(soft=False)
|
||||
|
||||
elif action == PageAction.UNARCHIVED:
|
||||
Page.objects.filter(id__in=descendants_ids).update(archived_at=None, updated_at=timezone.now(), updated_by=user_id)
|
||||
Page.objects.filter(id__in=descendants_ids).update(
|
||||
archived_at=None, updated_at=timezone.now(), updated_by=user_id
|
||||
)
|
||||
|
||||
elif action == PageAction.LOCKED:
|
||||
Page.objects.filter(id__in=descendants_ids).update(is_locked=True, updated_at=timezone.now(), updated_by=user_id)
|
||||
Page.objects.filter(id__in=descendants_ids).update(
|
||||
is_locked=True, updated_at=timezone.now(), updated_by=user_id
|
||||
)
|
||||
|
||||
elif action == PageAction.UNLOCKED:
|
||||
Page.objects.filter(id__in=descendants_ids).update(is_locked=False, updated_at=timezone.now(), updated_by=user_id)
|
||||
Page.objects.filter(id__in=descendants_ids).update(
|
||||
is_locked=False, updated_at=timezone.now(), updated_by=user_id
|
||||
)
|
||||
|
||||
elif action == PageAction.MADE_PUBLIC:
|
||||
Page.objects.filter(id__in=descendants_ids).update(access=0, updated_at=timezone.now(), updated_by=user_id)
|
||||
Page.objects.filter(id__in=descendants_ids).update(
|
||||
access=0, updated_at=timezone.now(), updated_by=user_id
|
||||
)
|
||||
|
||||
elif action == PageAction.MADE_PRIVATE:
|
||||
Page.objects.filter(id__in=descendants_ids).update(access=1, updated_at=timezone.now(), updated_by=user_id)
|
||||
Page.objects.filter(id__in=descendants_ids).update(
|
||||
access=1, updated_at=timezone.now(), updated_by=user_id
|
||||
)
|
||||
|
||||
elif action == PageAction.PUBLISHED:
|
||||
# remove the page ids which are already published from the array
|
||||
@@ -157,8 +169,7 @@ def nested_page_update(
|
||||
elif action == PageAction.DUPLICATED:
|
||||
old_to_new_page_mapping = {}
|
||||
pages_to_duplicate = Page.objects.filter(
|
||||
id__in=descendants_ids + [page_id],
|
||||
workspace__slug=slug,
|
||||
id__in=descendants_ids + [page_id], workspace__slug=slug
|
||||
)
|
||||
|
||||
# First, duplicate all pages without setting parent_id
|
||||
@@ -233,20 +244,30 @@ def nested_page_update(
|
||||
if new_project_id:
|
||||
# Update the project id for the project pages
|
||||
ProjectPage.objects.filter(page_id__in=descendants_ids).update(
|
||||
project_id=new_project_id, updated_at=timezone.now(), updated_by=user_id
|
||||
project_id=new_project_id,
|
||||
updated_at=timezone.now(),
|
||||
updated_by=user_id,
|
||||
)
|
||||
|
||||
# Update the project id for the file assets
|
||||
FileAsset.objects.filter(
|
||||
page_id__in=descendants_ids, project_id=project_id
|
||||
).update(project_id=new_project_id, updated_at=timezone.now(), updated_by=user_id)
|
||||
).update(
|
||||
project_id=new_project_id,
|
||||
updated_at=timezone.now(),
|
||||
updated_by=user_id,
|
||||
)
|
||||
|
||||
# Update the project id for the deploy board
|
||||
DeployBoard.objects.filter(
|
||||
entity_identifier__in=descendants_ids,
|
||||
entity_name="page",
|
||||
project_id=project_id,
|
||||
).update(project_id=new_project_id, updated_at=timezone.now(), updated_by=user_id)
|
||||
).update(
|
||||
project_id=new_project_id,
|
||||
updated_at=timezone.now(),
|
||||
updated_by=user_id,
|
||||
)
|
||||
|
||||
# Background job to handle favorites
|
||||
for descendant_id in descendants_ids:
|
||||
@@ -288,6 +309,9 @@ def nested_page_update(
|
||||
"data": data,
|
||||
}
|
||||
|
||||
if not settings.LIVE_URL:
|
||||
return
|
||||
|
||||
response = requests.post(
|
||||
f"{settings.LIVE_URL}/broadcast/",
|
||||
json=payload,
|
||||
|
||||
@@ -360,7 +360,12 @@ APP_BASE_URL = os.environ.get("APP_BASE_URL", None)
|
||||
APP_BASE_PATH = os.environ.get("APP_BASE_PATH", None)
|
||||
|
||||
LIVE_BASE_URL = os.environ.get("LIVE_BASE_URL", None)
|
||||
LIVE_BASE_PATH = os.environ.get("LIVE_BASE_PATH", None)
|
||||
LIVE_BASE_PATH = os.environ.get("LIVE_BASE_PATH", "")
|
||||
|
||||
if LIVE_BASE_URL:
|
||||
LIVE_URL = f"{LIVE_BASE_URL}{LIVE_BASE_PATH}"
|
||||
else:
|
||||
LIVE_URL = None
|
||||
|
||||
SILO_BASE_URL = os.environ.get("SILO_BASE_URL", None)
|
||||
SILO_BASE_PATH = os.environ.get("SILO_BASE_PATH", None)
|
||||
|
||||
Reference in New Issue
Block a user