diff --git a/tcms/bugs/templates/bugs/get.html b/tcms/bugs/templates/bugs/get.html
index 9886405033..6df60e82cd 100644
--- a/tcms/bugs/templates/bugs/get.html
+++ b/tcms/bugs/templates/bugs/get.html
@@ -148,7 +148,7 @@
{% endfor %}
- {% if perms.django_comments.add_comment %}
+ {% if perms.django_comments.add_comment and object.status %}
@@ -163,7 +163,11 @@
diff --git a/tcms/bugs/views.py b/tcms/bugs/views.py
index 66caa7ae2d..4ae5284247 100644
--- a/tcms/bugs/views.py
+++ b/tcms/bugs/views.py
@@ -11,6 +11,7 @@
from django.views.generic import DetailView
from django.views.generic.base import TemplateView
from django.views.generic.base import View
+from django.utils.translation import ugettext_lazy as _
from tcms.bugs.models import Bug
from tcms.management.models import Component
@@ -133,7 +134,13 @@ def post(self, request, *args, **kwargs):
if form.is_valid():
bug = form.cleaned_data['bug']
- add_comment([bug], form.cleaned_data['text'], request.user)
+ if form.cleaned_data['text']:
+ add_comment([bug], form.cleaned_data['text'], request.user)
+
+ if request.POST.get('action') == 'close':
+ bug.status = False
+ bug.save()
+ add_comment([bug], _('*bug closed*'), request.user)
return HttpResponseRedirect(reverse('bugs-get', args=[bug.pk]))