mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-06-30 02:40:39 +00:00
Merge pull request #2164 from bookwyrm-social/federated-servers-admin
Federated servers admin
This commit is contained in:
commit
13605b7d6a
|
@ -3,4 +3,7 @@ ignore=migrations
|
||||||
load-plugins=pylint.extensions.no_self_use
|
load-plugins=pylint.extensions.no_self_use
|
||||||
|
|
||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
disable=E1101,E1135,E1136,R0903,R0901,R0902,W0707,W0511,W0406,R0401,R0801,C3001
|
disable=E1101,E1135,E1136,R0903,R0901,R0902,W0707,W0511,W0406,R0401,R0801,C3001,import-error
|
||||||
|
|
||||||
|
[FORMAT]
|
||||||
|
max-line-length=88
|
||||||
|
|
|
@ -24,5 +24,5 @@ class CalibreImporter(Importer):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def get_shelf(self, normalized_row):
|
def get_shelf(self, normalized_row):
|
||||||
# Calibre export does not indicate which shelf to use. Go with a default one for now
|
# Calibre export does not indicate which shelf to use. Use a default one for now
|
||||||
return Shelf.TO_READ
|
return Shelf.TO_READ
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
{% block filter_fields %}
|
{% block filter_fields %}
|
||||||
{% include 'settings/federation/software_filter.html' %}
|
{% include 'settings/federation/software_filter.html' %}
|
||||||
|
{% include 'settings/users/server_filter.html' %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ class PostgresTriggers(TestCase):
|
||||||
)
|
)
|
||||||
book.authors.add(author)
|
book.authors.add(author)
|
||||||
book.refresh_from_db()
|
book.refresh_from_db()
|
||||||
|
# pylint: disable=line-too-long
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
book.search_vector,
|
book.search_vector,
|
||||||
"'cool':5B 'goodby':3A 'long':2A 'name':9 'rays':7C 'seri':8 'the':6C 'wow':4B",
|
"'cool':5B 'goodby':3A 'long':2A 'name':9 'rays':7C 'seri':8 'the':6C 'wow':4B",
|
||||||
|
|
|
@ -106,7 +106,7 @@ def find_authors_by_name(name_string, description=False):
|
||||||
|
|
||||||
if titles:
|
if titles:
|
||||||
# some of the "titles" in ISNI are a little ...iffy
|
# some of the "titles" in ISNI are a little ...iffy
|
||||||
# '@' is used by ISNI/OCLC to index the starting point ignoring stop words
|
# @ is used by ISNI/OCLC to index the starting point ignoring stop words
|
||||||
# (e.g. "The @Government of no one")
|
# (e.g. "The @Government of no one")
|
||||||
title_elements = [
|
title_elements = [
|
||||||
e
|
e
|
||||||
|
|
|
@ -29,6 +29,8 @@ class Federation(View):
|
||||||
filters = {}
|
filters = {}
|
||||||
if software := request.GET.get("application_type"):
|
if software := request.GET.get("application_type"):
|
||||||
filters["application_type"] = software
|
filters["application_type"] = software
|
||||||
|
if server := request.GET.get("server"):
|
||||||
|
filters["server_name"] = server
|
||||||
|
|
||||||
servers = models.FederatedServer.objects.filter(status=status, **filters)
|
servers = models.FederatedServer.objects.filter(status=status, **filters)
|
||||||
|
|
||||||
|
@ -60,7 +62,9 @@ class Federation(View):
|
||||||
"sort": sort,
|
"sort": sort,
|
||||||
"software_options": models.FederatedServer.objects.values_list(
|
"software_options": models.FederatedServer.objects.values_list(
|
||||||
"application_type", flat=True
|
"application_type", flat=True
|
||||||
).distinct(),
|
)
|
||||||
|
.distinct()
|
||||||
|
.order_by("application_type"),
|
||||||
"form": forms.ServerForm(),
|
"form": forms.ServerForm(),
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, "settings/federation/instance_list.html", data)
|
return TemplateResponse(request, "settings/federation/instance_list.html", data)
|
||||||
|
|
|
@ -22,19 +22,16 @@ class UserAdminList(View):
|
||||||
def get(self, request, status="local"):
|
def get(self, request, status="local"):
|
||||||
"""list of users"""
|
"""list of users"""
|
||||||
filters = {}
|
filters = {}
|
||||||
server = request.GET.get("server")
|
if server := request.GET.get("server"):
|
||||||
if server:
|
|
||||||
server = models.FederatedServer.objects.filter(server_name=server).first()
|
server = models.FederatedServer.objects.filter(server_name=server).first()
|
||||||
filters["federated_server"] = server
|
filters["federated_server"] = server
|
||||||
filters["federated_server__isnull"] = False
|
filters["federated_server__isnull"] = False
|
||||||
username = request.GET.get("username")
|
if username := request.GET.get("username"):
|
||||||
if username:
|
|
||||||
filters["username__icontains"] = username
|
filters["username__icontains"] = username
|
||||||
scope = request.GET.get("scope")
|
scope = request.GET.get("scope")
|
||||||
if scope and scope == "local":
|
if scope and scope == "local":
|
||||||
filters["local"] = True
|
filters["local"] = True
|
||||||
email = request.GET.get("email")
|
if email := request.GET.get("email"):
|
||||||
if email:
|
|
||||||
filters["email__endswith"] = email
|
filters["email__endswith"] = email
|
||||||
|
|
||||||
filters["local"] = status == "local"
|
filters["local"] = status == "local"
|
||||||
|
|
|
@ -89,7 +89,7 @@ services:
|
||||||
command: celery -A celerywyrm flower --basic_auth=${FLOWER_USER}:${FLOWER_PASSWORD}
|
command: celery -A celerywyrm flower --basic_auth=${FLOWER_USER}:${FLOWER_PASSWORD}
|
||||||
env_file: .env
|
env_file: .env
|
||||||
ports:
|
ports:
|
||||||
- ${FLOWER_PORT}
|
- ${FLOWER_PORT}:${FLOWER_PORT}
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
networks:
|
networks:
|
||||||
|
|
Loading…
Reference in a new issue