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

feat: [AXIMST-410] add possibility to fetch draft item #2497

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

ruzniaievdm
Copy link

@ruzniaievdm ruzniaievdm force-pushed the ruzniaievdm/feat/xblock-preview-cms branch 3 times, most recently from eae2828 to 3fdcce7 Compare January 30, 2024 15:31
@ruzniaievdm ruzniaievdm marked this pull request as ready for review January 30, 2024 16:29
@ruzniaievdm ruzniaievdm changed the title feat: [AXIMST-410] Create new CMS endpoint for xblocks feat: [AXIMST-410] add possibility to fetch draft item Jan 30, 2024
@ruzniaievdm ruzniaievdm self-assigned this Jan 30, 2024
@@ -1536,6 +1536,7 @@ def render_xblock(request, usage_key_string, check_if_enrolled=True, disable_sta
set_custom_attribute('block_type', usage_key.block_type)

requested_view = request.GET.get('view', 'student_view')
allow_render_for_mfe = request.GET.get('allow_render_for_mfe')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
allow_render_for_mfe = request.GET.get('allow_render_for_mfe')
is_authoring_mfe = request.GET.get('is_authoring_mfe')

Copy link

@ihor-romaniuk ihor-romaniuk Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change as suggested by Vlad

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to is_authoring_mfe

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added corresponding changes to MFE raccoongang/frontend-app-course-authoring#151

@ruzniaievdm ruzniaievdm force-pushed the ruzniaievdm/feat/xblock-preview-cms branch from 0ba89ce to f15754b Compare February 2, 2024 15:58
@ruzniaievdm ruzniaievdm force-pushed the ruzniaievdm/feat/xblock-preview-cms branch 2 times, most recently from 659eb2b to 9c2b75a Compare February 6, 2024 16:51
@ruzniaievdm ruzniaievdm force-pushed the ruzniaievdm/feat/xblock-preview-cms branch from 9c2b75a to e579a92 Compare February 6, 2024 17:55
@GlugovGrGlib GlugovGrGlib merged commit e4b255c into ts-develop Feb 7, 2024
45 checks passed
# No request provided, cannot proceed
raise Http404 from exc

referer = request.META.get('HTTP_REFERER')
Copy link

@GlugovGrGlib GlugovGrGlib Feb 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach eventually not working on the dev server

HTTP_REFERER header doesn't contain /course-authoring path in it, only domain

request.META content from debug log:

2024-02-07 13:15:25,286 ERROR 402008 [lms.djangoapps.courseware.block_render] [user 19] [ip 143.244.46.119] block_render.py:837 - ++++++<WSGIRequest: GET '/xblock/block-v1:eDx+567657+2024+type@html+block@1ba5aef177a547b983c2e3fdede6c395?show_title=0&show_bookmark=0&recheck_access=1&view=student_view&is_authoring_mfe=1'>+++++
2024-02-07 13:15:25,288 ERROR 402008 [lms.djangoapps.courseware.block_render] [user 19] [ip 143.244.46.119] block_render.py:838 - ++++++{'wsgi.errors': <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f8e056e1b80>, 'wsgi.version': (1, 0), 'wsgi.multithread': False, 'wsgi.multiprocess': True, 'wsgi.run_once': False, 'wsgi.file_wrapper': <class 'gunicorn.http.wsgi.FileWrapper'>, 'wsgi.input_terminated': True, 'SERVER_SOFTWARE': 'gunicorn/21.2.0', 'wsgi.input': <gunicorn.http.body.Body object at 0x7f8e056c0b20>, 'gunicorn.socket': <socket.socket fd=20, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 8000), raddr=('127.0.0.1', 21968)>, 'REQUEST_METHOD': 'GET', 'QUERY_STRING': 'show_title=0&show_bookmark=0&recheck_access=1&view=student_view&is_authoring_mfe=1', 'RAW_URI': '/xblock/block-v1:eDx+567657+2024+type@html+block@1ba5aef177a547b983c2e3fdede6c395?show_title=0&show_bookmark=0&recheck_access=1&view=student_view&is_authoring_mfe=1', 'SERVER_PROTOCOL': 'HTTP/1.0', 'HTTP_X_FORWARDED_PROTO': 'https', 'HTTP_X_FORWARDED_PORT': '443', 'HTTP_X_FORWARDED_FOR': '143.244.46.119', 'HTTP_X_QUEUE_START': 't=1707311724.863', 'HTTP_HOST': 'lms-studio-mfe-dev.raccoongang.com', 'HTTP_CONNECTION': 'close', 'HTTP_X_REQUEST_ID': '56356f8e77b6ea1ab2a81587c49666b3', 'HTTP_X_REAL_IP': '143.244.46.119', 'HTTP_X_FORWARDED_HOST': 'lms-studio-mfe-dev.raccoongang.com', 'HTTP_X_FORWARDED_SCHEME': 'https', 'HTTP_X_SCHEME': 'https', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:124.0) Gecko/20100101 Firefox/124.0', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/jxl,image/webp,*/*;q=0.8', 'HTTP_ACCEPT_LANGUAGE': 'en;q=1.0, en;q=1.0', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate, br', 'HTTP_REFERER': 'https://app-studio-mfe-dev.raccoongang.com/', 'HTTP_UPGRADE_INSECURE_REQUESTS': '1', 'HTTP_SEC_FETCH_DEST': 'iframe', 'HTTP_SEC_FETCH_MODE': 'navigate', 'HTTP_SEC_FETCH_SITE': 'same-site', 'HTTP_PRAGMA': 'no-cache', 'HTTP_CACHE_CONTROL': 'no-cache', 'HTTP_COOKIE': 'openedx-language-preference=en; _ga_test=GS1.1.1706185997.45.0.1706185998.0.0.0; _ga=GA1.1.773444425.1698787115;
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants