Skip to content
Snippets Groups Projects
Commit 7c6d8ee0 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Delegate to the message component to fully process the message

parent def4393d
No related branches found
No related tags found
No related merge requests found
...@@ -24,19 +24,19 @@ class ActivityAdapter: ...@@ -24,19 +24,19 @@ class ActivityAdapter:
MESSAGES.INVITED_TO_PROPOSAL: '{submission.title} has been invited to submit a proposal.', MESSAGES.INVITED_TO_PROPOSAL: '{submission.title} has been invited to submit a proposal.',
} }
def message(self, message_type): def message(self, message_type, **kwargs):
return self.messages[message_type] return self.messages[message_type].format(**kwargs)
def process(self, message_type, **kwargs): def process(self, message_type, **kwargs):
try: try:
message = self.message(message_type) message = self.message(message_type, kwargs)
except KeyError: except KeyError:
return return
Activity.actions.create( Activity.actions.create(
user=kwargs['user'], user=kwargs['user'],
submission=kwargs['submission'], submission=kwargs['submission'],
message=message.format(**kwargs), message=message,
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment