lint raise_visible_to_user

Don't return True unnecessarily
This commit is contained in:
Hugh Rundle 2021-10-05 08:09:24 +11:00
parent da53bad0f5
commit 78f5003407

View file

@ -79,14 +79,14 @@ class BookWyrmModel(models.Model):
and self.mention_users.filter(id=viewer.id).first() and self.mention_users.filter(id=viewer.id).first()
): ):
return True return
# you can see groups of which you are a member # you can see groups of which you are a member
if ( if (
hasattr(self, "memberships") hasattr(self, "memberships")
and self.memberships.filter(user=viewer).exists() and self.memberships.filter(user=viewer).exists()
): ):
return True return
# you can see objects which have a group of which you are a member # you can see objects which have a group of which you are a member
if hasattr(self, "group"): if hasattr(self, "group"):
@ -94,7 +94,7 @@ class BookWyrmModel(models.Model):
hasattr(self.group, "memberships") hasattr(self.group, "memberships")
and self.group.memberships.filter(user=viewer).exists() and self.group.memberships.filter(user=viewer).exists()
): ):
return True return
raise Http404() raise Http404()