Allow override of "email key" for user feedback, sent via API

This commit is contained in:
Lance Edgar 2020-02-10 12:35:30 -06:00
parent 76839c48cf
commit 4a35620820

View file

@ -41,7 +41,13 @@ from tailbone.db import Session
class CommonView(APIView):
"""
Misc. "common" views for the API.
.. attribute:: feedback_email_key
This is the email key which will be used when sending "user feedback"
email. Default value is ``'user_feedback'``.
"""
feedback_email_key = 'user_feedback'
@api
def about(self):
@ -94,7 +100,7 @@ class CommonView(APIView):
data['user_url'] = '#' # TODO: could get from config?
data['client_ip'] = self.request.client_addr
send_email(self.rattail_config, 'user_feedback', data=data)
send_email(self.rattail_config, self.feedback_email_key, data=data)
return {'ok': True}
return {'error': "Form did not validate!"}