Merge branch 'main' into production

This commit is contained in:
Mouse Reeve 2021-05-01 07:32:30 -07:00
commit b3e369cdba
4 changed files with 17 additions and 13 deletions

View file

@ -29,8 +29,6 @@ def search(query, min_confidence=0.1):
isbn = re.sub(r"[\W_]", "", query) isbn = re.sub(r"[\W_]", "", query)
maybe_isbn = len(isbn) in [10, 13] # ISBN10 or ISBN13 maybe_isbn = len(isbn) in [10, 13] # ISBN10 or ISBN13
dedup_slug = lambda r: "%s/%s/%s" % (r.title, r.author, r.year)
result_index = set()
for connector in get_connectors(): for connector in get_connectors():
result_set = None result_set = None
if maybe_isbn: if maybe_isbn:
@ -53,10 +51,6 @@ def search(query, min_confidence=0.1):
logger.exception(e) logger.exception(e)
continue continue
# if the search results look the same, ignore them
result_set = [r for r in result_set if dedup_slug(r) not in result_index]
# `|=` concats two sets. WE ARE GETTING FANCY HERE
result_index |= set(dedup_slug(r) for r in result_set)
results.append( results.append(
{ {
"connector": connector, "connector": connector,

View file

@ -14,7 +14,7 @@
</header> </header>
<div class="box"> <div class="box">
{% include 'snippets/create_status_form.html' with type="direct" uuid=1 mentions=partner %} {% include 'snippets/create_status_form.html' with type="direct" uuid=1 mention=partner %}
</div> </div>
<section class="block"> <section class="block">

View file

@ -36,13 +36,23 @@
<div class="control"> <div class="control">
{% if type == 'quotation' %} {% if type == 'quotation' %}
<textarea name="quote" class="textarea" id="id_quote_{{ book.id }}_{{ type }}" placeholder="{{ placeholder }}" required>{{ draft.quote|default:'' }}</textarea> <textarea
{% elif type == 'reply' %} name="quote"
{% include 'snippets/content_warning_field.html' with parent_status=status %} class="textarea"
<textarea name="content" class="textarea" id="id_content_{{ type }}-{{ book.id }}{{reply_parent.id}}" placeholder="{{ placeholder }}" aria-label="{% trans 'Reply' %}" required>{% if reply_parent %}{{ reply_parent|mentions:request.user }}{% endif %}{% if mentions %}@{{ mentions|username }} {% endif %}{{ draft.content|default:'' }}</textarea> id="id_quote_{{ book.id }}_{{ type }}"
placeholder="{{ placeholder }}"
required
>{{ draft.quote|default:'' }}</textarea>
{% else %} {% else %}
{% include 'snippets/content_warning_field.html' with parent_status=status %} {% include 'snippets/content_warning_field.html' with parent_status=status %}
<textarea name="content" class="textarea" id="id_content_{{ book.id }}_{{ type }}" placeholder="{{ placeholder }}" required>{{ draft.content|default:'' }}</textarea> <textarea
name="content"
class="textarea"
id="id_content_{{ type }}-{{ book.id }}{{reply_parent.id}}"
placeholder="{{ placeholder }}"
aria-label="{% if reply_parent %}{% trans 'Reply' %}{% else %}{% trans "Content" %}{% endif %}"
required
>{% if reply_parent %}{{ reply_parent|mentions:request.user }}{% endif %}{% if mention %}@{{ mention|username }} {% endif %}{{ draft.content|default:'' }}</textarea>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View file

@ -24,7 +24,7 @@
{% for follow in follow_list %} {% for follow in follow_list %}
<div class="block columns"> <div class="block columns">
<div class="column"> <div class="column">
<a href="{{ follower.local_path }}"> <a href="{{ follow.local_path }}">
{% include 'snippets/avatar.html' with user=follow %} {% include 'snippets/avatar.html' with user=follow %}
{{ follow.display_name }} {{ follow.display_name }}
</a> </a>