From 9415992bc1bab70ebbb4bb4f511dc7d5ee88d457 Mon Sep 17 00:00:00 2001 From: Will O'Beirne Date: Mon, 4 Feb 2019 14:45:38 -0500 Subject: [PATCH] Remove previews from update and comment emails. --- backend/grant/admin/example_emails.py | 3 --- backend/grant/proposal/views.py | 7 +------ .../grant/templates/emails/comment_reply.html | 6 +----- .../grant/templates/emails/comment_reply.txt | 2 -- .../templates/emails/contribution_update.html | 20 ++++++------------- .../templates/emails/contribution_update.txt | 6 ++++-- .../templates/emails/proposal_comment.html | 6 +----- .../templates/emails/proposal_comment.txt | 4 +--- 8 files changed, 14 insertions(+), 40 deletions(-) diff --git a/backend/grant/admin/example_emails.py b/backend/grant/admin/example_emails.py index 998ee592..92c1acb3 100644 --- a/backend/grant/admin/example_emails.py +++ b/backend/grant/admin/example_emails.py @@ -80,7 +80,6 @@ example_email_args = { 'proposal_comment': { 'author': user, 'proposal': proposal, - 'preview': 'Blah blah blah blah blah...', 'comment_url': 'http://somecomment.com', 'author_url': 'http://someuser.com', }, @@ -92,13 +91,11 @@ example_email_args = { 'contribution_update': { 'proposal': proposal, 'proposal_update': update, - 'preview': 'Blah blah blah blah blah blah blah blah blah blah blah blah blah blah...', 'update_url': 'http://someupdate.com', }, 'comment_reply': { 'author': user, 'proposal': proposal, - 'preview': 'Blah blah blah blah blah...', 'comment_url': 'http://somecomment.com', 'author_url': 'http://someuser.com', }, diff --git a/backend/grant/proposal/views.py b/backend/grant/proposal/views.py index ab71fe11..e4db581d 100644 --- a/backend/grant/proposal/views.py +++ b/backend/grant/proposal/views.py @@ -15,7 +15,7 @@ from grant.utils.auth import ( internal_webhook ) from grant.utils.exceptions import ValidationException -from grant.utils.misc import is_email, make_url, from_zat, make_preview +from grant.utils.misc import is_email, make_url, from_zat from grant.utils.enums import ProposalStatus, ContributionStatus from sqlalchemy import or_ @@ -107,13 +107,11 @@ def post_proposal_comments(proposal_id, comment, parent_comment_id): dumped_comment = comment_schema.dump(comment) # TODO: Email proposal team if top-level comment - preview = make_preview(comment.content, 60) if not parent: for member in proposal.team: send_email(member.email_address, 'proposal_comment', { 'author': g.current_user, 'proposal': proposal, - 'preview': preview, 'comment_url': make_url(f'/proposal/{proposal.id}?tab=discussions&comment={comment.id}'), 'author_url': make_url(f'/profile/{comment.author.id}'), }) @@ -122,7 +120,6 @@ def post_proposal_comments(proposal_id, comment, parent_comment_id): send_email(parent.author.email_address, 'comment_reply', { 'author': g.current_user, 'proposal': proposal, - 'preview': preview, 'comment_url': make_url(f'/proposal/{proposal.id}?tab=discussions&comment={comment.id}'), 'author_url': make_url(f'/profile/{comment.author.id}'), }) @@ -328,13 +325,11 @@ def post_proposal_update(proposal_id, title, content): db.session.commit() # Send email to all contributors (even if contribution failed) - preview = make_preview(update.content, 200) contributions = ProposalContribution.query.filter_by(proposal_id=proposal_id).all() for c in contributions: send_email(c.user.email_address, 'contribution_update', { 'proposal': g.current_proposal, 'proposal_update': update, - 'preview': preview, 'update_url': make_url(f'/proposals/{proposal_id}?tab=updates&update={update.id}'), }) diff --git a/backend/grant/templates/emails/comment_reply.html b/backend/grant/templates/emails/comment_reply.html index 8079fb9e..36cb19a5 100644 --- a/backend/grant/templates/emails/comment_reply.html +++ b/backend/grant/templates/emails/comment_reply.html @@ -1,11 +1,7 @@

You just received a reply from {{ args.author.display_name }} - on {{ args.proposal.title }}: -

- -

- “{{ args.preview }}” + on {{ args.proposal.title }}.

diff --git a/backend/grant/templates/emails/comment_reply.txt b/backend/grant/templates/emails/comment_reply.txt index 6dca6088..f9855e86 100644 --- a/backend/grant/templates/emails/comment_reply.txt +++ b/backend/grant/templates/emails/comment_reply.txt @@ -1,6 +1,4 @@ You just received a reply from {{ args.author.display_name }} on {{ args.proposal.title }}: -> {{ args.preview }} - Go here to see their response: {{ args.comment_url }} Go here to see their profile: {{ args.author_url }} \ No newline at end of file diff --git a/backend/grant/templates/emails/contribution_update.html b/backend/grant/templates/emails/contribution_update.html index dbd778bd..6a0855d2 100644 --- a/backend/grant/templates/emails/contribution_update.html +++ b/backend/grant/templates/emails/contribution_update.html @@ -1,15 +1,8 @@ -

+

A proposal you follow, {{ args.proposal.title }}, has - posted an update: + posted an update entitled "{{ args.proposal_update.title }}"

-
-

- {{ args.proposal_update.title }} -

-

{{ args.preview }}

-
-
@@ -29,4 +22,3 @@
@@ -17,11 +10,11 @@
- View the full update + Read the Update
- \ No newline at end of file diff --git a/backend/grant/templates/emails/contribution_update.txt b/backend/grant/templates/emails/contribution_update.txt index ece6a66e..384b05ae 100644 --- a/backend/grant/templates/emails/contribution_update.txt +++ b/backend/grant/templates/emails/contribution_update.txt @@ -1,2 +1,4 @@ -A proposal you follow, "{{ args.proposal.title }}", has posted an update. -Go here to view it in full: {{ args.update_url }} \ No newline at end of file +A proposal you follow, "{{ args.proposal.title }}", has posted an update +entitled "{{ args.proposal_update.title }}". + +Go here to read it: {{ args.update_url }} \ No newline at end of file diff --git a/backend/grant/templates/emails/proposal_comment.html b/backend/grant/templates/emails/proposal_comment.html index 54f3257d..dd5b7a4e 100644 --- a/backend/grant/templates/emails/proposal_comment.html +++ b/backend/grant/templates/emails/proposal_comment.html @@ -1,10 +1,6 @@

Your proposal {{ args.proposal.title }} just received a comment from - {{ args.author.display_name }}: -

- -

- “{{ args.preview }}” + {{ args.author.display_name }}.

diff --git a/backend/grant/templates/emails/proposal_comment.txt b/backend/grant/templates/emails/proposal_comment.txt index e60339c1..ca7d31a4 100644 --- a/backend/grant/templates/emails/proposal_comment.txt +++ b/backend/grant/templates/emails/proposal_comment.txt @@ -1,6 +1,4 @@ -Your proposal "{{ args.proposal.title }}" just received a comment from {{ args.author.display_name }}: - -> {{ args.preview }} +Your proposal "{{ args.proposal.title }}" just received a comment from {{ args.author.display_name }}. Go here to see their comment: {{ args.comment_url }} Go here to see their profile: {{ args.author_url }} \ No newline at end of file