Merge pull request #150 from grant-project/no-previews
No previews in emails
This commit is contained in:
commit
257a8bd21d
|
@ -80,7 +80,6 @@ example_email_args = {
|
||||||
'proposal_comment': {
|
'proposal_comment': {
|
||||||
'author': user,
|
'author': user,
|
||||||
'proposal': proposal,
|
'proposal': proposal,
|
||||||
'preview': 'Blah blah blah blah blah...',
|
|
||||||
'comment_url': 'http://somecomment.com',
|
'comment_url': 'http://somecomment.com',
|
||||||
'author_url': 'http://someuser.com',
|
'author_url': 'http://someuser.com',
|
||||||
},
|
},
|
||||||
|
@ -92,13 +91,11 @@ example_email_args = {
|
||||||
'contribution_update': {
|
'contribution_update': {
|
||||||
'proposal': proposal,
|
'proposal': proposal,
|
||||||
'proposal_update': update,
|
'proposal_update': update,
|
||||||
'preview': 'Blah blah blah blah blah blah blah blah blah blah blah blah blah blah...',
|
|
||||||
'update_url': 'http://someupdate.com',
|
'update_url': 'http://someupdate.com',
|
||||||
},
|
},
|
||||||
'comment_reply': {
|
'comment_reply': {
|
||||||
'author': user,
|
'author': user,
|
||||||
'proposal': proposal,
|
'proposal': proposal,
|
||||||
'preview': 'Blah blah blah blah blah...',
|
|
||||||
'comment_url': 'http://somecomment.com',
|
'comment_url': 'http://somecomment.com',
|
||||||
'author_url': 'http://someuser.com',
|
'author_url': 'http://someuser.com',
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,7 +15,7 @@ from grant.utils.auth import (
|
||||||
internal_webhook
|
internal_webhook
|
||||||
)
|
)
|
||||||
from grant.utils.exceptions import ValidationException
|
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 grant.utils.enums import ProposalStatus, ContributionStatus
|
||||||
from sqlalchemy import or_
|
from sqlalchemy import or_
|
||||||
|
|
||||||
|
@ -107,13 +107,11 @@ def post_proposal_comments(proposal_id, comment, parent_comment_id):
|
||||||
dumped_comment = comment_schema.dump(comment)
|
dumped_comment = comment_schema.dump(comment)
|
||||||
|
|
||||||
# TODO: Email proposal team if top-level comment
|
# TODO: Email proposal team if top-level comment
|
||||||
preview = make_preview(comment.content, 60)
|
|
||||||
if not parent:
|
if not parent:
|
||||||
for member in proposal.team:
|
for member in proposal.team:
|
||||||
send_email(member.email_address, 'proposal_comment', {
|
send_email(member.email_address, 'proposal_comment', {
|
||||||
'author': g.current_user,
|
'author': g.current_user,
|
||||||
'proposal': proposal,
|
'proposal': proposal,
|
||||||
'preview': preview,
|
|
||||||
'comment_url': make_url(f'/proposal/{proposal.id}?tab=discussions&comment={comment.id}'),
|
'comment_url': make_url(f'/proposal/{proposal.id}?tab=discussions&comment={comment.id}'),
|
||||||
'author_url': make_url(f'/profile/{comment.author.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', {
|
send_email(parent.author.email_address, 'comment_reply', {
|
||||||
'author': g.current_user,
|
'author': g.current_user,
|
||||||
'proposal': proposal,
|
'proposal': proposal,
|
||||||
'preview': preview,
|
|
||||||
'comment_url': make_url(f'/proposal/{proposal.id}?tab=discussions&comment={comment.id}'),
|
'comment_url': make_url(f'/proposal/{proposal.id}?tab=discussions&comment={comment.id}'),
|
||||||
'author_url': make_url(f'/profile/{comment.author.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()
|
db.session.commit()
|
||||||
|
|
||||||
# Send email to all contributors (even if contribution failed)
|
# 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()
|
contributions = ProposalContribution.query.filter_by(proposal_id=proposal_id).all()
|
||||||
for c in contributions:
|
for c in contributions:
|
||||||
send_email(c.user.email_address, 'contribution_update', {
|
send_email(c.user.email_address, 'contribution_update', {
|
||||||
'proposal': g.current_proposal,
|
'proposal': g.current_proposal,
|
||||||
'proposal_update': update,
|
'proposal_update': update,
|
||||||
'preview': preview,
|
|
||||||
'update_url': make_url(f'/proposals/{proposal_id}?tab=updates&update={update.id}'),
|
'update_url': make_url(f'/proposals/{proposal_id}?tab=updates&update={update.id}'),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
<p style="margin: 0 0 20px;">
|
<p style="margin: 0 0 20px;">
|
||||||
You just received a reply from
|
You just received a reply from
|
||||||
<a href="{{ args.author_url }}" target="_blank">{{ args.author.display_name }}</a>
|
<a href="{{ args.author_url }}" target="_blank">{{ args.author.display_name }}</a>
|
||||||
on <strong>{{ args.proposal.title }}</strong>:
|
on <strong>{{ args.proposal.title }}</strong>.
|
||||||
</p>
|
|
||||||
|
|
||||||
<p style="margin: 10px 0; padding: 20px; background: #F8F8F8;">
|
|
||||||
“{{ args.preview }}”
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
You just received a reply from {{ args.author.display_name }} on {{ args.proposal.title }}:
|
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 response: {{ args.comment_url }}
|
||||||
Go here to see their profile: {{ args.author_url }}
|
Go here to see their profile: {{ args.author_url }}
|
|
@ -1,15 +1,8 @@
|
||||||
<p style="margin: 0;">
|
<p style="margin: 0 0 20px;">
|
||||||
A proposal you follow, <strong>{{ args.proposal.title }}</strong>, has
|
A proposal you follow, <strong>{{ args.proposal.title }}</strong>, has
|
||||||
posted an update:
|
posted an update entitled "<strong>{{ args.proposal_update.title }}</strong>"
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div style="margin: 10px 0; padding: 20px; background: #F8F8F8;">
|
|
||||||
<h2 style="margin: 0 0 20px 0; font-size: 20px; font-weight: bold;">
|
|
||||||
{{ args.proposal_update.title }}
|
|
||||||
</h2>
|
|
||||||
<p style="margin: 0;">{{ args.preview }}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor="#ffffff" align="center" style="padding: 40px 30px 40px 30px;">
|
<td bgcolor="#ffffff" align="center" style="padding: 40px 30px 40px 30px;">
|
||||||
|
@ -21,7 +14,7 @@
|
||||||
target="_blank"
|
target="_blank"
|
||||||
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 20px 50px; border-radius: 4px; border: 1px solid {{ UI.PRIMARY }}; display: inline-block;"
|
style="font-size: 20px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; color: #ffffff; text-decoration: none; padding: 20px 50px; border-radius: 4px; border: 1px solid {{ UI.PRIMARY }}; display: inline-block;"
|
||||||
>
|
>
|
||||||
View the full update
|
Read the Update
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -29,4 +22,3 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
A proposal you follow, "{{ args.proposal.title }}", has posted an update.
|
A proposal you follow, "{{ args.proposal.title }}", has posted an update
|
||||||
Go here to view it in full: {{ args.update_url }}
|
entitled "{{ args.proposal_update.title }}".
|
||||||
|
|
||||||
|
Go here to read it: {{ args.update_url }}
|
|
@ -1,10 +1,6 @@
|
||||||
<p style="margin: 0 0 20px;">
|
<p style="margin: 0 0 20px;">
|
||||||
Your proposal <strong>{{ args.proposal.title }}</strong> just received a comment from
|
Your proposal <strong>{{ args.proposal.title }}</strong> just received a comment from
|
||||||
<a href="{{ args.author_url }}" target="_blank">{{ args.author.display_name }}</a>:
|
<a href="{{ args.author_url }}" target="_blank">{{ args.author.display_name }}</a>.
|
||||||
</p>
|
|
||||||
|
|
||||||
<p style="margin: 10px 0; padding: 20px; background: #F8F8F8;">
|
|
||||||
“{{ args.preview }}”
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
Your proposal "{{ args.proposal.title }}" just received a comment from {{ args.author.display_name }}:
|
Your proposal "{{ args.proposal.title }}" just received a comment from {{ args.author.display_name }}.
|
||||||
|
|
||||||
> {{ args.preview }}
|
|
||||||
|
|
||||||
Go here to see their comment: {{ args.comment_url }}
|
Go here to see their comment: {{ args.comment_url }}
|
||||||
Go here to see their profile: {{ args.author_url }}
|
Go here to see their profile: {{ args.author_url }}
|
Loading…
Reference in New Issue