|
16 | 16 | from indico.util.placeholders import replace_placeholders |
17 | 17 | from indico.util.rules import Condition, check_rule |
18 | 18 | from indico.web.flask.templating import get_template_module |
19 | | - |
| 19 | +from indico.web.util import url_for_index |
| 20 | +from indico.web.flask.util import url_for |
20 | 21 |
|
21 | 22 | class EmailNotificationCondition(Condition): |
22 | 23 | #: Override if you want to customize the text |
@@ -176,3 +177,34 @@ def send_abstract_notifications(abstract): |
176 | 177 | if email_tpl.stop_on_match and matched: |
177 | 178 | break |
178 | 179 | return sent |
| 180 | + |
| 181 | +def send_abstract_comment(abstract, comment): |
| 182 | + """Send comment about an abstract. |
| 183 | +
|
| 184 | + :param abstract: the abstract that is going to be checked |
| 185 | + against the event's notification rules |
| 186 | + :param comment: new comment |
| 187 | + """ |
| 188 | + title = abstract.title |
| 189 | + url = url_for('abstracts.display_abstract', abstract, management=False, _external=True) |
| 190 | + text = comment["text"] |
| 191 | + |
| 192 | + contact = "contact@linuxplumbersconf.org" |
| 193 | + authors = [author.email for author in abstract.primary_authors] |
| 194 | + authors += [author.email for author in abstract.secondary_authors] |
| 195 | + |
| 196 | + body = """ |
| 197 | +A new comment has been added to submission "%s": |
| 198 | +
|
| 199 | +%s |
| 200 | +
|
| 201 | +You can review and respond at the submission page |
| 202 | +%s |
| 203 | +or reply to this email |
| 204 | +""" % (title, text, url) |
| 205 | + |
| 206 | + email = make_email(to_list=[ contact ], cc_list=authors, |
| 207 | + subject="LPC: Comment added to your submission", |
| 208 | + reply_address=contact, body=body) |
| 209 | + send_email(email, abstract.event, 'Abstracts', session.user) |
| 210 | + abstract.email_logs.append(AbstractEmailLogEntry.create_from_email(email, email_tpl=None, user=session.user)) |
0 commit comments