38 Commits

Author SHA1 Message Date
mike cullerton
b252d11eb5 Merge branch 'convert-timestamp-499' of https://github.com/sartography/cr-connect-workflow into convert-timestamp-499
# Conflicts:
#	crc/scripts/email.py
2021-10-26 15:39:38 -04:00
mike cullerton
a65c104a0b To validate get_email_data 2021-10-26 15:27:24 -04:00
Mike Cullerton
45fd317dc6
Merge branch 'dev' into convert-timestamp-499 2021-10-26 14:35:33 -04:00
mike cullerton
f88aba1db0 Cleanup validation for get_locatime.
Make sure we send the same type of values back for validation.
2021-10-26 14:29:38 -04:00
mike cullerton
7e3c47f8bf Added timestamp, and now return a schema just like the do_task method 2021-10-22 12:52:43 -04:00
Dan Funk
2ef03b0c79
Merge pull request #406 from sartography/convert-timestamp-499
Convert timestamp #499
2021-10-21 14:12:59 -04:00
mike cullerton
45e119a435 Changed validation to return an email_model, so it can be used in further validation 2021-10-20 12:14:16 -04:00
mike cullerton
d84625c51e Merge branch 'convert-timestamp-499' into email-attachment-error-503
# Conflicts:
#	tests/emails/test_email_script.py
2021-10-18 17:08:56 -04:00
mike cullerton
8de05b8fb6 Don't process attachments if argument is None or ''
This can happen during workflow processing
2021-10-18 11:19:56 -04:00
mike cullerton
e72cf27fe3 Return email model from email script. 2021-10-13 11:41:44 -04:00
mike cullerton
63df614f41 Change workflow_id to workflow_spec_id 2021-10-12 13:43:29 -04:00
mike cullerton
7551b99386 Add workflow_id to email_service call, for reporting
We now return the ID of the email model to the configurator, so they can track it.
2021-10-07 09:20:53 -04:00
mike cullerton
8df6c78925 Cleaned up what we return from the description, for the tools/list_scripts API endpoint 2021-09-22 12:12:26 -04:00
mike cullerton
32c72c5a40 Modified email script and email_service to accommodate new bcc, reply_to, and attachments arguments
Modified the email script description to add the new arguments
Cleaned up some import statements
2021-08-19 17:34:55 -04:00
Dan
848c2e622f Always use a schema to define what is being returned, it enforces consistency of the API and internally we can depend on well defined objects. 2021-08-10 16:16:08 -04:00
Dan
7f5c7417d8 Print out some additional debugging information in the email script so we can tell what is happening and where. 2021-07-22 16:02:08 -04:00
mike cullerton
dfa65ac276 We now perform an LDAP lookup for the associated user email addresses, instead of looking in the DB user table. 2021-03-15 10:30:23 -04:00
mike cullerton
67697b5076 Lots of changes!
Email Script:
- The email script now accepts 3 keyword arguments; subject, recipients, and cc.
- Subject and recipients are required.
- Recipients (and cc) can be an email address or list of addresses.
- You can use the string 'associated' in place of an email address, in which case we look up the users associated with a study that have send_email set to True.
- Moved some helper methods to email_service.

Email Service:
- Added cc argument
- Added helper methods previously in email script.
- Modified get_rendered_content to accept message and data directly. Previously, we passed in the task and grabbed them from there. Now we can use the method outside a task.
2021-03-11 11:32:21 -05:00
mike cullerton
7171219e8b removed unused import 2021-03-09 07:00:20 -05:00
mike cullerton
44ac55bc32 We can now send emails to users associated with a study, by using 'associated' as the recipient
We now use keyword arguments in the email script; subject and recipients
2021-03-09 06:49:39 -05:00
mike cullerton
5c3d791bf3 UVA asked us to remove the extra whitespace in emails.
We removed the string replacement of '\n' -> '<br>' to solve this.
This means you can't purposely add blank lines any more.
Trade offs.
2021-02-25 11:08:08 -05:00
mike cullerton
d8bd203139 The email script was failing validation because of missing parameters in scripts.email.do_task_validate_only.
I added a test in tests.test_email_script to make sure we get the default email_address.
I also found and fixed a bug in workflow_service.populate_form_with_random_data where we would overwrite default_values with random text because of a missing continue.
(We don't want to continue if we have repeating fields though.)
2021-02-11 15:36:12 -05:00
mike cullerton
d7a3afe8f4 changed the template to use the responsive html email template at https://github.com/leemunroe/responsive-html-email-template
added method get_cr_connect_wrapper to render our new html email template. This takes the email text generated from the task element documentation as the email_body.
2021-01-27 17:12:03 -05:00
mike cullerton
909af9b8d6 Change HTML emails so they look like the CR-Connect website. Add logo, color, style, etc.
Cleaned up email script a little.
Also, email script no longer uses services.mails. It uses email_service directly now.
2021-01-26 09:19:28 -05:00
Dan
e5a38874f6 A hard or soft reset should also cause a 'cancel_notify' which will kick off any CANCEL events. If this happens during
a hard or soft reset, and an error is thrown trying to fulfil a cancel event, the reset should still fire.
Sending emails still had a number of issues correctly parsing it's arguments.  This is corrected.
2020-12-29 18:05:13 -05:00
mike cullerton
32c5060a31 No longer use eval on the email address. It is already parsed.
Tests for single and multiple emails, and email error checking.
Still need to figure out how to implement multiple emails.
2020-12-09 12:11:46 -05:00
mike cullerton
730d0ca18f Email script now uses an email address instead of a UVA LDAP user_id. 2020-12-07 16:23:41 -05:00
Carlos Lopez
817333f26e Adding proper exception information 2020-07-02 16:10:33 -06:00
Carlos Lopez
7116b582e8 Splitting commands properly without losing double quoted strings 2020-06-25 12:01:24 -06:00
Carlos Lopez
5d1ae402b6 Slight refactor on data passed to template rendering 2020-06-24 22:43:44 -06:00
Carlos Lopez
e6d74aaa1a Removing extra index when parsing users info 2020-06-18 12:53:50 -06:00
Carlos Lopez
4db815a999 Handling incoming values from processor 2020-06-17 21:11:47 -06:00
Carlos Lopez
5ce279b663 Dropping silly pdb statement 2020-06-17 17:36:15 -06:00
Carlos Lopez
896ba6b377 Email relies now on markdown content 2020-06-17 17:00:16 -06:00
Carlos Lopez
2ce2dc73b5 Rendering proper content & organizing file structure for email tests 2020-06-17 16:09:38 -06:00
Carlos Lopez
c730a7b1ec Sending subject and using default sender 2020-06-17 08:53:02 -06:00
Carlos Lopez
2ff836019f Sonarcloud fix 2020-06-16 18:55:18 -06:00
Carlos Lopez
d4a285883f Email script 2020-06-16 18:42:36 -06:00