From 1211fda7ff82a2eca793981cb5fbddda4643af5b Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Mon, 29 Nov 2021 19:53:13 +1100 Subject: [PATCH] beautiful code quality, pylint will be pleased --- bookwyrm/templates/ostatus/template.html | 2 +- bookwyrm/views/follow.py | 19 ++++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/bookwyrm/templates/ostatus/template.html b/bookwyrm/templates/ostatus/template.html index 1dbb32a36..7d670b0a5 100644 --- a/bookwyrm/templates/ostatus/template.html +++ b/bookwyrm/templates/ostatus/template.html @@ -33,7 +33,7 @@ diff --git a/bookwyrm/views/follow.py b/bookwyrm/views/follow.py index 11bff60a3..7af8b0db7 100644 --- a/bookwyrm/views/follow.py +++ b/bookwyrm/views/follow.py @@ -113,22 +113,13 @@ def ostatus_follow_request(request): if request.user.id: # you have blocked them so you probably don't want to follow - if ( - hasattr(request.user, "blocks") - and user in request.user.blocks.all() - ): + if hasattr(request.user, "blocks") and user in request.user.blocks.all(): error = "is_blocked" # they have blocked you - if ( - hasattr(user, "blocks") - and request.user in user.blocks.all() - ): + if hasattr(user, "blocks") and request.user in user.blocks.all(): error = "has_blocked" # you're already following them - if ( - hasattr(user, "followers") - and request.user in user.followers.all() - ): + if hasattr(user, "followers") and request.user in user.followers.all(): error = "already_following" # you're not following yet but you already asked if ( @@ -165,8 +156,6 @@ def remote_follow(request): if template is None: data = {"account": remote_user, "user": None, "error": "remote_subscribe"} return TemplateResponse(request, "ostatus/subscribe.html", data) - user = get_object_or_404( - models.User, id=request.POST.get("user") - ) + user = get_object_or_404(models.User, id=request.POST.get("user")) url = template.replace("{uri}", urllib.parse.quote(user.remote_id)) return redirect(url)