From c2ae680a551907f05731125b14f02a0bd082f9b1 Mon Sep 17 00:00:00 2001 From: Andy Boughton Date: Tue, 11 Oct 2016 15:24:48 -0400 Subject: [PATCH 1/3] Send user ID to sendgrid, for optional use by templates [#LEI-237] --- jam/plugins/user.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jam/plugins/user.py b/jam/plugins/user.py index 9c73dd7..1ae74e1 100644 --- a/jam/plugins/user.py +++ b/jam/plugins/user.py @@ -198,10 +198,11 @@ def post(self, handler): mail.set_from(self.from_email) mail.add_substitution(':token', user.token.decode()) + mail.add_substitution(':user', user.id) mail.add_filter('templates', 'enable', 1) mail.add_filter('templates', 'template_id', self.template) # Sendgrid requires subject text and html to be set to a non falsey value - # Its highly recommened that you overwrite these in your own templates + # It is highly recommended that you overwrite these in your own templates mail.set_subject('JamDB password reset') mail.set_text('Your temporary token is :token') mail.set_html('Your temporary token is :token') From 14f75a249a49e03bc77e12fe5fc8aabfa1dd8236 Mon Sep 17 00:00:00 2001 From: Andy Boughton Date: Tue, 11 Oct 2016 16:13:05 -0400 Subject: [PATCH 2/3] Update unit tests [#LEI-237] --- features/steps/plugins.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/features/steps/plugins.py b/features/steps/plugins.py index 4523a76..1bd6561 100644 --- a/features/steps/plugins.py +++ b/features/steps/plugins.py @@ -19,8 +19,11 @@ def assert_called(context): if actual.get('from'): mail.set_from(actual.get('from')) - token = mail.add_substitution.call_args[0][1] - mail.add_substitution.assert_called_with(':token', token) + token = mail.add_substitution.call_args_list[0][0][1] + mail.add_substitution.assert_any_call(':token', token) + + user = mail.add_substitution.call_args_list[1][0][1] + mail.add_substitution.assert_any_call(':user', user) mail.add_filter.assert_any_call('templates', 'enable', 1) mail.add_filter.assert_any_call('templates', 'template_id', actual['template']) From 6f210e1be86eabbd83ef9d249b9289c53a00028e Mon Sep 17 00:00:00 2001 From: Andy Boughton Date: Tue, 11 Oct 2016 16:20:10 -0400 Subject: [PATCH 3/3] Update documentation with commands for tooling. [#LEI-237] --- docs/source/contributing.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst index 5a1988f..6c3ce79 100644 --- a/docs/source/contributing.rst +++ b/docs/source/contributing.rst @@ -1,2 +1,18 @@ Contributing ============ + +We welcome contributions via [GitHub](https://github.com/CenterForOpenScience/jamdb). + +Before submitting your pull request, please make sure that all unit tests are passing, by running the command below: + +.. code:: bash + + behave + +To preview changes to the documentation, install the requirements in dev-requirements.txt, then run the following: + +.. code:: bash + + cd docs + make html +