Browse Source

little dead code elimination

Rafał Pitoń 8 years ago
parent
commit
5fdd8b25eb

+ 0 - 3
misago/categories/models.py

@@ -112,9 +112,6 @@ class Category(MPTTModel):
     def __str__(self):
         return six.text_type(self.thread_type.get_category_name(self))
 
-    def lock(self):
-        return Category.objects.select_for_update().get(id=self.id)
-
     def delete(self, *args, **kwargs):
         Category.objects.clear_cache()
         acl_version.invalidate()

+ 0 - 2
misago/threads/api/threadposts.py

@@ -150,8 +150,6 @@ class ViewSet(viewsets.ViewSet):
         else:
             return Response(posting.errors, status=400)
 
-        return Response({})
-
     @transaction.atomic
     def partial_update(self, request, thread_pk, pk):
         thread = self.get_thread_for_update(request, thread_pk)

+ 3 - 0
misago/threads/permissions/privatethreads.py

@@ -231,6 +231,9 @@ can_add_participants = return_boolean(allow_add_participants)
 
 
 def allow_remove_participants(user, target):
+    if user == target:
+        return # we can always remove ourselves
+
     if not target.participant or not target.participant.is_owner:
         raise PermissionDenied(
             _("You have to be thread owner to remove participants from it."))

+ 0 - 8
misago/users/tests/test_avatars.py

@@ -141,14 +141,6 @@ class UploadedAvatarTests(TestCase):
                     'zoom': 2
                 })
 
-            uploaded.clean_crop(image, {
-                    'offset': {
-                        'x': 0,
-                        'y': 0,
-                    },
-                    'zoom': 0
-                })
-
     def test_uploaded_image_size_validation(self):
         """uploaded image size is validated"""
         image = MockAvatarFile(size=settings.avatar_upload_limit * 2024)