fix: fix inIframe query param for discussion MFE link (#30846)
Co-authored-by: SaadYousaf <saadyousaf@A006-00314.local>
This commit is contained in:
@@ -16,7 +16,8 @@ from openedx.core.djangolib.js_utils import js_escaped_string
|
||||
const mfeUrl = (new URL("${discussions_mfe_url | n, js_escaped_string}"));
|
||||
const iframe = document.querySelector('#discussions-mfe-tab-embed');
|
||||
let timestamp = "?no-cache=" + Date.now();
|
||||
iframe.src = mfeUrl.href + window.location.hash.slice(1) + timestamp;
|
||||
let showInIframe = "&inIframe=" + "${show_in_iframe | n, js_escaped_string}";
|
||||
iframe.src = mfeUrl.href + window.location.hash.slice(1) + timestamp + showInIframe;
|
||||
window.addEventListener("message", (event) => {
|
||||
const payload = event.data.payload;
|
||||
if (event.origin !== mfeUrl.origin) {
|
||||
|
||||
@@ -52,7 +52,7 @@ from lms.djangoapps.discussion.toggles import (
|
||||
ENABLE_DISCUSSIONS_MFE,
|
||||
ENABLE_DISCUSSIONS_MFE_FOR_EVERYONE,
|
||||
ENABLE_DISCUSSIONS_MFE_BANNER,
|
||||
)
|
||||
ENABLE_VIEW_MFE_IN_IFRAME)
|
||||
from lms.djangoapps.experiments.utils import get_experiment_user_metadata_context
|
||||
from lms.djangoapps.teams import api as team_api
|
||||
from openedx.core.djangoapps.discussions.url_helpers import get_discussions_mfe_url
|
||||
@@ -789,6 +789,7 @@ def _discussions_mfe_context(query_params: Dict,
|
||||
"course_key": course_key,
|
||||
"show_banner": enable_mfe and (is_privileged or ENABLE_DISCUSSIONS_MFE_BANNER.is_enabled()),
|
||||
"discussions_mfe_url": mfe_url,
|
||||
"show_in_iframe": ENABLE_VIEW_MFE_IN_IFRAME.is_enabled(),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@ from urllib.parse import urlencode
|
||||
from django.conf import settings
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from lms.djangoapps.discussion.toggles import ENABLE_VIEW_MFE_IN_IFRAME
|
||||
|
||||
|
||||
def _get_url_with_view_query_params(path: str, view: Optional[str] = None) -> str:
|
||||
"""
|
||||
@@ -30,9 +28,6 @@ def _get_url_with_view_query_params(path: str, view: Optional[str] = None) -> st
|
||||
if view == "in_context":
|
||||
query_params.update({'inContext': True})
|
||||
|
||||
if ENABLE_VIEW_MFE_IN_IFRAME.is_enabled():
|
||||
query_params.update({'inIframe': True})
|
||||
|
||||
if query_params:
|
||||
url = f"{url}?{urlencode(query_params)}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user