Skip to content

Commit 9f9f269

Browse files
committed
🚸(backend) update missing doc management in onboarding sandbox feature
Update _duplicate_onboarding_sandbox_document() to return immediately if the doc defined in settings can't be found.
1 parent c80e7d0 commit 9f9f269

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/backend/core/models.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -260,24 +260,25 @@ def _duplicate_onboarding_sandbox_document(self):
260260
try:
261261
template_document = Document.objects.get(id=sandbox_id)
262262

263-
sandbox_document = template_document.add_sibling(
264-
"right",
265-
title=template_document.title,
266-
content=template_document.content,
267-
attachments=template_document.attachments,
268-
duplicated_from=template_document,
269-
creator=self,
270-
)
271-
272-
DocumentAccess.objects.create(
273-
user=self, document=sandbox_document, role=RoleChoices.OWNER
274-
)
275-
276263
except Document.DoesNotExist:
277264
logger.warning(
278265
"Onboarding sandbox document with id %s does not exist. Skipping.",
279266
sandbox_id,
280267
)
268+
return
269+
270+
sandbox_document = template_document.add_sibling(
271+
"right",
272+
title=template_document.title,
273+
content=template_document.content,
274+
attachments=template_document.attachments,
275+
duplicated_from=template_document,
276+
creator=self,
277+
)
278+
279+
DocumentAccess.objects.create(
280+
user=self, document=sandbox_document, role=RoleChoices.OWNER
281+
)
281282

282283
def _convert_valid_invitations(self):
283284
"""

0 commit comments

Comments
 (0)