Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ Unreleased
.. scriv-insert-here


.. _changelog-3.11.0:

[3.11.0] - 2026-09-10
----------------------

Changed
~~~~~~~

* Changed ``SupportContactContextRequested`` to accept/return the entire support contact page
context dict instead of a bare tags list, and dropped the unused ``user`` argument (fetch it via
``crum`` internally if needed, matching other filters' convention)

.. _changelog-3.10.0:

[3.10.0] - 2026-09-08
Expand Down
2 changes: 1 addition & 1 deletion openedx_filters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from openedx_filters.filters import *

__version__ = "3.10.0"
__version__ = "3.11.0"

if sys.version_info < (3, 12): # pragma: no cover
warnings.warn(
Expand Down
21 changes: 9 additions & 12 deletions openedx_filters/learning/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1940,12 +1940,12 @@ def run_filter(

class SupportContactContextRequested(OpenEdxPublicFilter):
"""
Filter used to enrich the support contact request context with custom tags.
Filter used to enrich the support contact request context.

Purpose:
This filter is triggered when a user submits a support contact request. Pipeline steps
can inspect the user to append custom tags to the tags list that will be associated
with the support ticket.
can inspect and modify the support contact page context — e.g. append custom tags to
context['tags'] — before the page is rendered and the ticket is associated with those tags.

Filter Type:
org.openedx.learning.support.contact.context.requested.v1
Expand All @@ -1959,18 +1959,15 @@ class SupportContactContextRequested(OpenEdxPublicFilter):
filter_type = "org.openedx.learning.support.contact.context.requested.v1"

@classmethod
def run_filter(cls, tags: list[str], user: Any) -> tuple[list, Any]:
def run_filter(cls, context: dict) -> dict:
"""
Process the tags list through the configured pipeline steps.
Process the support contact page context through the configured pipeline steps.

Arguments:
tags (list[str]): the list of tags to be associated with the support ticket.
user (User): the user submitting the support request.
context (dict): the support contact page template context.

Returns:
tuple[list, Any]:
- list: the (possibly modified) tags list.
- Any: the Django User object (unchanged).
dict: the (possibly modified) context dict.
"""
data = super().run_pipeline(tags=tags, user=user)
return data["tags"], data["user"]
data = super().run_pipeline(context=context)
return data["context"]
21 changes: 10 additions & 11 deletions openedx_filters/learning/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1182,25 +1182,24 @@ def test_filter_type(self):
== "org.openedx.learning.support.contact.context.requested.v1"
)

def test_run_filter_returns_tags_unchanged_when_no_pipeline(self):
def test_run_filter_returns_context_unchanged_when_no_pipeline(self):
"""
With no pipeline steps configured, the tags list and user are returned unchanged.
With no pipeline steps configured, the context dict is returned unchanged.
"""
tags = ["some_tag"]
user = Mock()
context = {"tags": ["some_tag"]}

result = SupportContactContextRequested.run_filter(tags=tags, user=user)
result = SupportContactContextRequested.run_filter(context=context)

assert result == (tags, user)
assert result == context

@patch(
"openedx_filters.tooling.OpenEdxPublicFilter.run_pipeline",
return_value={"tags": ["some_tag", "enterprise_learner"], "user": Mock()},
return_value={"context": {"tags": ["some_tag", "enterprise_learner"]}},
)
def test_run_filter_returns_tags_from_pipeline(self, mock_run_pipeline):
def test_run_filter_returns_context_from_pipeline(self, mock_run_pipeline):
"""
The (possibly modified) tags list returned by the pipeline is passed through.
The (possibly modified) context dict returned by the pipeline is passed through.
"""
result = SupportContactContextRequested.run_filter(tags=["some_tag"], user=Mock())
result = SupportContactContextRequested.run_filter(context={"tags": ["some_tag"]})

assert result == (["some_tag", "enterprise_learner"], mock_run_pipeline.return_value["user"])
assert result == mock_run_pipeline.return_value["context"]