Browse Source

Allow linking to topics without any title slug

This is a bit risky because of potential conflicts with other routes
(like "~group_name/new_topic" if "new_topic" was a valid ID36), but it
was being used a little before so it's probably better to have
available.
merge-requests/69/head
Deimos 6 years ago
parent
commit
b37f365f7c
  1. 1
      tildes/tildes/routes.py
  2. 1
      tildes/tildes/views/topic.py

1
tildes/tildes/routes.py

@ -37,6 +37,7 @@ def includeme(config: Configurator) -> None:
config.add_route("group_topics", "/topics", factory=group_by_path)
config.add_route("topic", "/{topic_id36}/{title}", factory=topic_by_id36)
config.add_route("topic_no_title", "/{topic_id36}", factory=topic_by_id36)
config.add_route("user", "/user/{username}", factory=user_by_username)
with config.route_prefix_context("/user/{username}"):

1
tildes/tildes/views/topic.py

@ -255,6 +255,7 @@ def get_new_topic_form(request: Request) -> dict:
@view_config(route_name="topic", renderer="topic.jinja2")
@view_config(route_name="topic_no_title", renderer="topic.jinja2")
@use_kwargs({"comment_order": Enum(CommentTreeSortOption, missing="relevance")})
def get_topic(request: Request, comment_order: CommentTreeSortOption) -> dict:
"""View a single topic."""

Loading…
Cancel
Save