Skip to content
Merged
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
9 changes: 9 additions & 0 deletions modules/app_modules/coar_notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def send_notification(self, notification, article):
target_inbox = get_target_inbox(article)

notification = self.add_base_notification_properties(notification, target_inbox)
notification.update(fixup_target_origin(article))
if article.coar_notification_id:
notification.update({
"inReplyTo": article.coar_notification_id,
Expand Down Expand Up @@ -334,6 +335,7 @@ def send_ack(self,

target_inbox = origin_req["origin"]["inbox"]
notification = self.add_base_notification_properties(notification, target_inbox)
notification.update(fixup_target_origin(article))
self._send_notification(notification, target_inbox)

return notification
Expand All @@ -357,6 +359,13 @@ def get_origin_request(article):
return json.loads(req.body) if req and req.coar_id else None


def fixup_target_origin(article):
origin_req = get_origin_request(article)
return {
"origin": origin_req["target"],
"target": origin_req["origin"],
} if origin_req else {}

def get_target_inbox(article):
"""note: thread-local caching, assumes single article is processed"""

Expand Down