mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-25 01:20:35 +00:00
Remove slugs from shelf as their id has text in it already
This commit is contained in:
parent
846963ad18
commit
2b483488aa
3 changed files with 5 additions and 14 deletions
|
@ -59,6 +59,10 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
|
||||||
"""can the shelf be safely deleted?"""
|
"""can the shelf be safely deleted?"""
|
||||||
return self.editable and not self.shelfbook_set.exists()
|
return self.editable and not self.shelfbook_set.exists()
|
||||||
|
|
||||||
|
def get_remote_id(self):
|
||||||
|
"""do not use slugs"""
|
||||||
|
return self.get_permalink()
|
||||||
|
|
||||||
def get_permalink(self):
|
def get_permalink(self):
|
||||||
"""shelf identifier instead of id"""
|
"""shelf identifier instead of id"""
|
||||||
base_path = self.user.remote_id
|
base_path = self.user.remote_id
|
||||||
|
|
|
@ -439,21 +439,11 @@ urlpatterns = [
|
||||||
views.Shelf.as_view(),
|
views.Shelf.as_view(),
|
||||||
name="shelf",
|
name="shelf",
|
||||||
),
|
),
|
||||||
re_path(
|
|
||||||
rf"^{USER_PATH}/(shelf|books)/(?P<shelf_identifier>[\w-]+){regex.SLUG}/?$",
|
|
||||||
views.Shelf.as_view(),
|
|
||||||
name="shelf",
|
|
||||||
),
|
|
||||||
re_path(
|
re_path(
|
||||||
rf"^{LOCAL_USER_PATH}/(books|shelf)/(?P<shelf_identifier>[\w-]+)(.json)?/?$",
|
rf"^{LOCAL_USER_PATH}/(books|shelf)/(?P<shelf_identifier>[\w-]+)(.json)?/?$",
|
||||||
views.Shelf.as_view(),
|
views.Shelf.as_view(),
|
||||||
name="shelf",
|
name="shelf",
|
||||||
),
|
),
|
||||||
re_path(
|
|
||||||
rf"^{LOCAL_USER_PATH}/(books|shelf)/(?P<shelf_identifier>[\w-]+){regex.SLUG}/?$",
|
|
||||||
views.Shelf.as_view(),
|
|
||||||
name="shelf",
|
|
||||||
),
|
|
||||||
re_path(r"^create-shelf/?$", views.create_shelf, name="shelf-create"),
|
re_path(r"^create-shelf/?$", views.create_shelf, name="shelf-create"),
|
||||||
re_path(r"^delete-shelf/(?P<shelf_id>\d+)/?$", views.delete_shelf),
|
re_path(r"^delete-shelf/(?P<shelf_id>\d+)/?$", views.delete_shelf),
|
||||||
re_path(r"^shelve/?$", views.shelve),
|
re_path(r"^shelve/?$", views.shelve),
|
||||||
|
|
|
@ -14,7 +14,7 @@ from django.views import View
|
||||||
from bookwyrm import forms, models
|
from bookwyrm import forms, models
|
||||||
from bookwyrm.activitypub import ActivitypubResponse
|
from bookwyrm.activitypub import ActivitypubResponse
|
||||||
from bookwyrm.settings import PAGE_LENGTH
|
from bookwyrm.settings import PAGE_LENGTH
|
||||||
from bookwyrm.views.helpers import is_api_request, get_user_from_username, maybe_redirect_local_path
|
from bookwyrm.views.helpers import is_api_request, get_user_from_username
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=no-self-use
|
# pylint: disable=no-self-use
|
||||||
|
@ -56,9 +56,6 @@ class Shelf(View):
|
||||||
if is_api_request(request) and shelf_identifier:
|
if is_api_request(request) and shelf_identifier:
|
||||||
return ActivitypubResponse(shelf.to_activity(**request.GET))
|
return ActivitypubResponse(shelf.to_activity(**request.GET))
|
||||||
|
|
||||||
if r := maybe_redirect_local_path(request, shelf):
|
|
||||||
return r
|
|
||||||
|
|
||||||
reviews = models.Review.objects
|
reviews = models.Review.objects
|
||||||
if not is_self:
|
if not is_self:
|
||||||
reviews = models.Review.privacy_filter(request.user)
|
reviews = models.Review.privacy_filter(request.user)
|
||||||
|
|
Loading…
Reference in a new issue