Skip to content

Commit

Permalink
Make appsembler_eventtracking a CMS plugin app too
Browse files Browse the repository at this point in the history
Need signal handlers to invalidate TahoeUserProfileMetadataCache entries if somehow UserProfile is updated on the Studio side
  • Loading branch information
bryanlandia committed Aug 31, 2022
1 parent e6fd01e commit f47d01c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions openedx/core/djangoapps/appsembler/eventtracking/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ class EventTrackingConfig(AppConfig):
PluginSignals.SENDER_PATH: 'student.models.UserProfile',
}
]
},
ProjectType.CMS: {
PluginSignals.RECEIVERS: [
# just to invalidate cache if UserProfile changed, maybe in Django admin
{
PluginSignals.RECEIVER_FUNC_NAME: 'invalidate_user_metadata_cache_entry',
PluginSignals.SIGNAL_PATH: 'django.db.models.signals.post_save',
PluginSignals.SENDER_PATH: 'student.models.UserProfile',
},
{
PluginSignals.RECEIVER_FUNC_NAME: 'invalidate_user_metadata_cache_entry',
PluginSignals.SIGNAL_PATH: 'django.db.models.signals.post_delete',
PluginSignals.SENDER_PATH: 'student.models.UserProfile',
}
]
}
}
}
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"ace_common = openedx.core.djangoapps.ace_common.apps:AceCommonConfig",
"content_libraries = openedx.core.djangoapps.content_libraries.apps:ContentLibrariesConfig",
"appsembler_settings = openedx.core.djangoapps.appsembler.settings.apps:SettingsConfig",
"appsembler_eventtracking = openedx.core.djangoapps.appsembler.eventtracking.apps:EventTrackingConfig",
# Importing an LMS app into the Studio process is not a good
# practice. We're ignoring this for Discussions here because its
# placement in LMS is a historical artifact. The eventual goal is to
Expand Down

0 comments on commit f47d01c

Please sign in to comment.