This commit is contained in:
Élie Bouttier 2014-08-20 17:33:15 -07:00
parent fe297c8a7d
commit e75383bb2f
4 changed files with 25 additions and 17 deletions

View file

@ -16,7 +16,7 @@ from colorful.fields import RGBColorField
import json
from issue.templatetags.issue_tags import same_milestone, same_label, label_style, labeled
from issue.templatetags.issue_tags import *
class User(auth.models.User):
@ -342,8 +342,10 @@ class Event(models.Model):
action = 'removed'
description = '%s the <a href="%s" class="label" ' \
'style="%s">%s</a> label' \
% (action, same_label(label), label_style(label), label)
elif self.code == Event.SET_MILESTONE or self.code == Event.UNSET_MILESTONE:
% (action, same_label(label),
label_style(label), label)
elif self.code == Event.SET_MILESTONE \
or self.code == Event.UNSET_MILESTONE:
milestone = Milestone(name=args['milestone'],
project=self.issue.project)
if self.code == Event.SET_MILESTONE:

View file

@ -32,8 +32,8 @@ def notify_new_issue(issue):
c = {
'description': issue.description,
'uri': settings.BASE_URL \
+ reverse('show-issue', args=[project.name, issue.id]),
'uri': settings.BASE_URL + reverse('show-issue',
args=[project.name, issue.id]),
}
message = render_to_string('emails/new_issue.html', c)
@ -85,8 +85,8 @@ def notify_event(event, template):
c = {
'comment': event.additionnal_section,
'uri': settings.BASE_URL \
+ reverse('show-issue', args=[project.name, issue.id]),
'uri': settings.BASE_URL + reverse('show-issue',
args=[project.name, issue.id]),
}
message = render_to_string('emails/%s.html' % template, c)

View file

@ -14,6 +14,7 @@ def boolean(value):
return mark_safe('<span class="glyphicon glyphicon-'
+ glyph + '" style="vertical-align: middle;"></span>')
@register.filter
def first_few(items, arg='item', max_items=5):
if items.exists():

View file

@ -938,11 +938,13 @@ def project_subscribe(request, project):
user = User.objects.get(username=request.user.username)
if project.subscribers.filter(username=user.username).exists():
messages.warning(request, 'You are already subscribed to this project.')
messages.warning(request,
'You are already subscribed to this project.')
else:
project.subscribers.add(user)
project.save()
messages.success(request, 'You have been subscribed to this project successfully.')
messages.success(request,
'You have been subscribed to this project successfully.')
next = request.GET.get('next')
if next:
@ -959,7 +961,8 @@ def project_unsubscribe(request, project):
if project.subscribers.filter(username=user.username).exists():
project.subscribers.remove(user)
project.save()
messages.success(request, 'You will not receive any notifications for this project anymore.')
messages.success(request, 'You will not receive any notifications '
'for this project anymore.')
else:
messages.warning(request, 'You are not subscribed to this project.')
@ -981,7 +984,8 @@ def issue_subscribe(request, project, issue):
else:
issue.subscribers.add(user)
issue.save()
messages.success(request, 'You have been subscribed to this issue successfully.')
messages.success(request,
'You have been subscribed to this issue successfully.')
return redirect('show-issue', project.name, issue.id)
@ -995,7 +999,8 @@ def issue_unsubscribe(request, project, issue):
if issue.subscribers.filter(username=user.username).exists():
issue.subscribers.remove(user)
issue.save()
messages.success(request, 'You will not receive any notifications for this issue anymore.')
messages.success(request, 'You will not receive any notifications '
'for this issue anymore.')
else:
messages.warning(request, 'You are not subscribed to this issue.')