Let feedback forms define their own email key

so multiple recipient options may be presented to user, e.g. in public
frontend
This commit is contained in:
Lance Edgar 2021-08-02 18:26:15 -05:00
parent 8884d28306
commit 90af8f91b8
2 changed files with 6 additions and 2 deletions

View file

@ -104,7 +104,8 @@ class CommonView(APIView):
data['user_url'] = '#' # TODO: could get from config?
data['client_ip'] = self.request.client_addr
send_email(self.rattail_config, self.feedback_email_key, data=data)
email_key = data['email_key'] or self.feedback_email_key
send_email(self.rattail_config, email_key, data=data)
return {'ok': True}
return {'error': "Form did not validate!"}

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar
# Copyright © 2010-2021 Lance Edgar
#
# This file is part of Rattail.
#
@ -46,6 +46,9 @@ class Feedback(colander.Schema):
"""
Form schema for user feedback.
"""
email_key = colander.SchemaNode(colander.String(),
missing=colander.null)
referrer = colander.SchemaNode(colander.String())
user = colander.SchemaNode(colander.String(),