From c48933b9f973dd3306208dd508818210c75490d7 Mon Sep 17 00:00:00 2001 From: muhammadali124 <109604645+muhammadali124@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:39:10 +0500 Subject: [PATCH] fix chatly cookie (#558) --- openedx/features/edly/chatly_helpers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openedx/features/edly/chatly_helpers.py b/openedx/features/edly/chatly_helpers.py index be5f1e5d2d88..eb21edc5142b 100644 --- a/openedx/features/edly/chatly_helpers.py +++ b/openedx/features/edly/chatly_helpers.py @@ -35,14 +35,15 @@ def get_chatly_token_from_cookie(request): chatly_token: string """ + eval_string = "None" if CHATLY_COOKIE_NAME in request.COOKIES: chatly_token = request.COOKIES[CHATLY_COOKIE_NAME] - eval_string = "None" else: chatly_token = obtain_token_from_chatly() - eval_string = ( - f'response.set_cookie({CHATLY_COOKIE_NAME}, chatly_token, max_age=604600)' - ) + if chatly_token: + eval_string = ( + f'response.set_cookie("{CHATLY_COOKIE_NAME}", chatly_token, max_age=604600)' + ) return eval_string, chatly_token