Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix inline discussions to use cached static assets.
Browse files Browse the repository at this point in the history
In production environments, the DiscussionXBlock was generating CSS and
JS asset URLs that pointed to the unminified versions of those bundled
assets. Due to our nginx rules, this would cause the assets to be
served without the long expiration times, forcing the user's browser to
constantly refetch these assets while browsing a course.

[PERF-431]
  • Loading branch information
David Ormsbee committed Jul 7, 2017
1 parent 32618fa commit 978e9fe
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -4,7 +4,7 @@
"""
import logging

from django.templatetags.static import static
from django.contrib.staticfiles.storage import staticfiles_storage
from django.utils.translation import get_language_bidi

from xblockutils.resources import ResourceLoader
Expand Down Expand Up @@ -136,14 +136,14 @@ def add_resource_urls(self, fragment):
"""
# Head dependencies
for vendor_js_file in self.vendor_js_dependencies():
fragment.add_resource_url(static(vendor_js_file), "application/javascript", "head")
fragment.add_resource_url(staticfiles_storage.url(vendor_js_file), "application/javascript", "head")

for css_file in self.css_dependencies():
fragment.add_css_url(static(css_file))
fragment.add_css_url(staticfiles_storage.url(css_file))

# Body dependencies
for js_file in self.js_dependencies():
fragment.add_javascript_url(static(js_file))
fragment.add_javascript_url(staticfiles_storage.url(js_file))

def has_permission(self, permission):
"""
Expand Down

0 comments on commit 978e9fe

Please sign in to comment.