From 543d13af6ec43965da22d1be79c6df4bf57cf8ed Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 8 Sep 2022 11:03:06 -0700 Subject: [PATCH] Removes explicit calls to raise_not_editable from views These raises are handled implicitly in the form, so they don't have to be called outright. --- bookwyrm/views/get_started.py | 1 - bookwyrm/views/list/curate.py | 1 - bookwyrm/views/list/list.py | 1 - bookwyrm/views/status.py | 2 -- 4 files changed, 5 deletions(-) diff --git a/bookwyrm/views/get_started.py b/bookwyrm/views/get_started.py index e31b64cb9..fdb8824fa 100644 --- a/bookwyrm/views/get_started.py +++ b/bookwyrm/views/get_started.py @@ -82,7 +82,6 @@ class GetStartedBooks(View): for (book_id, shelf_id) in shelve_actions: book = get_object_or_404(models.Edition, id=book_id) shelf = get_object_or_404(models.Shelf, id=shelf_id) - shelf.raise_not_editable(request.user) models.ShelfBook.objects.create(book=book, shelf=shelf, user=request.user) return redirect(self.next_view) diff --git a/bookwyrm/views/list/curate.py b/bookwyrm/views/list/curate.py index 924f37709..7155ffc43 100644 --- a/bookwyrm/views/list/curate.py +++ b/bookwyrm/views/list/curate.py @@ -31,7 +31,6 @@ class Curate(View): def post(self, request, list_id): """edit a book_list""" book_list = get_object_or_404(models.List, id=list_id) - book_list.raise_not_editable(request.user) suggestion = get_object_or_404(models.ListItem, id=request.POST.get("item")) approved = request.POST.get("approved") == "true" diff --git a/bookwyrm/views/list/list.py b/bookwyrm/views/list/list.py index 5c0dd2e4e..3797997a9 100644 --- a/bookwyrm/views/list/list.py +++ b/bookwyrm/views/list/list.py @@ -241,7 +241,6 @@ def set_book_position(request, list_item_id): special care with the unique ordering per list. """ list_item = get_object_or_404(models.ListItem, id=list_item_id) - list_item.book_list.raise_not_editable(request.user) try: int_position = int(request.POST.get("position")) except ValueError: diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index 2f957f087..ee91b0fb8 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -34,7 +34,6 @@ class EditStatus(View): status = get_object_or_404( models.Status.objects.select_subclasses(), id=status_id ) - status.raise_not_editable(request.user) status_type = "reply" if status.reply_parent else status.status_type.lower() data = { @@ -163,7 +162,6 @@ def edit_readthrough(request): """can't use the form because the dates are too finnicky""" # TODO: remove this, it duplicates the code in the ReadThrough view readthrough = get_object_or_404(models.ReadThrough, id=request.POST.get("id")) - readthrough.raise_not_editable(request.user) readthrough.start_date = load_date_in_user_tz_as_utc( request.POST.get("start_date"), request.user