6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-04 19:03:39 +00:00

fix: v0 plugin patch ordering

v0 plugin patches were directly added to ENV_PATCH, while v1 patches
were added to ENV_PATCHES. ENV_PATCHES items are forwarded to ENV_PATCH
later at runtime, which means that yaml plugin patches were always
loaded before v1 patches.

This was causing weird ordering issues, as discussed here:
https://discuss.openedx.org/t/using-mfe-config-to-set-logo-trademark-url-for-the-footer-component-in-olive/9578
This commit is contained in:
Régis Behmo 2023-03-16 11:37:31 +01:00 committed by Régis Behmo
parent fa9e86e188
commit 3377ffc38a
3 changed files with 3 additions and 2 deletions

View File

@ -0,0 +1 @@
- [Bugfix] Make sure that v0 plugin patches are applied in the same order as plugins are listed. (by @regisb)

View File

@ -86,7 +86,7 @@ class PluginsTests(PluginsTestCase):
plugins_v0.DictPlugin(
{"name": "plugin1", "patches": {"patch1": "Hello {{ ID }}"}}
)
plugins.load("plugin1")
plugins.load_all(["plugin1"])
patches = list(plugins.iter_patches("patch1"))
self.assertEqual(["Hello {{ ID }}"], patches)

View File

@ -146,7 +146,7 @@ class BasePlugin:
raise exceptions.TutorError(
f"Invalid patch '{patch_name}' in plugin {self.name}. Expected str, got {content.__class__}."
)
hooks.Filters.ENV_PATCH(patch_name).add_item(content)
hooks.Filters.ENV_PATCHES.add_item((patch_name, content))
def _load_tasks(self) -> None:
"""