Просмотр исходного кода

fixed permission check on edition

Rafał Pitoń 10 лет назад
Родитель
Сommit
350f39587d
2 измененных файлов с 6 добавлено и 6 удалено
  1. 3 3
      misago/threads/permissions.py
  2. 3 3
      misago/threads/views/posting.py

+ 3 - 3
misago/threads/permissions.py

@@ -426,9 +426,6 @@ def allow_edit_post(user, target):
         raise PermissionDenied(
             _("You can't edit posts in closed threads."))
 
-    if target.is_protected and not forum_acl['can_protect_posts']:
-        raise PermissionDenied(_("This post is protected. You can't edit it."))
-
     if forum_acl['can_edit_posts'] == 1:
         if target.poster_id != user.pk:
             raise PermissionDenied(
@@ -441,6 +438,9 @@ def allow_edit_post(user, target):
                                 forum_acl['post_edit_time'])
             raise PermissionDenied(
                 message % {'minutes': forum_acl['post_edit_time']})
+
+    if target.is_protected and not forum_acl['can_protect_posts']:
+        raise PermissionDenied(_("This post is protected. You can't edit it."))
 can_edit_post = return_boolean(allow_edit_post)
 
 

+ 3 - 3
misago/threads/views/posting.py

@@ -14,7 +14,7 @@ from misago.threads.posting import (PostingInterrupt, EditorFormset,
                                     START, REPLY, EDIT)
 from misago.threads.models import Thread, Post, Label
 from misago.threads.permissions import (allow_start_thread, allow_reply_thread,
-                                        can_edit_post)
+                                        allow_edit_post)
 from misago.threads.views.generic.base import ViewBase
 
 
@@ -81,7 +81,7 @@ class PostingView(ViewBase):
         allow_reply_thread(user, thread)
 
     def allow_edit(self, user, post):
-        can_edit_post(user, post)
+        allow_edit_post(user, post)
 
     def dispatch(self, request, *args, **kwargs):
         if request.method == 'POST':
@@ -115,7 +115,7 @@ class PostingView(ViewBase):
                         formset.save()
 
                         if mode == EDIT:
-                            message = _("Message was edited.")
+                            message = _("Changes saved.")
                         else:
                             if mode == START:
                                 message = _("New thread was posted.")