diff --git a/bookwyrm/incoming.py b/bookwyrm/incoming.py index ad44fd97..bcb021ca 100644 --- a/bookwyrm/incoming.py +++ b/bookwyrm/incoming.py @@ -299,7 +299,7 @@ def handle_unboost(activity): remote_id=activity['object']['id'] ).first() if boost: - status_builder.delete_status(boost) + boost.delete() @app.task diff --git a/bookwyrm/outgoing.py b/bookwyrm/outgoing.py index 20597ef6..c0253a99 100644 --- a/bookwyrm/outgoing.py +++ b/bookwyrm/outgoing.py @@ -323,10 +323,11 @@ def handle_boost(user, status): def handle_unboost(user, status): ''' a user regrets boosting a status ''' boost = models.Boost.objects.filter( - boosted_status=status, user=user).first() + boosted_status=status, user=user + ).first() activity = boost.to_undo_activity(user) - status_builder.delete_status(boost) + boost.delete() broadcast(user, activity) diff --git a/bookwyrm/templates/snippets/boost_button.html b/bookwyrm/templates/snippets/boost_button.html index 2c747fe2..57765bed 100644 --- a/bookwyrm/templates/snippets/boost_button.html +++ b/bookwyrm/templates/snippets/boost_button.html @@ -1,6 +1,6 @@ {% load fr_display %} -{% with activity.id|uuid as uuid %} -
+{% with status.id|uuid as uuid %} + {% csrf_token %}
-
+ {% csrf_token %}
-
+ {% csrf_token %} -
- - {% endif %} - - - - -{% else %} -
-
-

+ {% if status.status_type == 'Boost' %} {% include 'snippets/avatar.html' with user=status.user %} {% include 'snippets/username.html' with user=status.user %} - deleted this status -

-
-
+ boosted + {% include 'snippets/status_body.html' with status=status|boosted_status %} + {% else %} + {% include 'snippets/status_body.html' with status=status %} + {% endif %} {% endif %} diff --git a/bookwyrm/templates/snippets/status_body.html b/bookwyrm/templates/snippets/status_body.html new file mode 100644 index 00000000..9eec95cd --- /dev/null +++ b/bookwyrm/templates/snippets/status_body.html @@ -0,0 +1,120 @@ +{% load fr_display %} +{% load humanize %} + +{% if not status.deleted %} +
+
+
+
+
+ {% include 'snippets/status_header.html' with status=status %} +
+
+
+
+ +
+ {% include 'snippets/status_content.html' with status=status %} +
+ + +
+{% else %} +
+
+

+ {% include 'snippets/avatar.html' with user=status.user %} + {% include 'snippets/username.html' with user=status.user %} + deleted this status +

+
+
+{% endif %} diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 147d992d..6399c87e 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -116,7 +116,7 @@ urlpatterns = [ re_path(r'^favorite/(?P\d+)/?$', actions.favorite), re_path(r'^unfavorite/(?P\d+)/?$', actions.unfavorite), re_path(r'^boost/(?P\d+)/?$', actions.boost), - re_path(r'^unboost/(?P\d+)/?$', actions.boost), + re_path(r'^unboost/(?P\d+)/?$', actions.unboost), re_path(r'^delete-status/?$', actions.delete_status),