Remove notification on ticket close

master
Alice 8 years ago
parent 2e0e49f7d6
commit 0fa2d450fd

@ -6,15 +6,7 @@ from django.utils import formats
from .models import Ticket, TicketMessage, TicketNotifyAddress from .models import Ticket, TicketMessage, TicketNotifyAddress
def close_without_notice(modeladmin, request, queryset):
queryset.update(is_open=False, closed=timezone.now())
close_without_notice.short_description = _("Close selected tickets (without notice)")
def close_tickets(modeladmin, request, queryset): def close_tickets(modeladmin, request, queryset):
for t in queryset:
if t.is_open:
t.notify_close()
queryset.update(is_open=False, closed=timezone.now()) queryset.update(is_open=False, closed=timezone.now())
close_tickets.short_description = _("Close selected tickets") close_tickets.short_description = _("Close selected tickets")
@ -38,7 +30,7 @@ class TicketAdmin(admin.ModelAdmin):
list_display = ('subject', 'user', 'created', 'category', 'is_open') list_display = ('subject', 'user', 'created', 'category', 'is_open')
list_filter = ('category', 'is_open') list_filter = ('category', 'is_open')
search_fields = ('subject', 'user__username', 'message_set__message') search_fields = ('subject', 'user__username', 'message_set__message')
actions = (close_tickets, close_without_notice) actions = (close_tickets,)
inlines = (TicketMessageAdmin,) inlines = (TicketMessageAdmin,)
def user_link(self, object): def user_link(self, object):

@ -77,12 +77,6 @@ class Ticket(models.Model):
return return
notify(subject, 'tickets/mail_user_reply.txt', [self.user.email], ctx) notify(subject, 'tickets/mail_user_reply.txt', [self.user.email], ctx)
def notify_close(self):
url = ROOT_URL + reverse('tickets:view', args=(self.id,))
subject = _("Ticket:") + " " + self.subject
ctx = dict(ticket=self, url=url)
notify(subject, 'tickets/mail_user_close.txt', [self.user.email], ctx)
def __str__(self): def __str__(self):
return self.subject return self.subject

@ -128,7 +128,6 @@ def view(request, id):
ticket.is_open = False ticket.is_open = False
ticket.closed = timezone.now() ticket.closed = timezone.now()
ticket.save() ticket.save()
ticket.notify_close()
return redirect('tickets:view', id=ticket.id) return redirect('tickets:view', id=ticket.id)
if request.POST.get('reopen') or request.POST.get('button_reopen'): if request.POST.get('reopen') or request.POST.get('button_reopen'):

Loading…
Cancel
Save