Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PE-164 - Patcher to fix ticketing page #315

Merged
merged 1 commit into from
Oct 16, 2023
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
2 changes: 2 additions & 0 deletions engage/contacts/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def ready(self):
ContactListOverrides.applyPatches()
from .views import ContactReadOverrides
ContactReadOverrides.applyPatches()
from .views import ContactHistoryOverrides
ContactHistoryOverrides.applyPatches()
#enddef ready

#endclass AppConfig
26 changes: 26 additions & 0 deletions engage/contacts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,29 @@ def has_permission(self: ContactCRUDL.Read, request: WSGIRequest, *args, **kwarg
#enddef

#endclass ContactReadOverrides

class ContactHistoryOverrides(MonkeyPatcher):
patch_class = ContactCRUDL.History

def as_json(self, context):
"""
Don't reply back with the channel log or channel Django models on response. We use those custom fields on some Hamls, but
we don't want it when this is JSON serialized. Things break.
"""
events = []
for e in context["events"]:
e["channel_log"] = []
e["channel"] = None
events.append(e)

return {
"has_older": context["has_older"],
"recent_only": context["recent_only"],
"next_before": context["next_before"],
"next_after": context["next_after"],
"start_date": context["start_date"],
"events": events,
}
#enddef

#endclass ContactHistoryOverrides