Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
34e41d9
added README file
Apr 9, 2021
bfddfb0
added additional gherkin scenarios
Apr 12, 2021
4e414b4
additional gherkin scenarios
Apr 12, 2021
a65ec5f
corrections
Apr 14, 2021
faaf039
updates to reset-your-password.feature
Apr 14, 2021
5a302f1
additional updates
Apr 20, 2021
b726309
created and started updating a sync-imported-resources.feature
Apr 22, 2021
6a86f87
corrections
Apr 22, 2021
7ef843f
updates on add-channel-to-starred.feature
Apr 23, 2021
7c2538b
Replace ResponsiveDialog by KModal in PoliciesModal
MisRob Apr 20, 2021
c73f13d
Cleanup PolicyModals tests
MisRob Apr 27, 2021
596936d
Simplify policies modals architecture
MisRob Apr 28, 2021
6a232af
Simplify policies store tests
MisRob May 12, 2021
9dc0bd8
Add tests for a new getter and fix bugs
MisRob May 12, 2021
c8301f2
Emit accept and close events
MisRob May 13, 2021
89e6e73
Remove typo
MisRob May 13, 2021
2a23432
Make policies accessible from template
MisRob May 13, 2021
d6fd651
Fix typo
MisRob May 13, 2021
6ae90c7
Remove VForm
MisRob May 13, 2021
4099853
Remove duplicate policy modals
MisRob May 14, 2021
f633f83
Remove ResponsiveDialog component
MisRob May 14, 2021
c6d1a2d
gherkin scenarios improvements
May 17, 2021
7931f50
merging upstream changes
May 17, 2021
2b931b7
Merge pull request #3127 from MisRob/kds-kmodal-responsivedialog-poli…
MisRob May 17, 2021
915714a
more updates on the gherkins
May 18, 2021
eeeea69
Merge pull request #3159 from learningequality/master
bjester May 19, 2021
883c522
Upgrade to django 2.2
rtibbles Nov 4, 2020
0ee0285
Django 3 upgrade.
rtibbles Dec 15, 2020
9f06bc1
log context around malformed filenames on publishing
micahscopes Feb 10, 2021
292b211
Merge pull request #2533 from rtibbles/django2.2
rtibbles May 20, 2021
e5656b2
Merge pull request #2922 from micahscopes/extra-info-about-malformed-…
rtibbles May 20, 2021
6fd9392
Update dev urls for Django 3.
rtibbles May 20, 2021
bc9d81c
Bump django-registration from 3.1.1 to 3.1.2
dependabot[bot] May 20, 2021
514a36a
Update values viewset to support pagination and ordering.
rtibbles Apr 11, 2021
6ce351e
Update frontend to match backend changes.
rtibbles Apr 11, 2021
5a38cd6
Limit ordering to a single field.
rtibbles Apr 11, 2021
7700861
Add pagination support to indexedDB handling and resource layer.
rtibbles Apr 11, 2021
0e19893
Fix bug preventing ordering on mapped fields.
rtibbles May 20, 2021
0ca307f
Merge pull request #3160 from learningequality/dependabot/pip/django-…
rtibbles May 20, 2021
96eb60a
Distinct on order queryset to prevent duplicates from JOINs.
rtibbles May 20, 2021
d1ab4b7
adding an upload-files.feature and some minor corrections
May 21, 2021
d307741
adding new feature files
May 21, 2021
5c5b5e5
Merge pull request #3082 from pcenov/gherkin-scenarios
radinamatic May 21, 2021
3fd6829
Updates from PR review.
rtibbles May 21, 2021
9eee591
Upgrade DRF to latest.
rtibbles May 21, 2021
3edfa37
Merge pull request #3086 from rtibbles/pagination
rtibbles May 21, 2021
b210314
Add pt-BR files from Crowdin script
marcellamaki May 25, 2021
7c2e5a7
Update python files to connect pt-BR JSON files
marcellamaki May 25, 2021
6ffe70b
Merge pull request #3162 from marcellamaki/add-pt-BR
bjester May 25, 2021
de61db8
Merge pull request #3166 from bjester/sprint-release-2021-05-24
rtibbles May 25, 2021
760bfcd
Adds basic coverage for some commonly used filters on search endpoint.
rtibbles May 26, 2021
c545810
Merge pull request #3172 from rtibbles/search_django32
bjester May 26, 2021
612b85c
Update URLs from django.contrib.auth for 3.2 upgrade.
rtibbles May 27, 2021
78e547e
Merge pull request #3174 from rtibbles/password_reset
rtibbles May 27, 2021
52e7c89
Load portuguese country name data.
rtibbles May 27, 2021
179c845
Don't hard code channels URL to ensure proper lang redirect.
rtibbles May 27, 2021
c74f131
Merge pull request #3176 from rtibbles/country_list
rtibbles May 27, 2021
d1527bd
Merge pull request #3177 from rtibbles/lang_redirect
bjester May 27, 2021
147ce88
Call distinct after filtering by paginated pk list to prevent JOIN du…
rtibbles Jun 1, 2021
e74623e
updates to some of the feature files
Jun 2, 2021
5580bf8
Merge pull request #3184 from rtibbles/distinctive
rtibbles Jun 2, 2021
b73bd7d
Merge branch 'hotfixes' into feature-updates
radinamatic Jun 2, 2021
7eedcc7
Merge pull request #3185 from pcenov/feature-updates
radinamatic Jun 2, 2021
175aa15
Copy string translations
bjester Jun 2, 2021
00ed5d2
Merge pull request #3187 from bjester/strings-2021-05-24
bjester Jun 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/deploytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y gettext
- name: Test Django makemessages
run: python contentcuration/manage.py makemessages
run: python contentcuration/manage.py makemessages --all
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ i18n-extract-frontend:

i18n-extract-backend:
# generate backend messages
cd contentcuration && python manage.py makemessages
# workaround for Django 1.11 makemessages spitting out an invalid English translation file
python bin/fix_django_messages.py
cd contentcuration && python manage.py makemessages --all

i18n-extract: i18n-extract-frontend i18n-extract-backend

Expand Down
29 changes: 0 additions & 29 deletions bin/fix_django_messages.py

This file was deleted.

2 changes: 0 additions & 2 deletions contentcuration/contentcuration/api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""
This module contains utility functions used by API endpoints.
"""
from future import standard_library
standard_library.install_aliases()
import hashlib
import logging
import os
Expand Down
2 changes: 1 addition & 1 deletion contentcuration/contentcuration/catalog_settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# flake8: noqa
from .production_settings import * # noqa

LANGUAGES += (("ar", ugettext("Arabic")),) # noqa
LANGUAGES += (("ar", gettext("Arabic")),) # noqa

LIBRARY_MODE = True
SITE_READ_ONLY = True
Expand Down
4 changes: 2 additions & 2 deletions contentcuration/contentcuration/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from contentcuration.utils.celery.app import CeleryApp

# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'contentcuration.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "contentcuration.settings")

app = CeleryApp('contentcuration')

Expand All @@ -19,4 +19,4 @@

@app.task(bind=True)
def debug_task(self):
print('Request: {0!r}'.format(self.request))
print("Request: {0!r}".format(self.request))
24 changes: 14 additions & 10 deletions contentcuration/contentcuration/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.conf import settings
from django.core.urlresolvers import get_resolver
from django.template.loader import render_to_string
from django.urls import get_resolver
from django.utils.html import mark_safe
from django_js_reverse.core import _safe_json
from django_js_reverse.core import generate_json
Expand All @@ -11,14 +11,18 @@


def site_variables(request):
return {'INCIDENT': settings.INCIDENT,
'BETA_MODE': settings.BETA_MODE,
'DEPRECATED': "contentworkshop" in request.get_host(),
'STORAGE_BASE_URL': "{bucket}/{storage_root}/".format(bucket=settings.AWS_S3_BUCKET_NAME, storage_root=settings.STORAGE_ROOT),
'STORAGE_HOST': settings.AWS_S3_ENDPOINT_URL,
'DEBUG': settings.DEBUG,
'LANG_INFO': json_for_parse_from_data(language_globals()),
'LOGGED_IN': not request.user.is_anonymous()}
return {
"INCIDENT": settings.INCIDENT,
"BETA_MODE": settings.BETA_MODE,
"DEPRECATED": "contentworkshop" in request.get_host(),
"STORAGE_BASE_URL": "{bucket}/{storage_root}/".format(
bucket=settings.AWS_S3_BUCKET_NAME, storage_root=settings.STORAGE_ROOT
),
"STORAGE_HOST": settings.AWS_S3_ENDPOINT_URL,
"DEBUG": settings.DEBUG,
"LANG_INFO": json_for_parse_from_data(language_globals()),
"LOGGED_IN": not request.user.is_anonymous,
}


def url_tag(self):
Expand All @@ -37,7 +41,7 @@ def url_tag(self):
context={"data": _safe_json(data), "js_name": "window.Urls"},
)
return {
'I18N_URLS': mark_safe(
"I18N_URLS": mark_safe(
"""<script type="text/javascript">"""
# Minify the generated Javascript
+ jsmin(js)
Expand Down
9 changes: 0 additions & 9 deletions contentcuration/contentcuration/db/models/aggregates.py

This file was deleted.

48 changes: 0 additions & 48 deletions contentcuration/contentcuration/db/models/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,51 +613,3 @@ def _deep_copy(
self._copy_associated_objects(source_copy_id_map)

return new_nodes

def build_tree_nodes(self, data, target=None, position="last-child"):
"""
vendored from:
https://github.com/django-mptt/django-mptt/blob/fe2b9cc8cfd8f4b764d294747dba2758147712eb/mptt/managers.py#L614
"""
opts = self.model._mptt_meta
if target:
tree_id = target.tree_id
if position in ("left", "right"):
level = getattr(target, opts.level_attr)
if position == "left":
cursor = getattr(target, opts.left_attr)
else:
cursor = getattr(target, opts.right_attr) + 1
else:
level = getattr(target, opts.level_attr) + 1
if position == "first-child":
cursor = getattr(target, opts.left_attr) + 1
else:
cursor = getattr(target, opts.right_attr)
else:
tree_id = self._get_next_tree_id()
cursor = 1
level = 0

stack = []

def treeify(data, cursor=1, level=0):
data = dict(data)
children = data.pop("children", [])
node = self.model(**data)
stack.append(node)
setattr(node, opts.tree_id_attr, tree_id)
setattr(node, opts.level_attr, level)
setattr(node, opts.left_attr, cursor)
for child in children:
cursor = treeify(child, cursor=cursor + 1, level=level + 1)
cursor += 1
setattr(node, opts.right_attr, cursor)
return cursor

treeify(data, cursor=cursor, level=level)

if target:
self._create_space(2 * len(stack), cursor - 1, tree_id)

return stack
20 changes: 15 additions & 5 deletions contentcuration/contentcuration/debug/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,44 @@
import debug_panel.urls
from debug_panel.cache import cache
from debug_panel.middleware import DebugPanelMiddleware
from django.core.urlresolvers import reverse
from django.urls import reverse


class CustomDebugPanelMiddleware(DebugPanelMiddleware):
"""
Custom version to fix SQL escaping:
https://github.com/recamshak/django-debug-panel/issues/17#issuecomment-366268893
"""

def process_response(self, request, response):
"""
Store the DebugToolbarMiddleware rendered toolbar into a cache store.
The data stored in the cache are then reachable from an URL that is appened
to the HTTP response header under the 'X-debug-data-url' key.
"""
toolbar = self.__class__.debug_toolbars.get(threading.current_thread().ident, None)
toolbar = self.__class__.debug_toolbars.get(
threading.current_thread().ident, None
)

response = super(DebugPanelMiddleware, self).process_response(request, response)

if toolbar:
# for django-debug-toolbar >= 1.4
for panel in reversed(toolbar.enabled_panels):
if hasattr(panel, 'generate_stats') and not panel.get_stats(): # PATCH HERE
if (
hasattr(panel, "generate_stats") and not panel.get_stats()
): # PATCH HERE
panel.generate_stats(request, response)

cache_key = "%f" % time.time()
cache.set(cache_key, toolbar.render_toolbar())

response['X-debug-data-url'] = request.build_absolute_uri(
reverse('debug_data', urlconf=debug_panel.urls, kwargs={'cache_key': cache_key}))
response["X-debug-data-url"] = request.build_absolute_uri(
reverse(
"debug_data",
urlconf=debug_panel.urls,
kwargs={"cache_key": cache_key},
)
)

return response
37 changes: 21 additions & 16 deletions contentcuration/contentcuration/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

def browser_is_supported(function):
def wrap(request, *args, **kwargs):
user_agent_string = request.META.get('HTTP_USER_AGENT') or ""
user_agent_string = request.META.get("HTTP_USER_AGENT") or ""

# Check if the user agent string matches the Kubernetes agents, Google Health Check agents, or an accepted browser
for expected_agent in ACCEPTED_BROWSERS:
if expected_agent in user_agent_string:
return function(request, *args, **kwargs)

return render(request, 'unsupported_browser.html')
return render(request, "unsupported_browser.html")

wrap.__doc__ = function.__doc__
wrap.__name__ = function.__name__
Expand All @@ -25,10 +25,10 @@ def wrap(request, *args, **kwargs):

def is_admin(function):
def wrap(request, *args, **kwargs):
if not request.user.is_anonymous() and request.user.is_admin:
if not request.user.is_anonymous and request.user.is_admin:
return function(request, *args, **kwargs)

return render(request, 'unauthorized.html', status=403)
return render(request, "unauthorized.html", status=403)

wrap.__doc__ = function.__doc__
wrap.__name__ = function.__name__
Expand All @@ -38,17 +38,19 @@ def wrap(request, *args, **kwargs):
def can_access_channel(function):
def wrap(request, *args, **kwargs):
try:
channel = Channel.objects.get(pk=kwargs['channel_id'])
channel = Channel.objects.get(pk=kwargs["channel_id"])
except ObjectDoesNotExist:
return render(request, 'channel_not_found.html')

if channel.public or \
channel.editors.filter(id=request.user.id).exists() or \
channel.viewers.filter(id=request.user.id).exists() or \
(not request.user.is_anonymous() and request.user.is_admin):
return render(request, "channel_not_found.html")

if (
channel.public
or channel.editors.filter(id=request.user.id).exists()
or channel.viewers.filter(id=request.user.id).exists()
or (not request.user.is_anonymous and request.user.is_admin)
):
return function(request, *args, **kwargs)

return render(request, 'channel_not_found.html', status=404)
return render(request, "channel_not_found.html", status=404)

wrap.__doc__ = function.__doc__
wrap.__name__ = function.__name__
Expand All @@ -58,14 +60,17 @@ def wrap(request, *args, **kwargs):
def can_edit_channel(function):
def wrap(request, *args, **kwargs):
try:
channel = Channel.objects.get(pk=kwargs['channel_id'], deleted=False)
channel = Channel.objects.get(pk=kwargs["channel_id"], deleted=False)

if not channel.editors.filter(id=request.user.id).exists() and not request.user.is_admin:
return render(request, 'unauthorized.html', status=403)
if (
not channel.editors.filter(id=request.user.id).exists()
and not request.user.is_admin
):
return render(request, "unauthorized.html", status=403)

return function(request, *args, **kwargs)
except ObjectDoesNotExist:
return render(request, 'channel_not_found.html')
return render(request, "channel_not_found.html")

wrap.__doc__ = function.__doc__
wrap.__name__ = function.__name__
Expand Down
25 changes: 13 additions & 12 deletions contentcuration/contentcuration/dev_urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from django.conf import settings
from django.conf.urls import include
from django.conf.urls import url
from django.contrib import admin
from django.http.response import HttpResponseRedirect
from django.urls import include
from django.urls import path
from django.urls import re_path
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import permissions
Expand Down Expand Up @@ -31,33 +32,33 @@ def webpack_redirect_view(request):
)

urlpatterns = urlpatterns + [
url(r"^__open-in-editor/", webpack_redirect_view),
url(r'^admin/', include(admin.site.urls)),
url(
re_path(r"^__open-in-editor/", webpack_redirect_view),
path('admin/', admin.site.urls),
re_path(
r"^swagger(?P<format>\.json|\.yaml)$",
schema_view.without_ui(cache_timeout=0),
name="schema-json",
),
url(
re_path(
r"^api_explorer/$",
schema_view.with_ui("swagger", cache_timeout=0),
name="schema-swagger-ui",
),
url(
re_path(
r"^redoc/$", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"
),
url(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework")),
url(
re_path(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework")),
re_path(
r"^" + settings.STORAGE_URL[1:] + "(?P<path>.*)$",
file_views.debug_serve_file,
name="debug_serve_file",
),
url(
re_path(
r"^" + settings.CONTENT_DATABASE_URL[1:] + "(?P<path>.*)$",
file_views.debug_serve_content_database_file,
name="content_database_debug_serve_file",
),
url(
re_path(
r"^" + settings.CSV_URL[1:] + "(?P<path>.*)$",
file_views.debug_serve_file,
name="csv_debug_serve_file",
Expand All @@ -68,4 +69,4 @@ def webpack_redirect_view(request):

import debug_toolbar

urlpatterns = [url(r"^__debug__/", include(debug_toolbar.urls))] + urlpatterns
urlpatterns = [re_path(r"^__debug__/", include(debug_toolbar.urls))] + urlpatterns
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
};
return this.login(credentials)
.then(() => {
window.location.assign(this.nextParam || '/channels');
window.location.assign(this.nextParam || window.Urls.channels());
})
.catch(err => {
this.busy = false;
Expand Down
Loading