Skip to content

Commit

Permalink
Fix thread urls errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp committed Aug 18, 2024
1 parent aca307c commit fd0b12a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion misago/posting/tests/test_start_private_thread_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_start_private_thread_view_posts_new_thread(user_client, other_user):

thread = Thread.objects.get(slug="hello-world")
assert response["location"] == reverse(
"misago:private-thread", kwargs={"pk": thread.pk, "slug": thread.slug}
"misago:private-thread", kwargs={"id": thread.id, "slug": thread.slug}
)


Expand Down
6 changes: 3 additions & 3 deletions misago/threads/threadtypes/privatethread.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_category_absolute_url(self, category):
def get_category_last_thread_url(self, category):
return reverse(
"misago:private-thread",
kwargs={"slug": category.last_thread_slug, "pk": category.last_thread_id},
kwargs={"slug": category.last_thread_slug, "id": category.last_thread_id},
)

def get_category_last_thread_new_url(self, category):
Expand All @@ -36,11 +36,11 @@ def get_thread_absolute_url(self, thread, page=1):
if page > 1:
return reverse(
"misago:private-thread",
kwargs={"slug": thread.slug, "pk": thread.pk, "page": page},
kwargs={"slug": thread.slug, "id": thread.id, "page": page},
)

return reverse(
"misago:private-thread", kwargs={"slug": thread.slug, "pk": thread.pk}
"misago:private-thread", kwargs={"slug": thread.slug, "id": thread.id}
)

def get_thread_last_post_url(self, thread):
Expand Down
6 changes: 3 additions & 3 deletions misago/threads/threadtypes/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_category_absolute_url(self, category):
def get_category_last_thread_url(self, category):
return reverse(
"misago:thread",
kwargs={"slug": category.last_thread_slug, "pk": category.last_thread_id},
kwargs={"slug": category.last_thread_slug, "id": category.last_thread_id},
)

def get_category_last_thread_new_url(self, category):
Expand All @@ -45,10 +45,10 @@ def get_thread_absolute_url(self, thread, page=1):
if page > 1:
return reverse(
"misago:thread",
kwargs={"slug": thread.slug, "pk": thread.pk, "page": page},
kwargs={"slug": thread.slug, "id": thread.id, "page": page},
)

return reverse("misago:thread", kwargs={"slug": thread.slug, "pk": thread.pk})
return reverse("misago:thread", kwargs={"slug": thread.slug, "id": thread.id})

def get_thread_last_post_url(self, thread):
return reverse(
Expand Down
2 changes: 1 addition & 1 deletion misago/threads/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def add_likes_to_posts(user, posts):


SUPPORTED_THREAD_ROUTES = {
"misago:thread": "pk",
"misago:thread": "id",
"misago:thread-post": "pk",
"misago:thread-last": "pk",
"misago:thread-new": "pk",
Expand Down

0 comments on commit fd0b12a

Please sign in to comment.