|
@@ -7,7 +7,20 @@ from misago.models import Forum, Thread, Post
|
|
|
from misago.apps.reports.mixins import TypeMixin
|
|
|
from misago.apps.reports.forms import EditThreadForm, NewReplyForm, EditReplyForm
|
|
|
|
|
|
-class EditThreadView(EditThreadBaseView, TypeMixin):
|
|
|
+class SetStateCheckpointMixin(object):
|
|
|
+ def post_form(self, form):
|
|
|
+ self.thread.original_weight = self.thread_weight
|
|
|
+ super(SetStateCheckpointMixin, self).post_form(form)
|
|
|
+ if self.thread.original_weight != self.thread_weight:
|
|
|
+ if self.thread.original_weight == 2:
|
|
|
+ self.request.monitor.decrease('reported_posts')
|
|
|
+ if self.thread.weight == 1:
|
|
|
+ self.thread.last_post.set_checkpoint(self.request, 'resolved')
|
|
|
+ if self.thread.weight == 0:
|
|
|
+ self.thread.last_post.set_checkpoint(self.request, 'bogus')
|
|
|
+
|
|
|
+
|
|
|
+class EditThreadView(SetStateCheckpointMixin, EditThreadBaseView, TypeMixin):
|
|
|
form_type = EditThreadForm
|
|
|
|
|
|
def response(self):
|
|
@@ -15,7 +28,7 @@ class EditThreadView(EditThreadBaseView, TypeMixin):
|
|
|
return redirect(reverse('report', kwargs={'thread': self.thread.pk, 'slug': self.thread.slug}) + ('#post-%s' % self.post.pk))
|
|
|
|
|
|
|
|
|
-class NewReplyView(NewReplyBaseView, TypeMixin):
|
|
|
+class NewReplyView(SetStateCheckpointMixin, NewReplyBaseView, TypeMixin):
|
|
|
form_type = NewReplyForm
|
|
|
|
|
|
def response(self):
|
|
@@ -23,7 +36,7 @@ class NewReplyView(NewReplyBaseView, TypeMixin):
|
|
|
return self.redirect_to_post(self.post)
|
|
|
|
|
|
|
|
|
-class EditReplyView(EditReplyBaseView, TypeMixin):
|
|
|
+class EditReplyView(SetStateCheckpointMixin, EditReplyBaseView, TypeMixin):
|
|
|
form_type = EditReplyForm
|
|
|
|
|
|
def response(self):
|