From 803ad3c911043605fb43385a5ccb61e5bbeeeac9 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Wed, 13 Oct 2021 13:12:56 -0700 Subject: [PATCH 01/22] Removes delete and redraft view --- .../snippets/status/status_options.html | 6 ++-- bookwyrm/urls.py | 5 --- bookwyrm/views/__init__.py | 2 +- bookwyrm/views/status.py | 34 ++----------------- 4 files changed, 6 insertions(+), 41 deletions(-) diff --git a/bookwyrm/templates/snippets/status/status_options.html b/bookwyrm/templates/snippets/status/status_options.html index 0f6c73fff..45d1fa9cc 100644 --- a/bookwyrm/templates/snippets/status/status_options.html +++ b/bookwyrm/templates/snippets/status/status_options.html @@ -20,10 +20,10 @@ {% if status.status_type != 'GeneratedNote' and status.status_type != 'Rating' %} diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index c81d97903..e9d48a7aa 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -330,11 +330,6 @@ urlpatterns = [ views.DeleteStatus.as_view(), name="delete-status", ), - re_path( - r"^redraft-status/(?P\d+)/?$", - views.DeleteAndRedraft.as_view(), - name="redraft", - ), # interact re_path(r"^favorite/(?P\d+)/?$", views.Favorite.as_view(), name="fav"), re_path( diff --git a/bookwyrm/views/__init__.py b/bookwyrm/views/__init__.py index 63c5c7686..b8c53aeb4 100644 --- a/bookwyrm/views/__init__.py +++ b/bookwyrm/views/__init__.py @@ -60,7 +60,7 @@ from .search import Search from .shelf import Shelf from .shelf import create_shelf, delete_shelf from .shelf import shelve, unshelve -from .status import CreateStatus, DeleteStatus, DeleteAndRedraft, update_progress +from .status import CreateStatus, DeleteStatus, update_progress from .status import edit_readthrough from .updates import get_notification_count, get_unread_status_count from .user import User, Followers, Following, hide_suggestions diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index 32ce109d4..d84f0089b 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -27,13 +27,13 @@ class CreateStatus(View): """the view for *posting*""" def get(self, request, status_type): # pylint: disable=unused-argument - """compose view (used for delete-and-redraft)""" + """compose view (used for editing)""" book = get_object_or_404(models.Edition, id=request.GET.get("book")) data = {"book": book} return TemplateResponse(request, "compose.html", data) def post(self, request, status_type): - """create status of whatever type""" + """create status of whatever type""" status_type = status_type[0].upper() + status_type[1:] try: @@ -106,36 +106,6 @@ class DeleteStatus(View): return redirect(request.headers.get("Referer", "/")) -@method_decorator(login_required, name="dispatch") -class DeleteAndRedraft(View): - """delete a status but let the user re-create it""" - - def post(self, request, status_id): - """delete and tombstone a status""" - status = get_object_or_404( - models.Status.objects.select_subclasses(), id=status_id - ) - # don't let people redraft other people's statuses - status.raise_not_editable(request.user) - - status_type = status.status_type.lower() - if status.reply_parent: - status_type = "reply" - - data = { - "draft": status, - "type": status_type, - } - if hasattr(status, "book"): - data["book"] = status.book - elif status.mention_books: - data["book"] = status.mention_books.first() - - # perform deletion - status.delete() - return TemplateResponse(request, "compose.html", data) - - @login_required @require_POST def update_progress(request, book_id): # pylint: disable=unused-argument From 1f6f54384706173e0385d5016b7d8b1086264878 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 15:56:34 -0700 Subject: [PATCH 02/22] Use url templatetag to load posting urls --- bookwyrm/templates/snippets/create_status/layout.html | 2 +- bookwyrm/templates/snippets/rate_action.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/snippets/create_status/layout.html b/bookwyrm/templates/snippets/create_status/layout.html index 4dded2005..1343316fa 100644 --- a/bookwyrm/templates/snippets/create_status/layout.html +++ b/bookwyrm/templates/snippets/create_status/layout.html @@ -17,7 +17,7 @@ reply_parent: the Status object this post will be in reply to, if applicable
diff --git a/bookwyrm/templates/snippets/rate_action.html b/bookwyrm/templates/snippets/rate_action.html index 711c3b3e1..767039a3d 100644 --- a/bookwyrm/templates/snippets/rate_action.html +++ b/bookwyrm/templates/snippets/rate_action.html @@ -3,7 +3,7 @@ {% if request.user.is_authenticated %} {% trans "Leave a rating" %}
- + {% csrf_token %} From 7488f8da96bcbe0ae7b4e08f5dc17d962564c5e9 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 16:30:27 -0700 Subject: [PATCH 03/22] Creates edit status endpoint --- .../snippets/status/status_options.html | 2 +- bookwyrm/urls.py | 1 + bookwyrm/views/__init__.py | 2 +- bookwyrm/views/status.py | 24 ++++++++++++++++++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/bookwyrm/templates/snippets/status/status_options.html b/bookwyrm/templates/snippets/status/status_options.html index 45d1fa9cc..92e1ab43b 100644 --- a/bookwyrm/templates/snippets/status/status_options.html +++ b/bookwyrm/templates/snippets/status/status_options.html @@ -20,7 +20,7 @@ {% if status.status_type != 'GeneratedNote' and status.status_type != 'Rating' %} {% if status.status_type != 'GeneratedNote' and status.status_type != 'Rating' %} + + {% trans "Edit" %} + {% endif %} {% else %} diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index 71f8c1b7a..13e51b1b2 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -28,11 +28,13 @@ class EditStatus(View): def get(self, request, status_id): # pylint: disable=unused-argument """load the edit panel""" - status = get_object_or_404(models.Status.select_subclasses(), id=status_id) + status = get_object_or_404(models.Status.objects.select_subclasses(), id=status_id) status.raise_not_editable(request.user) data = { - "status": status, + "type": status.status_type.lower(), + "book": getattr(status, "book", None), + "draft": status, } return TemplateResponse(request, "compose.html", data) From df276149373346f5aa539352b055084e3f5edeb5 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 16:53:46 -0700 Subject: [PATCH 05/22] Don't use localstorage cache for edits --- bookwyrm/templates/snippets/create_status/comment.html | 4 ++-- .../templates/snippets/create_status/content_field.html | 2 +- .../snippets/create_status/content_warning_field.html | 2 +- .../snippets/create_status/content_warning_toggle.html | 2 +- bookwyrm/templates/snippets/create_status/quotation.html | 6 +++--- bookwyrm/templates/snippets/create_status/review.html | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bookwyrm/templates/snippets/create_status/comment.html b/bookwyrm/templates/snippets/create_status/comment.html index 4bf1fc243..82ccdbe70 100644 --- a/bookwyrm/templates/snippets/create_status/comment.html +++ b/bookwyrm/templates/snippets/create_status/comment.html @@ -35,7 +35,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j size="3" value="{% firstof draft.progress readthrough.progress '' %}" id="progress_{{ uuid }}" - data-cache-draft="id_progress_comment_{{ book.id }}" + {% if not draft %}data-cache-draft="id_progress_comment_{{ book.id }}"{% endif %} >
@@ -43,7 +43,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
diff --git a/bookwyrm/templates/snippets/create_status/review.html b/bookwyrm/templates/snippets/create_status/review.html index 67214f332..13d349caf 100644 --- a/bookwyrm/templates/snippets/create_status/review.html +++ b/bookwyrm/templates/snippets/create_status/review.html @@ -24,7 +24,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j id="id_name_{{ book.id }}" placeholder="{% blocktrans with book_title=book.title %}Your review of '{{ book_title }}'{% endblocktrans %}" value="{% firstof draft.name ''%}" - data-cache-draft="id_name_{{ book.id }}_{{ type }}" + {% if not draft %}data-cache-draft="id_name_{{ book.id }}_{{ type }}"{% endif %} > From 92535a54815df5b0cb12fdf262547d7aeb27206e Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 16:57:58 -0700 Subject: [PATCH 06/22] Python formatting --- bookwyrm/urls.py | 4 +++- bookwyrm/views/status.py | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 853832d7e..8296493bd 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -315,7 +315,9 @@ urlpatterns = [ re_path( rf"{STATUS_PATH}/replies(.json)?/?$", views.Replies.as_view(), name="replies" ), - re_path(r"^edit/(?P\d+)/?$", views.EditStatus.as_view(), name="edit-status"), + re_path( + r"^edit/(?P\d+)/?$", views.EditStatus.as_view(), name="edit-status" + ), re_path( r"^post/?$", views.CreateStatus.as_view(), diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index 13e51b1b2..cddb5f59c 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -28,7 +28,9 @@ class EditStatus(View): def get(self, request, status_id): # pylint: disable=unused-argument """load the edit panel""" - status = get_object_or_404(models.Status.objects.select_subclasses(), id=status_id) + status = get_object_or_404( + models.Status.objects.select_subclasses(), id=status_id + ) status.raise_not_editable(request.user) data = { @@ -44,7 +46,6 @@ class EditStatus(View): status.raise_not_editable(request.user) - # pylint: disable= no-self-use @method_decorator(login_required, name="dispatch") class CreateStatus(View): From 8a08d789cb1da9d6d486d368e3ad52d2d4b426d3 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 17:13:15 -0700 Subject: [PATCH 07/22] Removes delete and redraft tests --- bookwyrm/tests/views/test_status.py | 54 ----------------------------- 1 file changed, 54 deletions(-) diff --git a/bookwyrm/tests/views/test_status.py b/bookwyrm/tests/views/test_status.py index 6a09807c7..5c24e5f15 100644 --- a/bookwyrm/tests/views/test_status.py +++ b/bookwyrm/tests/views/test_status.py @@ -168,60 +168,6 @@ class StatusViews(TestCase): self.assertFalse(self.remote_user in reply.mention_users.all()) self.assertTrue(self.local_user in reply.mention_users.all()) - def test_delete_and_redraft(self, *_): - """delete and re-draft a status""" - view = views.DeleteAndRedraft.as_view() - request = self.factory.post("") - request.user = self.local_user - status = models.Comment.objects.create( - content="hi", book=self.book, user=self.local_user - ) - - with patch("bookwyrm.activitystreams.remove_status_task.delay") as mock: - result = view(request, status.id) - self.assertTrue(mock.called) - result.render() - - # make sure it was deleted - status.refresh_from_db() - self.assertTrue(status.deleted) - - def test_delete_and_redraft_invalid_status_type_rating(self, *_): - """you can't redraft generated statuses""" - view = views.DeleteAndRedraft.as_view() - request = self.factory.post("") - request.user = self.local_user - with patch("bookwyrm.activitystreams.add_status_task.delay"): - status = models.ReviewRating.objects.create( - book=self.book, rating=2.0, user=self.local_user - ) - - with patch("bookwyrm.activitystreams.remove_status_task.delay") as mock: - with self.assertRaises(PermissionDenied): - view(request, status.id) - self.assertFalse(mock.called) - - status.refresh_from_db() - self.assertFalse(status.deleted) - - def test_delete_and_redraft_invalid_status_type_generated_note(self, *_): - """you can't redraft generated statuses""" - view = views.DeleteAndRedraft.as_view() - request = self.factory.post("") - request.user = self.local_user - with patch("bookwyrm.activitystreams.add_status_task.delay"): - status = models.GeneratedNote.objects.create( - content="hi", user=self.local_user - ) - - with patch("bookwyrm.activitystreams.remove_status_task.delay") as mock: - with self.assertRaises(PermissionDenied): - view(request, status.id) - self.assertFalse(mock.called) - - status.refresh_from_db() - self.assertFalse(status.deleted) - def test_find_mentions(self, *_): """detect and look up @ mentions of users""" user = models.User.objects.create_user( From 066f14ca846c5393aa960cdeeb1b36c389336bf2 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 17:13:54 -0700 Subject: [PATCH 08/22] Save edited statuses --- .../snippets/create_status/layout.html | 2 +- bookwyrm/urls.py | 5 +++++ bookwyrm/views/status.py | 17 ++++++++++------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/bookwyrm/templates/snippets/create_status/layout.html b/bookwyrm/templates/snippets/create_status/layout.html index 1343316fa..d824e270e 100644 --- a/bookwyrm/templates/snippets/create_status/layout.html +++ b/bookwyrm/templates/snippets/create_status/layout.html @@ -17,7 +17,7 @@ reply_parent: the Status object this post will be in reply to, if applicable
diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py index 8296493bd..e6c9ad0b4 100644 --- a/bookwyrm/urls.py +++ b/bookwyrm/urls.py @@ -328,6 +328,11 @@ urlpatterns = [ views.CreateStatus.as_view(), name="create-status", ), + re_path( + r"^post/(?P\w+)/(?P\d+)/?$", + views.CreateStatus.as_view(), + name="create-status", + ), re_path( r"^delete-status/(?P\d+)/?$", views.DeleteStatus.as_view(), diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index cddb5f59c..0b6db8995 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -40,11 +40,6 @@ class EditStatus(View): } return TemplateResponse(request, "compose.html", data) - def post(self, request, status_id): - """save an edited status""" - status = get_object_or_404(models.Status.select_subclasses(), id=status_id) - status.raise_not_editable(request.user) - # pylint: disable= no-self-use @method_decorator(login_required, name="dispatch") @@ -57,12 +52,20 @@ class CreateStatus(View): data = {"book": book} return TemplateResponse(request, "compose.html", data) - def post(self, request, status_type): + def post(self, request, status_type, existing_status_id=None): """create status of whatever type""" + if existing_status_id: + existing_status = get_object_or_404( + models.Status.select_subclasses(), id=existing_status_id + ) + existing_status.raise_not_editable(request.user) + status_type = status_type[0].upper() + status_type[1:] try: - form = getattr(forms, f"{status_type}Form")(request.POST) + form = getattr(forms, f"{status_type}Form")( + request.POST, instance=existing_status + ) except AttributeError: return HttpResponseBadRequest() if not form.is_valid(): From f5e52d6a114a439c4e558ce6145de9b5bfbab5da Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 17:23:54 -0700 Subject: [PATCH 09/22] Save updated statuses --- bookwyrm/templates/snippets/create_status/layout.html | 6 +++++- bookwyrm/views/status.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/snippets/create_status/layout.html b/bookwyrm/templates/snippets/create_status/layout.html index d824e270e..43b4cdcaf 100644 --- a/bookwyrm/templates/snippets/create_status/layout.html +++ b/bookwyrm/templates/snippets/create_status/layout.html @@ -17,7 +17,11 @@ reply_parent: the Status object this post will be in reply to, if applicable diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index 0b6db8995..f1abeda13 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -56,7 +56,7 @@ class CreateStatus(View): """create status of whatever type""" if existing_status_id: existing_status = get_object_or_404( - models.Status.select_subclasses(), id=existing_status_id + models.Status.objects.select_subclasses(), id=existing_status_id ) existing_status.raise_not_editable(request.user) From 2d1052766d7b8196b734e62965ce8974b6230a7e Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 17:32:38 -0700 Subject: [PATCH 10/22] Fixes undefined variable error --- bookwyrm/views/status.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index f1abeda13..d1f2fd1ef 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -54,6 +54,7 @@ class CreateStatus(View): def post(self, request, status_type, existing_status_id=None): """create status of whatever type""" + existing_status = None if existing_status_id: existing_status = get_object_or_404( models.Status.objects.select_subclasses(), id=existing_status_id From 175df2181cb832f8bf0e2ff3367a7a4fdc8c72c4 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 17:33:04 -0700 Subject: [PATCH 11/22] Adds edited field to status model --- bookwyrm/migrations/0109_status_edited.py | 18 ++++++++++++++++++ bookwyrm/models/status.py | 1 + 2 files changed, 19 insertions(+) create mode 100644 bookwyrm/migrations/0109_status_edited.py diff --git a/bookwyrm/migrations/0109_status_edited.py b/bookwyrm/migrations/0109_status_edited.py new file mode 100644 index 000000000..58fda209e --- /dev/null +++ b/bookwyrm/migrations/0109_status_edited.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.5 on 2021-10-15 00:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("bookwyrm", "0108_alter_user_preferred_language"), + ] + + operations = [ + migrations.AddField( + model_name="status", + name="edited", + field=models.BooleanField(default=False), + ), + ] diff --git a/bookwyrm/models/status.py b/bookwyrm/models/status.py index 1325aa884..1027ecb58 100644 --- a/bookwyrm/models/status.py +++ b/bookwyrm/models/status.py @@ -43,6 +43,7 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel): published_date = fields.DateTimeField( default=timezone.now, activitypub_field="published" ) + edited = models.BooleanField(default=False) deleted = models.BooleanField(default=False) deleted_date = models.DateTimeField(blank=True, null=True) favorites = models.ManyToManyField( From 01911d3b23715e3f5013e8a25af3934865eb9b1b Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 17:33:45 -0700 Subject: [PATCH 12/22] Update and indicate edit status --- bookwyrm/templates/snippets/status/header.html | 3 +++ bookwyrm/views/status.py | 1 + 2 files changed, 4 insertions(+) diff --git a/bookwyrm/templates/snippets/status/header.html b/bookwyrm/templates/snippets/status/header.html index 62eae5481..c2f529bee 100644 --- a/bookwyrm/templates/snippets/status/header.html +++ b/bookwyrm/templates/snippets/status/header.html @@ -30,6 +30,9 @@ {% include "snippets/status/header_content.html" %} + {% if status.edited %} + (edited) + {% endif %}

{{ status.published_date|published_date }} diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index d1f2fd1ef..4771ceb20 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -60,6 +60,7 @@ class CreateStatus(View): models.Status.objects.select_subclasses(), id=existing_status_id ) existing_status.raise_not_editable(request.user) + existing_status.edited = True status_type = status_type[0].upper() + status_type[1:] From e43cade6cc57084b916497bb5b8a9b31d54af22a Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 18:50:15 -0700 Subject: [PATCH 13/22] Test edit view --- bookwyrm/tests/views/test_status.py | 70 +++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/bookwyrm/tests/views/test_status.py b/bookwyrm/tests/views/test_status.py index 5c24e5f15..166829331 100644 --- a/bookwyrm/tests/views/test_status.py +++ b/bookwyrm/tests/views/test_status.py @@ -7,6 +7,7 @@ from django.test.client import RequestFactory from bookwyrm import forms, models, views from bookwyrm.settings import DOMAIN +from bookwyrm.tests.validate_html import validate_html # pylint: disable=invalid-name @@ -70,6 +71,7 @@ class StatusViews(TestCase): self.assertEqual(status.content, "

hi

") self.assertEqual(status.user, self.local_user) self.assertEqual(status.book, self.book) + self.assertFalse(status.edited) def test_handle_status_reply(self, *_): """create a status in reply to an existing status""" @@ -346,3 +348,71 @@ http://www.fish.com/""" self.assertEqual(activity["object"]["type"], "Tombstone") status.refresh_from_db() self.assertTrue(status.deleted) + + def test_edit_status_get(self, *_): + """load the edit status view""" + view = views.EditStatus.as_view() + status = models.Comment.objects.create( + content="status", user=self.local_user, book=self.book + ) + + request = self.factory.get("") + request.user = self.local_user + result = view(request, status.id) + validate_html(result.render()) + self.assertEqual(result.status_code, 200) + + def test_edit_status_get_reply(self, *_): + """load the edit status view""" + view = views.EditStatus.as_view() + parent = models.Comment.objects.create( + content="parent status", user=self.local_user, book=self.book + ) + status = models.Status.objects.create( + content="reply", user=self.local_user, reply_parent=parent + ) + + request = self.factory.get("") + request.user = self.local_user + result = view(request, status.id) + validate_html(result.render()) + self.assertEqual(result.status_code, 200) + + def test_create_status_edit(self, *_): + """update an existing status""" + status = models.Status.objects.create(content="status", user=self.local_user) + view = views.CreateStatus.as_view() + form = forms.CommentForm( + { + "content": "hi", + "user": self.local_user.id, + "book": self.book.id, + "privacy": "public", + } + ) + request = self.factory.post("", form.data) + request.user = self.local_user + + view(request, "comment", existing_status_id=status.id) + + status.refresh_from_db() + self.assertEqual(status.content, "

hi

") + self.assertTrue(status.edited) + + def test_create_status_edit_permission_denied(self, *_): + """update an existing status""" + status = models.Status.objects.create(content="status", user=self.local_user) + view = views.CreateStatus.as_view() + form = forms.CommentForm( + { + "content": "hi", + "user": self.local_user.id, + "book": self.book.id, + "privacy": "public", + } + ) + request = self.factory.post("", form.data) + request.user = self.remote_user + + with self.assertRaises(PermissionDenied): + view(request, "comment", existing_status_id=status.id) From 0dba071126e2d782ab245f92755df5a5052f8f42 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 19:14:47 -0700 Subject: [PATCH 14/22] Fixes editing replies --- bookwyrm/views/status.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index 4771ceb20..dd990ce8b 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -33,8 +33,9 @@ class EditStatus(View): ) status.raise_not_editable(request.user) + status_type = "reply" if status.reply_parent else status.status_type.lower() data = { - "type": status.status_type.lower(), + "type": status_type, "book": getattr(status, "book", None), "draft": status, } From 50db0bd01268f43207928ea86a39607008881b98 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 14 Oct 2021 20:29:45 -0700 Subject: [PATCH 15/22] Hide reply panel in no interact mode --- bookwyrm/templates/snippets/status/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templates/snippets/status/layout.html b/bookwyrm/templates/snippets/status/layout.html index 9d1863ee5..93620a083 100644 --- a/bookwyrm/templates/snippets/status/layout.html +++ b/bookwyrm/templates/snippets/status/layout.html @@ -67,7 +67,7 @@ {% endblock %} {% block card-bonus %} -{% if request.user.is_authenticated and not moderation_mode %} +{% if request.user.is_authenticated and not moderation_mode and not no_interact %} {% with status.id|uuid as uuid %}