* feat: Adds a new discussion topic configuration mechanism The new discussion configuration system links discussion topics directly to the course structure. This change adds a new task that sends a discussion update signal if there are any changes to the course. This signal includes all the context needed to update the configuration of the course. The handler for this new event will create a new entry for each unit that needs a topic in the database. In the future this will be used to see the topics in the course. * fix: add support for marking a provider as supporting LTI * fix: review feedback
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
"""
|
|
Data classes for discussions
|
|
"""
|
|
from typing import List
|
|
|
|
import attr
|
|
from opaque_keys.edx.keys import CourseKey, UsageKey
|
|
|
|
# TODO: These data models will be moved to openedx_events. They are currently here to simplify the PR.
|
|
|
|
|
|
@attr.s(frozen=True)
|
|
class DiscussionTopicContext:
|
|
"""
|
|
Context for linking the external id for a discussion topic to its associated usage key.
|
|
|
|
The ``title`` is cached to improve the performance, since otherwise we'd
|
|
need to look it up in the course structure each time.
|
|
|
|
The ``group_id`` can be used for providers that don't internally support
|
|
cohorting but we can emulate that wuth different contexts for different groups.
|
|
"""
|
|
title = attr.ib(type=str)
|
|
usage_key = attr.ib(type=UsageKey, default=None)
|
|
group_id = attr.ib(type=int, default=None)
|
|
external_id = attr.ib(type=str, default=None)
|
|
|
|
|
|
@attr.s(frozen=True)
|
|
class CourseDiscussionConfigurationData:
|
|
"""
|
|
Course configuration information for discussions.
|
|
|
|
Contains all the metadata needed to configure discussions for a course.
|
|
|
|
The ``contexts`` field contains all the contexts for which discussion
|
|
is to be enabled.
|
|
"""
|
|
course_key = attr.ib(type=CourseKey)
|
|
provider_type = attr.ib(type=str)
|
|
enable_in_context = attr.ib(type=bool, default=True)
|
|
enable_graded_units = attr.ib(type=bool, default=False)
|
|
unit_level_visibility = attr.ib(type=bool, default=False)
|
|
plugin_configuration = attr.ib(type=dict, default={})
|
|
contexts = attr.ib(type=List[DiscussionTopicContext], factory=list)
|