diff --git a/bookwyrm/incoming.py b/bookwyrm/incoming.py
index 5b231ceb..a91193e4 100644
--- a/bookwyrm/incoming.py
+++ b/bookwyrm/incoming.py
@@ -1,6 +1,6 @@
''' handles all of the activity coming in to the server '''
import json
-from urllib.parse import urldefrag
+from urllib.parse import urldefrag, unquote_plus
import django.db.utils
from django.http import HttpResponse
@@ -286,10 +286,11 @@ def handle_boost(activity):
@app.task
def handle_unboost(activity):
''' someone gave us a boost! '''
- boost = models.Boost.objects.filter(remote_id=activity['object']['id']).first()
- if not boost:
- return
- status_builder.delete_status(boost)
+ boost = models.Boost.objects.filter(
+ remote_id=activity['object']['id']
+ ).first()
+ if boost:
+ status_builder.delete_status(boost)
@app.task
@@ -297,8 +298,15 @@ def handle_tag(activity):
''' someone is tagging a book '''
user = get_or_create_remote_user(activity['actor'])
if not user.local:
- book = activity['target']['id']
- status_builder.create_tag(user, book, activity['object']['name'])
+ # ordered collection weirndess so we can't just to_model
+ book = books_manager.get_or_create_book(activity['object']['id'])
+ name = activity['object']['target'].split('/')[-1]
+ name = unquote_plus(name)
+ models.Tag.objects.get_or_create(
+ user=user,
+ book=book,
+ name=name
+ )
@app.task
diff --git a/bookwyrm/models/tag.py b/bookwyrm/models/tag.py
index 2c6d7a98..510ad13b 100644
--- a/bookwyrm/models/tag.py
+++ b/bookwyrm/models/tag.py
@@ -35,8 +35,8 @@ class Tag(OrderedCollectionMixin, BookWyrmModel):
return activitypub.Add(
id='%s#add' % self.remote_id,
actor=user.remote_id,
- object=self.book.to_activity(),
- target=self.to_activity(),
+ object=self.book.local_id,
+ target=self.remote_id,
).serialize()
def to_remove_activity(self, user):
diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py
index 21791411..0c7d1a18 100644
--- a/bookwyrm/models/user.py
+++ b/bookwyrm/models/user.py
@@ -136,6 +136,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
''' an ordered collection of statuses '''
queryset = Status.objects.filter(
user=self,
+ deleted=False,
).select_subclasses()
return self.to_ordered_collection(queryset, \
remote_id=self.outbox, **kwargs)
diff --git a/bookwyrm/outgoing.py b/bookwyrm/outgoing.py
index 0ea10ab9..1b21603e 100644
--- a/bookwyrm/outgoing.py
+++ b/bookwyrm/outgoing.py
@@ -9,7 +9,7 @@ import requests
from bookwyrm import activitypub
from bookwyrm import models
from bookwyrm.broadcast import broadcast
-from bookwyrm.status import create_tag, create_notification
+from bookwyrm.status import create_notification
from bookwyrm.status import create_generated_note
from bookwyrm.status import delete_status
from bookwyrm.remote_user import get_or_create_remote_user
@@ -257,9 +257,8 @@ def handle_status(user, form):
broadcast(user, remote_activity, software='other')
-def handle_tag(user, book, name):
+def handle_tag(user, tag):
''' tag a book '''
- tag = create_tag(user, book, name)
broadcast(user, tag.to_add_activity(user))
diff --git a/bookwyrm/static/css/fonts/icomoon.eot b/bookwyrm/static/css/fonts/icomoon.eot
index e031e7d2..c787c9bd 100644
Binary files a/bookwyrm/static/css/fonts/icomoon.eot and b/bookwyrm/static/css/fonts/icomoon.eot differ
diff --git a/bookwyrm/static/css/fonts/icomoon.svg b/bookwyrm/static/css/fonts/icomoon.svg
index 0323df05..e58847cd 100644
--- a/bookwyrm/static/css/fonts/icomoon.svg
+++ b/bookwyrm/static/css/fonts/icomoon.svg
@@ -30,6 +30,7 @@
+
diff --git a/bookwyrm/static/css/fonts/icomoon.ttf b/bookwyrm/static/css/fonts/icomoon.ttf
index d112fb65..8ba512da 100644
Binary files a/bookwyrm/static/css/fonts/icomoon.ttf and b/bookwyrm/static/css/fonts/icomoon.ttf differ
diff --git a/bookwyrm/static/css/fonts/icomoon.woff b/bookwyrm/static/css/fonts/icomoon.woff
index bbac704f..50261c68 100644
Binary files a/bookwyrm/static/css/fonts/icomoon.woff and b/bookwyrm/static/css/fonts/icomoon.woff differ
diff --git a/bookwyrm/static/css/icons.css b/bookwyrm/static/css/icons.css
index 1f34f78c..09c22e1a 100644
--- a/bookwyrm/static/css/icons.css
+++ b/bookwyrm/static/css/icons.css
@@ -1,10 +1,10 @@
@font-face {
font-family: 'icomoon';
- src: url('fonts/icomoon.eot?ouoizu');
- src: url('fonts/icomoon.eot?ouoizu#iefix') format('embedded-opentype'),
- url('fonts/icomoon.ttf?ouoizu') format('truetype'),
- url('fonts/icomoon.woff?ouoizu') format('woff'),
- url('fonts/icomoon.svg?ouoizu#icomoon') format('svg');
+ src: url('fonts/icomoon.eot?aeb2zb');
+ src: url('fonts/icomoon.eot?aeb2zb#iefix') format('embedded-opentype'),
+ url('fonts/icomoon.ttf?aeb2zb') format('truetype'),
+ url('fonts/icomoon.woff?aeb2zb') format('woff'),
+ url('fonts/icomoon.svg?aeb2zb#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
@@ -25,6 +25,9 @@
-moz-osx-font-smoothing: grayscale;
}
+.icon-check:before {
+ content: "\e917";
+}
.icon-dots-three:before {
content: "\e916";
}
diff --git a/bookwyrm/status.py b/bookwyrm/status.py
index 73e6d552..ed1befac 100644
--- a/bookwyrm/status.py
+++ b/bookwyrm/status.py
@@ -1,6 +1,5 @@
''' Handle user activity '''
from datetime import datetime
-from django.db import IntegrityError
from bookwyrm import activitypub, books_manager, models
from bookwyrm.books_manager import get_or_create_book
@@ -65,17 +64,6 @@ def create_generated_note(user, content, mention_books=None, privacy='public'):
return status
-def create_tag(user, possible_book, name):
- ''' add a tag to a book '''
- book = get_or_create_book(possible_book)
-
- try:
- tag = models.Tag.objects.create(name=name, book=book, user=user)
- except IntegrityError:
- return models.Tag.objects.get(name=name, book=book, user=user)
- return tag
-
-
def create_notification(user, notification_type, related_user=None, \
related_book=None, related_status=None, related_import=None):
''' let a user know when someone interacts with their content '''
diff --git a/bookwyrm/templates/book.html b/bookwyrm/templates/book.html
index d271f9c1..af79f57f 100644
--- a/bookwyrm/templates/book.html
+++ b/bookwyrm/templates/book.html
@@ -27,11 +27,18 @@
{% include 'snippets/shelve_button.html' %}
{% if request.user.is_authenticated and not book.cover %}
-
+
{% endif %}
@@ -60,59 +67,85 @@
+ {% if readthrough.start_date %}
Started reading:
{{ readthrough.start_date | naturalday }}
+ {% endif %}
+ {% if readthrough.finish_date %}
Finished reading:
{{ readthrough.finish_date | naturalday }}
+ {% endif %}
- Edit readthrough dates
+ Edit read-through dates
-
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+ Delete this read-though?
+
+
+
+
+
{% endfor %}
{% if request.user.is_authenticated %}
-
+
{% include 'snippets/create_status.html' with book=book hide_cover=True %}
diff --git a/bookwyrm/templates/followers.html b/bookwyrm/templates/followers.html
index 09457408..a5fdfd82 100644
--- a/bookwyrm/templates/followers.html
+++ b/bookwyrm/templates/followers.html
@@ -1,7 +1,7 @@
{% extends 'layout.html' %}
{% load fr_display %}
{% block content %}
-{% include 'user_header.html' with user=user %}
+{% include 'snippets/user_header.html' with user=user %}
Followers
diff --git a/bookwyrm/templates/following.html b/bookwyrm/templates/following.html
index 9131adea..c3bf976a 100644
--- a/bookwyrm/templates/following.html
+++ b/bookwyrm/templates/following.html
@@ -1,7 +1,7 @@
{% extends 'layout.html' %}
{% load fr_display %}
{% block content %}
-{% include 'user_header.html' %}
+{% include 'snippets/user_header.html' with user=user %}
Following
diff --git a/bookwyrm/templates/login.html b/bookwyrm/templates/login.html
index 7ef88df3..15b52a82 100644
--- a/bookwyrm/templates/login.html
+++ b/bookwyrm/templates/login.html
@@ -57,6 +57,5 @@
-
{% endblock %}
diff --git a/bookwyrm/templates/manage_invites.html b/bookwyrm/templates/manage_invites.html
index b9bb1c00..01cc1ea9 100644
--- a/bookwyrm/templates/manage_invites.html
+++ b/bookwyrm/templates/manage_invites.html
@@ -29,21 +29,18 @@
- Reset password
+ Reset password
diff --git a/bookwyrm/templates/search_results.html b/bookwyrm/templates/search_results.html
index cb997298..add82a7d 100644
--- a/bookwyrm/templates/search_results.html
+++ b/bookwyrm/templates/search_results.html
@@ -49,7 +49,7 @@
{% csrf_token %}
{% include 'snippets/search_result_text.html' with result=result link=False %}
-
Import book
+
Import book
{% endfor %}
diff --git a/bookwyrm/templates/shelf.html b/bookwyrm/templates/shelf.html
index 96279543..8e6cc9f8 100644
--- a/bookwyrm/templates/shelf.html
+++ b/bookwyrm/templates/shelf.html
@@ -1,7 +1,7 @@
{% extends 'layout.html' %}
{% load fr_display %}
{% block content %}
-{% include 'user_header.html' with user=user %}
+{% include 'snippets/user_header.html' with user=user %}
diff --git a/bookwyrm/templates/snippets/create_status.html b/bookwyrm/templates/snippets/create_status.html
index 9055e2d4..f8c5b3cf 100644
--- a/bookwyrm/templates/snippets/create_status.html
+++ b/bookwyrm/templates/snippets/create_status.html
@@ -1,109 +1,31 @@
{% load humanize %}
{% load fr_display %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {% csrf_token %}
-
-
-
-
-
- Quote:
-
-
-
- Comment:
-
-
-
-
-
- Public
- Unlisted
- Followers only
- Private
-
-
-
post quote
-
-
-
-
+
+
+
+
+ {% include 'snippets/create_status_form.html' with type='review' %}
+
+
+
+
+ {% include 'snippets/create_status_form.html' with type="comment" placeholder="Some thougts on '"|add:book.title|add:"'" %}
+
+
+
+
+ {% include 'snippets/create_status_form.html' with type="quote" placeholder="An excerpt from '"|add:book.title|add:"'" %}
diff --git a/bookwyrm/templates/snippets/create_status_form.html b/bookwyrm/templates/snippets/create_status_form.html
new file mode 100644
index 00000000..fd88426a
--- /dev/null
+++ b/bookwyrm/templates/snippets/create_status_form.html
@@ -0,0 +1,40 @@
+
+ {% csrf_token %}
+
+
+ {% if type == 'review' %}
+
+ Title:
+
+
+ {% endif %}
+
+
{{ type|title }}:
+
+ {% if type == 'review' %}
+
Rating
+
+
+ {% for i in '12345'|make_list %}
+
+
+ {{ forloop.counter }} star{{ forloop.counter | pluralize }}
+
+ {% endfor %}
+
+ {% endif %}
+
+
+
+ {% if type == 'quote' %}
+
+ Comment:
+
+
+ {% endif %}
+
+ {% include 'snippets/privacy_select.html' %}
+ post {{ type }}
+
+
+
diff --git a/bookwyrm/templates/snippets/follow_button.html b/bookwyrm/templates/snippets/follow_button.html
index 1f914a6c..3fdcbab8 100644
--- a/bookwyrm/templates/snippets/follow_button.html
+++ b/bookwyrm/templates/snippets/follow_button.html
@@ -11,14 +11,14 @@ Follow request already sent.
{% csrf_token %}
{% if user.manually_approves_followers %}
-
Send follow request
+
Send follow request
{% else %}
-
Follow
+
Follow
{% endif %}
{% csrf_token %}
- Unfollow
+ Unfollow
{% endif %}
diff --git a/bookwyrm/templates/snippets/follow_request_buttons.html b/bookwyrm/templates/snippets/follow_request_buttons.html
index 165887e0..b6296d3f 100644
--- a/bookwyrm/templates/snippets/follow_request_buttons.html
+++ b/bookwyrm/templates/snippets/follow_request_buttons.html
@@ -3,11 +3,11 @@
{% csrf_token %}
- Accept
+ Accept
{% csrf_token %}
- Delete
+ Delete
{% endif %}
diff --git a/bookwyrm/templates/snippets/shelf.html b/bookwyrm/templates/snippets/shelf.html
index adee004e..a9238a45 100644
--- a/bookwyrm/templates/snippets/shelf.html
+++ b/bookwyrm/templates/snippets/shelf.html
@@ -71,7 +71,7 @@
{% csrf_token %}
-
+
Remove from shelf
diff --git a/bookwyrm/templates/snippets/shelve_button.html b/bookwyrm/templates/snippets/shelve_button.html
index b09ba297..84c560d7 100644
--- a/bookwyrm/templates/snippets/shelve_button.html
+++ b/bookwyrm/templates/snippets/shelve_button.html
@@ -5,7 +5,9 @@
{% active_shelf book as active_shelf %}
{% if active_shelf.identifier == 'read' %}
-
Read ✓
+
+ Read
+
{% elif active_shelf.identifier == 'reading' %}
I'm done!
@@ -42,7 +44,10 @@
{% csrf_token %}
- {{ shelf.name }} {% if shelf in book.shelf_set.all %} ✓ {% endif %}
+
+ {{ shelf.name }}
+ {% if shelf in book.shelf_set.all %} {% endif %}
+
{% endif %}
@@ -58,7 +63,7 @@
@@ -82,14 +87,14 @@
{% include 'snippets/privacy_select.html' %}
- Save
+ Save
Cancel
-
+
@@ -99,7 +104,7 @@
{% active_read_through book user as readthrough %}
diff --git a/bookwyrm/templates/snippets/status.html b/bookwyrm/templates/snippets/status.html
index 9390d39c..1af27ee4 100644
--- a/bookwyrm/templates/snippets/status.html
+++ b/bookwyrm/templates/snippets/status.html
@@ -5,18 +5,20 @@
@@ -117,7 +119,7 @@
{% csrf_token %}
-
+
Delete post
diff --git a/bookwyrm/templates/snippets/tag.html b/bookwyrm/templates/snippets/tag.html
index 38d2cd34..e62167f9 100644
--- a/bookwyrm/templates/snippets/tag.html
+++ b/bookwyrm/templates/snippets/tag.html
@@ -1,24 +1,22 @@
-
diff --git a/bookwyrm/templates/user_header.html b/bookwyrm/templates/snippets/user_header.html
similarity index 82%
rename from bookwyrm/templates/user_header.html
rename to bookwyrm/templates/snippets/user_header.html
index ecd1ec2d..bb892757 100644
--- a/bookwyrm/templates/user_header.html
+++ b/bookwyrm/templates/snippets/user_header.html
@@ -18,15 +18,18 @@
diff --git a/bookwyrm/templates/user.html b/bookwyrm/templates/user.html
index 3e409486..b6d808c8 100644
--- a/bookwyrm/templates/user.html
+++ b/bookwyrm/templates/user.html
@@ -1,9 +1,7 @@
{% extends 'layout.html' %}
{% block content %}
-
- {% include 'user_header.html' with user=user %}
-
+{% include 'snippets/user_header.html' with user=user %}
Shelves
diff --git a/bookwyrm/templates/user_shelves.html b/bookwyrm/templates/user_shelves.html
index af4f9d23..acda58ca 100644
--- a/bookwyrm/templates/user_shelves.html
+++ b/bookwyrm/templates/user_shelves.html
@@ -1,7 +1,7 @@
{% extends 'layout.html' %}
{% load fr_display %}
{% block content %}
-{% include 'user_header.html' with user=user %}
+{% include 'snippets/user_header.html' with user=user %}
diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py
index 48095850..f761eac9 100644
--- a/bookwyrm/urls.py
+++ b/bookwyrm/urls.py
@@ -75,7 +75,7 @@ urlpatterns = [
# books
re_path(r'%s(.json)?/?$' % book_path, views.book_page),
re_path(r'%s/edit/?$' % book_path, views.edit_book_page),
- re_path(r'%s/editions(.json)?/?' % book_path, views.editions_page),
+ re_path(r'%s/editions(.json)?/?$' % book_path, views.editions_page),
re_path(r'^author/(?P
[\w\-]+)(.json)?/?$', views.author_page),
# TODO: tag needs a .json path
@@ -107,7 +107,7 @@ urlpatterns = [
re_path(r'^rate/?$', actions.rate),
re_path(r'^review/?$', actions.review),
- re_path(r'^quotate/?$', actions.quotate),
+ re_path(r'^quote/?$', actions.quotate),
re_path(r'^comment/?$', actions.comment),
re_path(r'^tag/?$', actions.tag),
re_path(r'^untag/?$', actions.untag),
diff --git a/bookwyrm/view_actions.py b/bookwyrm/view_actions.py
index 7339f2d5..653a9c23 100644
--- a/bookwyrm/view_actions.py
+++ b/bookwyrm/view_actions.py
@@ -468,9 +468,18 @@ def tag(request):
# field which doesn't validate
name = request.POST.get('name')
book_id = request.POST.get('book')
- remote_id = 'https://%s/book/%s' % (DOMAIN, book_id)
+ try:
+ book = models.Edition.objects.get(id=book_id)
+ except models.Edition.DoesNotExist:
+ return HttpResponseNotFound()
+ tag_obj, created = models.Tag.objects.get_or_create(
+ name=name,
+ book=book,
+ user=request.user
+ )
- outgoing.handle_tag(request.user, remote_id, name)
+ if created:
+ outgoing.handle_tag(request.user, tag_obj)
return redirect('/book/%s' % book_id)
diff --git a/bookwyrm/views.py b/bookwyrm/views.py
index 9794d585..454f5c08 100644
--- a/bookwyrm/views.py
+++ b/bookwyrm/views.py
@@ -430,7 +430,7 @@ def status_page(request, username, status_id):
return JsonResponse(status.to_activity(), encoder=ActivityEncoder)
data = {
- 'title': status.type,
+ 'title': 'Status by %s' % user.username,
'status': status,
}
return TemplateResponse(request, 'status.html', data)