diff --git a/bookwyrm/templates/settings/federated_server.html b/bookwyrm/templates/settings/federated_server.html index 0f18f6ac..520ab5dc 100644 --- a/bookwyrm/templates/settings/federated_server.html +++ b/bookwyrm/templates/settings/federated_server.html @@ -89,8 +89,10 @@ {% csrf_token %} {% if server.status != 'blocked' %} +

{% trans "All users from this instance will be deactivated." %}

{% else %} +

{% trans "All users from this instance will be re-activated." %}

{% endif %} diff --git a/bookwyrm/views/federation.py b/bookwyrm/views/federation.py index 09f5040d..83bed32d 100644 --- a/bookwyrm/views/federation.py +++ b/bookwyrm/views/federation.py @@ -36,7 +36,9 @@ class Federation(View): paginated = Paginator(servers, PAGE_LENGTH) data = { - "servers": paginated.page(page), "sort": sort, "form": forms.ServerForm() + "servers": paginated.page(page), + "sort": sort, + "form": forms.ServerForm(), } return TemplateResponse(request, "settings/federation.html", data) @@ -93,4 +95,11 @@ class FederatedServer(View): server = get_object_or_404(models.FederatedServer, id=server) server.status = "blocked" if server.status == "federated" else "federated" server.save() + + # TODO: there needs to be differentiation between types of deactivated users + if server.status == "blocked": + server.user_set.update(is_active=False) + else: + server.user_set.update(is_active=True) + return redirect("settings-federated-server", server.id) diff --git a/bookwyrm/views/inbox.py b/bookwyrm/views/inbox.py index 387efe9f..7997bd5c 100644 --- a/bookwyrm/views/inbox.py +++ b/bookwyrm/views/inbox.py @@ -70,7 +70,7 @@ def is_blocked_user_agent(request): user_agent = request.headers.get("User-Agent") if not user_agent: return False - url = re.search(r"+https?://{:s}/?".format(regex.domain), user_agent) + url = re.search(r"https?://{:s}/?".format(regex.domain), user_agent).group() domain = urlparse(url).netloc if not domain: # idk, we'll try again later with the actor