From beb5e1f11e75b64e445c850ebbe9b5065a679cbb Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 1 Nov 2020 11:59:51 -0800 Subject: [PATCH 1/3] Show empty string, not "None" for books with no text --- bookwyrm/templatetags/fr_display.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templatetags/fr_display.py b/bookwyrm/templatetags/fr_display.py index 0595ff522..52cb3c47e 100644 --- a/bookwyrm/templatetags/fr_display.py +++ b/bookwyrm/templatetags/fr_display.py @@ -116,7 +116,7 @@ def get_book_description(book): def text_overflow(text): ''' dont' let book descriptions run for ages ''' if not text: - return + return '' char_max = 500 if text and len(text) < char_max: return text From a2692f92d24ae8382e95999053e6d459a10e0369 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 1 Nov 2020 12:07:51 -0800 Subject: [PATCH 2/3] Fixes logic issues in saving user model --- bookwyrm/models/user.py | 6 +++--- bookwyrm/outgoing.py | 9 +++++++-- bookwyrm/templates/layout.html | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index bebd55406..6043faf46 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -172,13 +172,13 @@ class User(OrderedCollectionPageMixin, AbstractUser): ''' populate fields for new local users ''' # this user already exists, no need to populate fields if self.id: - return + return super().save(*args, **kwargs) if not self.local: # generate a username that uses the domain (webfinger format) actor_parts = urlparse(self.remote_id) self.username = '%s@%s' % (self.username, actor_parts.netloc) - return + return super().save(*args, **kwargs) # populate fields for local users self.remote_id = 'https://%s/user/%s' % (DOMAIN, self.username) @@ -191,7 +191,7 @@ class User(OrderedCollectionPageMixin, AbstractUser): if not self.private_key: self.private_key, self.public_key = create_key_pair() - super().save(*args, **kwargs) + return super().save(*args, **kwargs) @receiver(models.signals.post_save, sender=User) diff --git a/bookwyrm/outgoing.py b/bookwyrm/outgoing.py index 95b89d9f9..e9daa8fae 100644 --- a/bookwyrm/outgoing.py +++ b/bookwyrm/outgoing.py @@ -37,10 +37,15 @@ def outbox(request, username): def handle_remote_webfinger(query): - ''' webfingerin' other servers, username query should be user@domain ''' + ''' webfingerin' other servers ''' user = None + + # usernames could be @user@domain or user@domain + if query[0] == '@': + query = query[1:] + try: - domain = query.split('@')[2] + domain = query.split('@')[1] except IndexError: return None diff --git a/bookwyrm/templates/layout.html b/bookwyrm/templates/layout.html index 553806528..dfe483279 100644 --- a/bookwyrm/templates/layout.html +++ b/bookwyrm/templates/layout.html @@ -27,7 +27,7 @@