Skip to content

Commit

Permalink
🔧(sandbox) allowing multiple forums for a same LTIContext on sandbox
Browse files Browse the repository at this point in the history
In development mode, the sandbox allows using Ashley via a dummy LTI consumer.
So far, we can’t create several forums for the same course, since the forum
LTI id is generated from the course ID. This prevents us from testing features
that we are trying to implement. Enabling to set the LTI id value will fix this
limit.
  • Loading branch information
carofun committed Jun 21, 2021
1 parent 83ccbf6 commit f5338ec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
- add frontend internationalisation and react components autoload
- add django rest framework to promote/revoke moderators for current LTIContext
- add new role moderator and permission to manage moderators
- add a `LTI ID` field in the sandbox settings to be able to have multiple
forums for a same LTIContext

### Fixed
- fix sorting on sticky and announcements topics
Expand Down
7 changes: 7 additions & 0 deletions sandbox/dev_tools/forms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Forms definition for the dev_tools application."""

import uuid

from django import forms
from django.utils.translation import gettext_lazy as _
from lti_toolbox.models import LTIPassport
Expand Down Expand Up @@ -34,6 +36,11 @@ class LTIConsumerForm(forms.Form):
label="Course Title", max_length=100, initial="Mathematics 101"
)

forum_lti_id = forms.UUIDField(
label="LTI ID",
initial=uuid.uuid5(uuid.NAMESPACE_DNS, "default"),
)

role = forms.ChoiceField(
choices=(
("Student", _("Student")),
Expand Down
6 changes: 1 addition & 5 deletions sandbox/dev_tools/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ def dev_consumer(request: HttpRequest) -> HttpResponse:
launch_url = request.build_absolute_uri(
reverse(
"forum.lti.view",
kwargs={
"uuid": uuid.uuid5(
uuid.NAMESPACE_DNS, form.cleaned_data["course_id"]
)
},
kwargs={"uuid": form.cleaned_data["forum_lti_id"]},
)
)
lti_params = _generate_signed_parameters(form, launch_url, passport)
Expand Down

0 comments on commit f5338ec

Please sign in to comment.