diff --git a/bookwyrm/connectors/abstract_connector.py b/bookwyrm/connectors/abstract_connector.py index 9f9aed43..1faa9bf9 100644 --- a/bookwyrm/connectors/abstract_connector.py +++ b/bookwyrm/connectors/abstract_connector.py @@ -1,13 +1,13 @@ ''' functionality outline for a book data connector ''' from abc import ABC, abstractmethod from dataclasses import dataclass -from dateutil import parser import pytz -import requests -from requests import HTTPError from urllib3.exceptions import RequestError from django.db import transaction +from dateutil import parser +import requests +from requests import HTTPError from bookwyrm import models diff --git a/bookwyrm/incoming.py b/bookwyrm/incoming.py index 30d741e8..5f4cc15b 100644 --- a/bookwyrm/incoming.py +++ b/bookwyrm/incoming.py @@ -69,7 +69,8 @@ def shared_inbox(request): }, 'Update': { 'Person': handle_update_user, - 'Document': handle_update_book, + 'Edition': handle_update_book, + 'Work': handle_update_book, }, } activity_type = activity['type'] @@ -337,7 +338,7 @@ def handle_update_book(activity): document = activity['object'] # check if we have their copy and care about their updates book = models.Book.objects.select_subclasses().filter( - remote_id=document['url'], + remote_id=document['id'], sync=True, ).first() if not book: diff --git a/bookwyrm/models/relationship.py b/bookwyrm/models/relationship.py index e86b9098..dbf99778 100644 --- a/bookwyrm/models/relationship.py +++ b/bookwyrm/models/relationship.py @@ -82,6 +82,17 @@ class UserFollowRequest(UserRelationship): ''' following a user requires manual or automatic confirmation ''' status = 'follow_request' + def save(self, *args, **kwargs): + ''' make sure the follow relationship doesn't already exist ''' + try: + UserFollows.objects.get( + user_subject=self.user_subject, + user_object=self.user_object + ) + return None + except UserFollows.DoesNotExist: + return super().save(*args, **kwargs) + class UserBlocks(UserRelationship): ''' prevent another user from following you and seeing your posts ''' diff --git a/bookwyrm/templates/book_results.html b/bookwyrm/templates/book_results.html deleted file mode 100644 index 71d3a637..00000000 --- a/bookwyrm/templates/book_results.html +++ /dev/null @@ -1,27 +0,0 @@ -{% extends 'layout.html' %} -{% block content %} -
{{ full }} @@ -20,3 +21,4 @@ {% endwith %} {% endif %} {% endwith %} +{% endwith %} diff --git a/bookwyrm/templates/snippets/book_preview.html b/bookwyrm/templates/snippets/book_preview.html new file mode 100644 index 00000000..65a9ae4b --- /dev/null +++ b/bookwyrm/templates/snippets/book_preview.html @@ -0,0 +1,12 @@ ++diff --git a/bookwyrm/templates/snippets/interaction.html b/bookwyrm/templates/snippets/interaction.html index a48d8a7c..97e7d068 100644 --- a/bookwyrm/templates/snippets/interaction.html +++ b/bookwyrm/templates/snippets/interaction.html @@ -1,4 +1,5 @@ {% load fr_display %} +{% with activity.id|uuid as uuid %} - - - -+++ {% include 'snippets/book_cover.html' with book=book %} + {% include 'snippets/shelve_button.html' with book=book %} ++++{% include 'snippets/book_titleby.html' with book=book %}
+ {% include 'snippets/book_description.html' with book=book %} +