From f4c84f67a81e4bfb3303b2b43a41b14e4bfe9688 Mon Sep 17 00:00:00 2001 From: yonadavGit Date: Wed, 30 Oct 2024 14:44:33 +0200 Subject: [PATCH 1/3] fix(topic page): when redirecting to search, when no title for interface lang, use the other lang to get title --- static/js/TopicPage.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/TopicPage.jsx b/static/js/TopicPage.jsx index 6e237a9fda..edd4044b59 100644 --- a/static/js/TopicPage.jsx +++ b/static/js/TopicPage.jsx @@ -586,8 +586,10 @@ const TopicPage = ({ useEffect( ()=> { // hack to redirect to temporary sheet content on topics page for those topics that only have sheet content. if (!Sefaria.is_moderator && !topicData.isLoading && Object.keys(topicData.tabs).length == 0){ - const interfaceIsHe = Sefaria.interfaceLang === "hebrew" - const topicPath = interfaceIsHe ? topicTitle.he : topicTitle.en; + const interfaceIsHe = Sefaria.interfaceLang === "hebrew"; + const interfaceLang = interfaceIsHe ? 'he' : 'en'; + const coInterfaceLang = interfaceIsHe ? 'en' : 'he'; + const topicPath = topicTitle[interfaceLang] || topicTitle[coInterfaceLang]; const redirectUrl = `${document.location.origin}/search?q=${topicPath}&tab=sheet&tvar=1&tsort=relevance&stopics_${interfaceIsHe ? "he": "en"}Filters=${topicPath}&svar=1&ssort=relevance` window.location.replace(redirectUrl); } From 5f3fa95eeb3215c102f8a68bdb17277adfdea435 Mon Sep 17 00:00:00 2001 From: yonadavGit Date: Wed, 30 Oct 2024 16:01:52 +0200 Subject: [PATCH 2/3] fix(topic page): don't redirect author pages --- static/js/TopicPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/TopicPage.jsx b/static/js/TopicPage.jsx index edd4044b59..c9d3854320 100644 --- a/static/js/TopicPage.jsx +++ b/static/js/TopicPage.jsx @@ -585,7 +585,7 @@ const TopicPage = ({ useEffect( ()=> { // hack to redirect to temporary sheet content on topics page for those topics that only have sheet content. - if (!Sefaria.is_moderator && !topicData.isLoading && Object.keys(topicData.tabs).length == 0){ + if (!Sefaria.is_moderator && !topicData.isLoading && Object.keys(topicData.tabs).length == 0 .length == 0 && topicData.subclass != "author"){ const interfaceIsHe = Sefaria.interfaceLang === "hebrew"; const interfaceLang = interfaceIsHe ? 'he' : 'en'; const coInterfaceLang = interfaceIsHe ? 'en' : 'he'; From d78c512b40c0473cda86292f9bbe48352665720f Mon Sep 17 00:00:00 2001 From: yonadavGit Date: Wed, 30 Oct 2024 20:06:55 +0200 Subject: [PATCH 3/3] fix(topic page): match filter language to topicPath language when generating redirection url --- static/js/TopicPage.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/static/js/TopicPage.jsx b/static/js/TopicPage.jsx index c9d3854320..3836fea739 100644 --- a/static/js/TopicPage.jsx +++ b/static/js/TopicPage.jsx @@ -585,12 +585,13 @@ const TopicPage = ({ useEffect( ()=> { // hack to redirect to temporary sheet content on topics page for those topics that only have sheet content. - if (!Sefaria.is_moderator && !topicData.isLoading && Object.keys(topicData.tabs).length == 0 .length == 0 && topicData.subclass != "author"){ + if (!Sefaria.is_moderator && !topicData.isLoading && Object.keys(topicData.tabs).length == 0 && topicData.subclass != "author"){ const interfaceIsHe = Sefaria.interfaceLang === "hebrew"; const interfaceLang = interfaceIsHe ? 'he' : 'en'; const coInterfaceLang = interfaceIsHe ? 'en' : 'he'; - const topicPath = topicTitle[interfaceLang] || topicTitle[coInterfaceLang]; - const redirectUrl = `${document.location.origin}/search?q=${topicPath}&tab=sheet&tvar=1&tsort=relevance&stopics_${interfaceIsHe ? "he": "en"}Filters=${topicPath}&svar=1&ssort=relevance` + const topicPathLang = topicTitle[interfaceLang] ? interfaceLang : coInterfaceLang + const topicPath = topicTitle[topicPathLang] + const redirectUrl = `${document.location.origin}/search?q=${topicPath}&tab=sheet&tvar=1&tsort=relevance&stopics_${topicPathLang}Filters=${topicPath}&svar=1&ssort=relevance` window.location.replace(redirectUrl); } },[topicData])