Browse Source

Fixed check on PT invitation

Ralfp 12 years ago
parent
commit
04df44dfb4
2 changed files with 3 additions and 4 deletions
  1. 1 1
      misago/apps/privatethreads/forms.py
  2. 2 3
      misago/apps/privatethreads/jumps.py

+ 1 - 1
misago/apps/privatethreads/forms.py

@@ -28,7 +28,7 @@ class InviteUsersMixin(object):
                     if not user.acl(self.request).private_threads.can_participate():
                         raise forms.ValidationError(_('%(user)s cannot participate in private threads.') % {'user': user.username})
                     if (not self.request.acl.private_threads.can_invite_ignoring() and
-                        not user.allow_pd_invite(self.request.user)):
+                            not user.allow_pd_invite(self.request.user)):
                         raise forms.ValidationError(_('%(user)s restricts who can invite him to private threads.') % {'user': user.username})
                     self.invite_users.append(user)
                 except User.DoesNotExist:

+ 2 - 3
misago/apps/privatethreads/jumps.py

@@ -59,7 +59,7 @@ class InviteUserView(JumpView, TypeMixin):
                     self.request.messages.set_flash(Message(_('You cannot add yourself to this thread.')), 'error', 'threads')
                 else:
                     self.request.messages.set_flash(Message(_('%(user)s is already participating in this thread.') % {'user': user.username}), 'info', 'threads')
-            if not acl.private_threads.can_participate():
+            elif not acl.private_threads.can_participate():
                     self.request.messages.set_flash(Message(_('%(user)s cannot participate in private threads.') % {'user': user.username}), 'info', 'threads')
             elif (not self.request.acl.private_threads.can_invite_ignoring() and
                     not user.allow_pd_invite(self.request.user)):
@@ -72,10 +72,9 @@ class InviteUserView(JumpView, TypeMixin):
                 self.thread.last_post.set_checkpoint(self.request, 'invited', user)
                 self.thread.last_post.save(force_update=True)
                 self.request.messages.set_flash(Message(_('%(user)s has been added to this thread.') % {'user': user.username}), 'success', 'threads')
-            return self.retreat_redirect()
         except User.DoesNotExist:
             self.request.messages.set_flash(Message(_('User with requested username could not be found.')), 'error', 'threads')
-            return self.retreat_redirect()
+        return self.retreat_redirect()
 
 
 class RemoveUserView(JumpView, TypeMixin):