Browse Source

Merge remote-tracking branch 'origin/master' into deploy

# Conflicts:
#	static/js/Footer.jsx
Ephraim Damboritz 1 month ago
parent
commit
3bf24db4c5

+ 1 - 1
reader/views.py

@@ -1932,7 +1932,7 @@ def version_status_api(request):
 @json_response_decorator
 @django_cache(default_on_miss = True)
 def version_status_tree_api(request, lang=None):
-    return library.simplify_toc(lang, library.get_toc(), [])
+    return library.simplify_toc(lang=lang)
 
 
 @sanitize_get_params

+ 1 - 1
scripts/regenerate_long_cached_data.py

@@ -10,7 +10,7 @@ from sefaria.model.link import get_book_link_collection, get_link_counts
 
 def regenerate_version_status_tree():
     for lang in [None, "he", "en"]:
-        django_cache(action="set", cache_prefix='version_status_tree_api')(library.simplify_toc)(lang, library.get_toc(), [])
+        django_cache(action="set", cache_prefix='version_status_tree_api')(library.simplify_toc)(lang=lang if lang else "")
 
 
 def regenerate_bare_links_api(cat1, cat2):

+ 1 - 1
sefaria/model/text.py

@@ -4910,7 +4910,7 @@ class Library(object):
 
     def simplify_toc(self, lang=None, toc_node=None, path=None):
         toc_node = toc_node if toc_node else self.get_toc()
-        path = path if len(path) else []
+        path = path if path else []
         simple_nodes = []
         for x in toc_node:
             node_name = x.get("category", None) or x.get("title", None)

+ 4 - 4
sefaria/system/cache.py

@@ -60,10 +60,10 @@ def django_cache(action="get", timeout=None, cache_key='', cache_prefix = None,
             do_actual_func = False
 
             if not _cache_key:
-                key_args = args[:]
-                if len(key_args) and isinstance(key_args[0], HttpRequest): # we dont want a HttpRequest to form part of the cache key, it wont be replicatable.
-                    key_args = key_args[1:]
-                _cache_key = cache_get_key(cache_prefix if cache_prefix else fn.__name__, *key_args, **kwargs)
+                cachekey_args = args[:]
+                if len(cachekey_args) and isinstance(cachekey_args[0], HttpRequest): # we dont want a HttpRequest to form part of the cache key, it wont be replicatable.
+                    cachekey_args = cachekey_args[1:]
+                _cache_key = cache_get_key(cache_prefix if cache_prefix else fn.__name__, *cachekey_args, **kwargs)
 
             if action in ["reset", "set"]:
                 do_actual_func = True

+ 1 - 1
sefaria/views.py

@@ -350,7 +350,7 @@ def reset_cached_api(request, apiurl):
     :return:
     """
     from undecorated import undecorated
-    from importlib import import_module
+    # from importlib import import_module
     try:
         match = resolve("/api/{}".format(apiurl))
         #mod = import_module(".".join(match.view_name.split(".")[:-1])) Dont actually need this, resolve gets us the func itself

+ 4 - 2
static/js/AccountPanel.jsx

@@ -17,6 +17,8 @@ class AccountPanel extends Component {
     $(".inAppLink").on("click", this.props.handleInAppLinkClick);
   }
   render() {
+    const fbURL = Sefaria.interfaceLang == "hebrew" ? "https://www.facebook.com/sefaria.org.il" : "https://www.facebook.com/sefaria.org";
+    const blgURL = Sefaria.interfaceLang == "hebrew" ? "https://blog.sefaria.org.il/" : "https://blog.sefaria.org/";
     var width = typeof window !== "undefined" ? $(window).width() : 1000;
     var accountContent = [
       (<BlockLink interfaceLink={true} target="/my/profile" title="Profile" heTitle="פרופיל" image="/static/img/profile.svg" />),
@@ -31,7 +33,7 @@ class AccountPanel extends Component {
     var learnContent = [
       (<BlockLink interfaceLink={true} target="/about" title="About" heTitle="אודות" />),
       (<BlockLink interfaceLink={true} target="/help" title="Help" heTitle="עזרה" />),
-      (<BlockLink interfaceLink={true} target="http://blog.sefaria.org" title="Blog" heTitle="בלוג" />),
+      (<BlockLink interfaceLink={true} target={blgURL} title="Blog" heTitle="בלוג" />),
       (<BlockLink interfaceLink={true} target="/faq" title="FAQ" heTitle="שאלות נפוצות" />),
       (<BlockLink interfaceLink={true} target="/educators" title="Educators" heTitle="מחנכים" />),
       (<BlockLink interfaceLink={true} target="/team" title="Team" heTitle="צוות" />)
@@ -49,7 +51,7 @@ class AccountPanel extends Component {
     contributeContent = (<TwoOrThreeBox content={contributeContent} width={width} />);
 
     var connectContent = [
-      (<BlockLink interfaceLink={true} target="http://www.facebook.com/sefaria.org" title="Facebook" heTitle="פייסבוק" />),
+      (<BlockLink interfaceLink={true} target={fbURL} title="Facebook" heTitle="פייסבוק" />),
       (<BlockLink interfaceLink={true} target="http://twitter.com/SefariaProject" title="Twitter" heTitle="טוויטר" />),
       (<BlockLink interfaceLink={true} target="http://www.youtube.com/user/SefariaProject" title="YouTube" heTitle="יוטיוב" />),
       (<BlockLink interfaceLink={true} target="http://www.github.com/Sefaria" title="GitHub" heTitle="גיטהאב" />),

+ 6 - 5
static/js/Footer.jsx

@@ -40,10 +40,11 @@ class Footer extends Component {
   render() {
     if (!Sefaria._siteSettings.TORAH_SPECIFIC) { return null; }
 
-    var fbURL = Sefaria.interfaceLang == "hebrew" ? "https://www.facebook.com/sefaria.org.il" : "https://www.facebook.com/sefaria.org";
-    var currentPath = Sefaria.util.currentPath();
-    var currentPathEncoded = encodeURIComponent(currentPath);
-    var next = currentPathEncoded ? currentPathEncoded : '?home';
+    const fbURL = Sefaria.interfaceLang == "hebrew" ? "https://www.facebook.com/sefaria.org.il" : "https://www.facebook.com/sefaria.org";
+    const blgURL = Sefaria.interfaceLang == "hebrew" ? "https://blog.sefaria.org.il/" : "https://blog.sefaria.org/";
+    let currentPath = Sefaria.util.currentPath();
+    let currentPathEncoded = encodeURIComponent(currentPath);
+    let next = currentPathEncoded ? currentPathEncoded : '?home';
     return (
       <footer id="footer" className="static sans">
         <div id="footerInner">
@@ -206,7 +207,7 @@ class Footer extends Component {
                   <span className="int-he">יוטיוב</span>
               </a>
               &bull;
-              <a href="https://blog.sefaria.org" target="_blank" className="outOfAppLink">
+              <a href={blgURL} target="_blank" className="outOfAppLink">
                   <span className="int-en">Blog</span>
                   <span className="int-he">בלוג</span>
               </a>

+ 1 - 1
templates/visual_library.html

@@ -1,7 +1,7 @@
 {% extends "base.html" %}
 {% load i18n sefaria_tags static %}
 
-{% block title %}{% trans "Visualizing the Sefaria Library" %}%{% if lang %} ({{ lang }}){% endif %}{% endblock %}
+{% block title %}{% trans "Visualizing the Sefaria Library" %} {% if lang %} ({{ lang }}){% endif %}{% endblock %}
 
 {% block description %}{% trans "How big is Torah compared to Talmud? This sunburst diagram lets you see the number of words in the texts and categories of Sefaria's library (which is growing every day!)." %}{% endblock %}