Merge branch 'main' into isni-poc

This commit is contained in:
Hugh Rundle
2021-11-22 08:53:58 +11:00
142 changed files with 14141 additions and 3230 deletions

View File

@ -1,10 +1,24 @@
{% load i18n %}
{% load utilities %}
{% with user_path=status.user.local_path username=status.user.display_name book_path=status.book.local_poth book_title=book|book_title %}
{% with user_path=status.user.local_path username=status.user.display_name book_path=book.local_path book_title=book|book_title %}
{% if status.status_type == 'GeneratedNote' %}
{{ status.content|safe }}
{% if status.content == 'wants to read' %}
{% blocktrans trimmed %}
<a href="{{ user_path}}">{{ username }}</a> wants to read <a href="{{ book_path }}">{{ book_title }}</a>
{% endblocktrans %}
{% endif %}
{% if status.content == 'finished reading' %}
{% blocktrans trimmed %}
<a href="{{ user_path}}">{{ username }}</a> finished reading <a href="{{ book_path }}">{{ book_title }}</a>
{% endblocktrans %}
{% endif %}
{% if status.content == 'started reading' %}
{% blocktrans trimmed %}
<a href="{{ user_path}}">{{ username }}</a> started reading <a href="{{ book_path }}">{{ book_title }}</a>
{% endblocktrans %}
{% endif %}
{% elif status.status_type == 'Rating' %}
{% blocktrans trimmed %}
<a href="{{ user_path}}">{{ username }}</a> rated <a href="{{ book_path }}">{{ book_title }}</a>

View File

@ -2,7 +2,7 @@
<div style="font-family: BlinkMacSystemFont,-apple-system,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Fira Sans','Droid Sans','Helvetica Neue',Helvetica,Arial,sans-serif; border-radius: 6px; background-color: #efefef; max-width: 632px;">
<div style="padding: 1rem; overflow: auto;">
<div style="float: left; margin-right: 1rem;">
<a style="color: #3273dc;" href="https://{{ domain }}" style="text-decoration: none;"><img src="https://{{ domain }}/{{ logo }}" alt="logo"></a>
<a style="color: #3273dc;" href="https://{{ domain }}" style="text-decoration: none;"><img src="{{ logo }}" alt="logo"></a>
</div>
<div>
<a style="color: black; text-decoration: none" href="https://{{ domain }}" style="text-decoration: none;"><strong>{{ site_name }}</strong><br>

View File

@ -0,0 +1,11 @@
{% extends 'email/html_layout.html' %}
{% load i18n %}
{% block content %}
<p>
{% blocktrans %}@{{ reporter }} has flagged behavior by @{{ reportee }} for moderation. {% endblocktrans %}
</p>
{% trans "View report" as text %}
{% include 'email/snippets/action.html' with path=report_link text=text %}
{% endblock %}

View File

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}New report for {{ site_name }}{% endblocktrans %}

View File

@ -0,0 +1,9 @@
{% extends 'email/text_layout.html' %}
{% load i18n %}
{% block content %}
{% blocktrans %}@{{ reporter}} has flagged behavior by @{{ reportee }} for moderation. {% endblocktrans %}
{% trans "View report" %}
{{ report_link }}
{% endblock %}

View File

@ -1,4 +1,4 @@
<html lang="{% get_lang %}">
<html lang="en">
<body>
<div>
<strong>Subject:</strong> {% include subject_path %}

View File

@ -9,7 +9,7 @@
{% if user.is_authenticated %}
<div class="column is-one-third">
<section class="block">
<h2 class="title is-4">{% trans "Your books" %}</h2>
<h2 class="title is-4">{% trans "Your Books" %}</h2>
{% if not suggested_books %}
<p>{% trans "There are no books here right now! Try searching for a book to get started" %}</p>
{% else %}

View File

@ -46,10 +46,10 @@
</label>
</div>
<div class="field">
<label>
<span class="label">{% trans "Privacy setting for imported reviews:" %}</span>
{% include 'snippets/privacy_select.html' with no_label=True %}
<label class="label" for="privacy_import">
{% trans "Privacy setting for imported reviews:" %}
</label>
{% include 'snippets/privacy_select.html' with no_label=True privacy_uuid="import" %}
</div>
</div>
</div>

View File

@ -6,153 +6,223 @@
{% block title %}{% trans "Import Status" %}{% endblock %}
{% block content %}{% spaceless %}
<div class="block">
<h1 class="title">{% trans "Import Status" %}</h1>
<a href="{% url 'import' %}" class="has-text-weight-normal help subtitle is-link">{% trans "Back to imports" %}</a>
<dl>
<div class="is-flex">
<dt class="has-text-weight-medium">{% trans "Import started:" %}</dt>
<dd class="ml-2">{{ job.created_date | naturaltime }}</dd>
</div>
{% if job.complete %}
<div class="is-flex">
<dt class="has-text-weight-medium">{% trans "Import completed:" %}</dt>
<dd class="ml-2">{{ task.date_done | naturaltime }}</dd>
</div>
{% elif task.failed %}
<div class="notification is-danger">{% trans "TASK FAILED" %}</div>
<header class="block">
<h1 class="title">
{% block page_title %}
{% if job.retry %}
{% trans "Retry Status" %}
{% else %}
{% trans "Import Status" %}
{% endif %}
</dl>
</div>
{% endblock %}
</h1>
<nav class="breadcrumb subtitle" aria-label="breadcrumbs">
<ul>
<li><a href="{% url 'import' %}">{% trans "Imports" %}</a></li>
{% url 'import-status' job.id as path %}
<li{% if request.path in path %} class="is-active"{% endif %}>
<a href="{{ path }}" {% if request.path in path %}aria-current="page"{% endif %}>
{% if job.retry %}
{% trans "Retry Status" %}
{% else %}
{% trans "Import Status" %}
{% endif %}
</a>
</li>
{% block breadcrumbs %}{% endblock %}
</ul>
</nav>
<div class="block">
<dl>
<dt class="is-pulled-left mr-5">{% trans "Import started:" %}</dt>
<dd>{{ job.created_date | naturaltime }}</dd>
</dl>
</div>
<div class="block">
{% if not job.complete %}
<p>
{% trans "Import still in progress." %}
<br/>
{% trans "(Hit reload to update!)" %}
</p>
<div class="box is-processing">
<div class="block">
<span class="icon icon-spinner is-pulled-left" aria-hidden="true"></span>
<span>{% trans "In progress" %}</span>
<span class="is-pulled-right">
<a href="#" class="button is-small">{% trans "Refresh" %}</a>
</span>
</div>
<div class="is-flex">
<progress
class="progress is-success is-medium mr-2"
role="progressbar"
aria-min="0"
value="{{ complete_count }}"
aria-valuenow="{{ complete_count }}"
max="{{ item_count }}"
aria-valuemax="{{ item_count }}">
{{ percent }} %
</progress>
<span>{{ percent }}%</span>
</div>
</div>
{% endif %}
{% if manual_review_count and not legacy %}
<div class="notification">
{% blocktrans trimmed count counter=manual_review_count with display_counter=manual_review_count|intcomma %}
{{ display_counter }} item needs manual approval.
{% plural %}
{{ display_counter }} items need manual approval.
{% endblocktrans %}
<a href="{% url 'import-review' job.id %}">{% trans "Review items" %}</a>
</div>
{% endif %}
{% if job.complete and fail_count and not job.retry and not legacy %}
<div class="notification is-warning">
{% blocktrans trimmed count counter=fail_count with display_counter=fail_count|intcomma %}
{{ display_counter }} item failed to import.
{% plural %}
{{ display_counter }} items failed to import.
{% endblocktrans %}
<a href="{% url 'import-troubleshoot' job.id %}">
{% trans "View and troubleshoot failed items" %}
</a>
</div>
{% endif %}
</header>
<div class="block">
{% block actions %}{% endblock %}
<div class="table-container">
<table class="table is-striped">
<tr>
<th>
{% trans "Row" %}
</th>
<th>
{% trans "Title" %}
</th>
<th>
{% trans "ISBN" %}
</th>
<th>
{% trans "Author" %}
</th>
<th>
{% trans "Shelf" %}
</th>
<th>
{% trans "Review" %}
</th>
{% block import_cols_headers %}
<th>
{% trans "Book" %}
</th>
<th>
{% trans "Status" %}
</th>
{% endblock %}
</tr>
{% if legacy %}
<tr>
<td colspan="8">
<p>
<em>{% trans "Import preview unavailable." %}</em>
</p>
</td>
</tr>
{% else %}
{% for item in items %}
<tr>
{% block index_col %}
<td>
{{ item.index }}
</td>
{% endblock %}
<td>
{{ item.normalized_data.title }}
</td>
<td>
{{ item.isbn|default:'' }}
</td>
<td>
{{ item.normalized_data.authors }}
</td>
<td>
{{ item.normalized_data.shelf }}
</td>
<td>
{% if item.rating %}
<p>{% include 'snippets/stars.html' with rating=item.rating %}</p>
{% endif %}
{% if item.review %}
<p>{{ item.review|truncatechars:100 }}</p>
{% endif %}
{% if item.linked_review %}
<a href="{{ item.linked_review.remote_id }}" target="_blank">{% trans "View imported review" %}</a>
{% endif %}
</td>
{% block import_cols %}
<td>
{% if item.book %}
<a href="{{ item.book.local_path }}">
{% include 'snippets/book_cover.html' with book=item.book cover_class='is-h-s' size='small' %}
</a>
{% endif %}
</td>
<td>
{% if item.book %}
<span class="icon icon-check" aria-hidden="true"></span>
<span class="is-sr-only-mobile">{% trans "Imported" %}</span>
{% elif item.fail_reason %}
<span class="icon icon-x has-text-danger" aria-hidden="true"></span>
<span class="is-sr-only-mobile">
{% if item.book_guess %}
{% trans "Needs manual review" %}
{% else %}
{{ item.fail_reason }}
{% endif %}
</span>
{% else %}
<div class="is-flex">
<span class="icon icon-dots-three" aria-hidden="true"></span>
<span class="is-sr-only-mobile">{% trans "Pending" %}</span>
{# retry option if an item appears to be hanging #}
{% if job.created_date != job.updated_date and inactive_time > 24 %}
<form class="ml-2" method="POST" action="{% url 'import-item-retry' job.id item.id %}" name="retry-{{ item.id }}">
{% csrf_token %}
<button class="button is-danger is-outlined is-small">{% trans "Retry" %}</button>
</form>
{% endif %}
</div>
{% endif %}
</td>
{% endblock %}
</tr>
{% block action_row %}{% endblock %}
{% endfor %}
{% endif %}
</table>
</div>
{% if legacy %}
<div class="content">
<form name="update-import" method="POST" action="{% url 'import-status' job.id %}">
{% csrf_token %}
<p>
{% trans "This import is in an old format that is no longer supported. If you would like to troubleshoot missing items from this import, click the button below to update the import format." %}
</p>
<button class="button">{% trans "Update import" %}</button>
</form>
</div>
{% endif %}
</div>
{% if failed_items %}
<div class="block">
<h2 class="title is-4">{% trans "Failed to load" %}</h2>
{% if not job.retry %}
<form name="retry" action="/import/{{ job.id }}" method="post" class="box">
{% csrf_token %}
{% with failed_count=failed_items|length %}
{% if failed_count > 10 %}
<p class="block">
<a href="#select-all-failed-imports">
{% blocktrans %}Jump to the bottom of the list to select the {{ failed_count }} items which failed to import.{% endblocktrans %}
</a>
</p>
{% endif %}
{% endwith %}
<fieldset id="failed_imports">
<ul>
{% for item in failed_items %}
<li class="mb-2 is-flex is-align-items-start">
<input class="checkbox mt-1" type="checkbox" name="import_item" value="{{ item.id }}" id="import_item_{{ item.id }}">
<label class="ml-1" for="import-item-{{ item.id }}">
{% blocktrans with index=item.index title=item.data.Title author=item.data.Author %}Line {{ index }}: <strong>{{ title }}</strong> by {{ author }}{% endblocktrans %}
<br/>
{{ item.fail_reason }}.
</label>
</li>
{% endfor %}
</ul>
</fieldset>
<fieldset class="mt-3">
<a name="select-all-failed-imports"></a>
<label class="label is-inline">
<input
id="toggle-all-checkboxes-failed-imports"
class="checkbox"
type="checkbox"
data-action="toggle-all"
data-target="failed_imports"
/>
{% trans "Select all" %}
</label>
<button class="button is-block mt-3" type="submit">{% trans "Retry items" %}</button>
</fieldset>
</form>
<hr>
{% else %}
<ul>
{% for item in failed_items %}
<li class="pb-1">
<p>
Line {{ item.index }}:
<strong>{{ item.data.Title }}</strong> by
{{ item.data.Author }}
</p>
<p>
{{ item.fail_reason }}.
</p>
</li>
{% endfor %}
</ul>
{% endif %}
{% if not legacy %}
<div>
{% include 'snippets/pagination.html' with page=items %}
</div>
{% endif %}
<div class="block">
{% if job.complete %}
<h2 class="title is-4">{% trans "Successfully imported" %}</h2>
{% else %}
<h2 class="title is-4">{% trans "Import Progress" %}</h2>
{% endif %}
<table class="table">
<tr>
<th>
{% trans "Book" %}
</th>
<th>
{% trans "Title" %}
</th>
<th>
{% trans "Author" %}
</th>
<th>
</th>
</tr>
{% for item in items %}
<tr>
<td>
{% if item.book %}
<a href="{{ item.book.local_path }}">
{% include 'snippets/book_cover.html' with book=item.book cover_class='is-h-s' size='small' %}
</a>
{% endif %}
</td>
<td>
{{ item.data.Title }}
</td>
<td>
{{ item.data.Author }}
</td>
<td>
{% if item.book %}
<span class="icon icon-check">
<span class="is-sr-only">{% trans "Imported" %}</span>
</span>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
{% endspaceless %}{% endblock %}
{% block scripts %}

View File

@ -0,0 +1,75 @@
{% extends 'import/import_status.html' %}
{% load i18n %}
{% load utilities %}
{% block title %}{% trans "Import Troubleshooting" %}{% endblock %}
{% block page_title %}
{% trans "Review items" %}
{% endblock %}
{% block breadcrumbs %}
<li class="is-active">
<a href="#" aria-current="page">{% trans "Review" %}</a>
</li>
{% endblock %}
{% block actions %}
<div class="block">
<div class="notification content">
<p>
{% trans "Approving a suggestion will permanently add the suggested book to your shelves and associate your reading dates, reviews, and ratings with that book." %}
</p>
</div>
</div>
{% endblock %}
{% block import_cols_headers %}
{% endblock %}
{% block index_col %}
<td rowspan="2">
{{ item.index }}
</td>
{% endblock %}
{% block import_cols %}
{% endblock %}
{% block action_row %}
<tr>
<td colspan="5">
<div class="columns is-mobile">
{% with guess=item.book_guess %}
<div class="column is-narrow">
<a href="{{ item.book.local_path }}" target="_blank">
{% include 'snippets/book_cover.html' with book=guess cover_class='is-h-s' size='small' %}
</a>
</div>
<div class="column content">
<p>
{% include 'snippets/book_titleby.html' with book=guess %}
</p>
<div class="content is-flex">
<form class="pr-2" name="approve-{{ item.id }}" method="POST" action="{% url 'import-approve' job.id item.id %}">
{% csrf_token %}
<button type="submit" class="button is-success">
<span class="icon icon-check m-0-mobile" aria-hidden="true"></span>
<span class="is-sr-only-mobile">{% trans "Approve" %}</span>
</button>
</form>
<form name="delete-{{ item.id }}" method="POST" action="{% url 'import-delete' job.id item.id %}">
{% csrf_token %}
<button type="submit" class="button is-danger is-light is-outlined">
<span class="icon icon-x m-0-mobile" aria-hidden="true"></span>
<span class="is-sr-only-mobile">{% trans "Reject" %}</span>
</button>
</form>
</div>
</div>
{% endwith %}
</div>
</td>
</tr>
{% endblock %}

View File

@ -0,0 +1,36 @@
{% extends 'import/import_status.html' %}
{% load i18n %}
{% block title %}{% trans "Import Troubleshooting" %}{% endblock %}
{% block page_title %}
{% trans "Failed items" %}
{% endblock %}
{% block breadcrumbs %}
<li class="is-active">
<a href="#" aria-current="page">{% trans "Troubleshooting" %}</a>
</li>
{% endblock %}
{% block actions %}
<div class="block">
<div class="notification content">
<p>
{% trans "Re-trying an import can fix missing items in cases such as:" %}
</p>
<ul>
<li>{% trans "The book has been added to the instance since this import" %}</li>
<li>{% trans "A transient error or timeout caused the external data source to be unavailable." %}</li>
<li>{% trans "BookWyrm has been updated since this import with a bug fix" %}</li>
</ul>
<p>
{% trans "Contact your admin or <a href='https://github.com/bookwyrm-social/bookwyrm/issues'>open an issue</a> if you are seeing unexpected failed items." %}
</p>
</div>
<form name="retry" method="post" action="{% url 'import-troubleshoot' job.id %}">
{% csrf_token %}
<button type="submit" class="button">Retry all</button>
</form>
</div>
{% endblock %}

View File

@ -5,7 +5,7 @@
{% load i18n %}
{% block title %}
{% include 'user/books_header.html' %}
{% include 'user/books_header.html' with shelf=shelf %}
{% endblock %}
{% block opengraph_images %}

View File

@ -5,11 +5,9 @@
{% if book.authors.exists %}
{% blocktrans trimmed with path=book.local_path title=book|book_title %}
<a href="{{ path }}">{{ title }}</a> by
{% endblocktrans %}
{% include 'snippets/authors.html' with book=book limit=3 %}
{% endblocktrans %}&nbsp;{% include 'snippets/authors.html' with book=book limit=3 %}
{% else %}
<a href="{{ book.local_path }}">{{ book|book_title }}</a>
{% endif %}
{% endspaceless %}

View File

@ -1,6 +1,16 @@
{% load i18n %}
{% if is_self %}
{% if shelf.identifier == 'to-read' %}
{% trans "To Read" %}
{% elif shelf.identifier == 'reading' %}
{% trans "Currently Reading" %}
{% elif shelf.identifier == 'read' %}
{% trans "Read" %}
{% elif shelf.identifier == 'all' %}
{% trans "Your books" %}
{% else %}
{{ shelf.name }}
{% endif %}
{% else %}
{% blocktrans with username=user.display_name %}{{ username }}'s books{% endblocktrans %}
{% endif %}