Verified Commit 0dc74eea authored by Baptiste Beauplat's avatar Baptiste Beauplat
Browse files

Notify uploader when a new comment is made on their package (Closes #74)

parent 8108654d
...@@ -255,7 +255,7 @@ class PackageController(BaseController): ...@@ -255,7 +255,7 @@ class PackageController(BaseController):
session.save() session.save()
redirect(url('login')) redirect(url('login'))
self._get_package(packagename) package = self._get_package(packagename)
status = constants.PACKAGE_COMMENT_STATUS_NOT_UPLOADED status = constants.PACKAGE_COMMENT_STATUS_NOT_UPLOADED
...@@ -281,10 +281,13 @@ class PackageController(BaseController): ...@@ -281,10 +281,13 @@ class PackageController(BaseController):
user = meta.session.query(User).filter_by(id=session['user_id']).one() user = meta.session.query(User).filter_by(id=session['user_id']).one()
if len(subscribers) > 0: if len(subscribers) > 0:
email = Email('comment_posted') email = Email('comment_posted')
email.send([s.user.email for s in subscribers], package=packagename, email.send([s.user.email for s in subscribers], package=packagename,
comment=self.form_result['text'], user=user) comment=self.form_result['text'], user=user, owner=False)
email = Email('comment_posted')
email.send([package.user.email], package=packagename,
comment=self.form_result['text'], user=user, owner=True)
meta.session.query(PackageVersion) \ meta.session.query(PackageVersion) \
.filter_by(id=self.form_result['package_version'])\ .filter_by(id=self.form_result['package_version'])\
......
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
<%inherit file="/base.mako"/>To: ${ c.to } <%inherit file="/base.mako"/>To: ${ c.to }
Subject: ${ _('Comment posted on %s' % c.package) } Subject: ${ _('Comment posted on %s' % c.package) }
${ _('''A comment has been posted on a package that you are subscribed to. %if not c.owner:
${ _('A comment has been posted on a package that you are subscribed to.') }
%s made the following comment about the %s package:''' % (c.user.name, c.package)) } %endif
${ _('''%s made the following comment about the %s package:''' % (c.user.name, c.package)) }
${ c.comment } ${ c.comment }
...@@ -12,6 +14,8 @@ ${ _('You can view information on the package by visiting:') } ...@@ -12,6 +14,8 @@ ${ _('You can view information on the package by visiting:') }
${ c.config['debexpo.server'] }${ h.url('package', packagename=c.package) } ${ c.config['debexpo.server'] }${ h.url('package', packagename=c.package) }
%if not c.owner:
${ _('You can change your subscription by visiting your user account settings.') } ${ _('You can change your subscription by visiting your user account settings.') }
%endif
${ _('Thanks,') } ${ _('Thanks,') }
...@@ -39,11 +39,13 @@ ...@@ -39,11 +39,13 @@
% if 'user_id' in c.session: % if 'user_id' in c.session:
% if c.session['user_id'] != c.package.user_id:
<tr> <tr>
<th>${ _('Subscribe') }:</th> <th>${ _('Subscribe') }:</th>
<td><a href="${h.url('subscribe', packagename=c.package.name)}">${ _('Edit your subscription') }</a></td> <td><a href="${h.url('subscribe', packagename=c.package.name)}">${ _('Edit your subscription') }</a></td>
</tr> </tr>
%endif
<tr> <tr>
<th>${ _('Needs a sponsor') }:</th> <th>${ _('Needs a sponsor') }:</th>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment