mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-13 19:56:36 +00:00
Merge branch 'main' into production
This commit is contained in:
commit
7db77c690e
5 changed files with 14 additions and 7 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</a>
|
||||
<form class="navbar-item" action="/search/">
|
||||
<div class="field is-grouped">
|
||||
<input class="input" type="text" name="q" placeholder="Search for a book or user">
|
||||
<input class="input" type="text" name="q" placeholder="Search for a book or user" value="{{ query }}">
|
||||
<button class="button" type="submit">
|
||||
<span class="icon icon-search">
|
||||
<span class="is-sr-only">search</span>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{% load fr_display %}
|
||||
{% with book|book_description as full %}
|
||||
{% if full %}
|
||||
{% with full|text_overflow as trimmed %}
|
||||
{% if trimmed != full %}
|
||||
<div>
|
||||
|
@ -17,4 +18,5 @@
|
|||
</blockquote>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue