mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
FIX: Support ember app routing to topics with only slugs
This commit is contained in:
@ -30,6 +30,13 @@ class TopicsController < ApplicationController
|
||||
|
||||
skip_before_filter :check_xhr, only: [:show, :feed]
|
||||
|
||||
def id_for_slug
|
||||
topic = Topic.find_by(slug: params[:slug].downcase)
|
||||
guardian.ensure_can_see!(topic)
|
||||
raise Discourse::NotFound unless topic
|
||||
render json: {slug: topic.slug, topic_id: topic.id, url: topic.url}
|
||||
end
|
||||
|
||||
def show
|
||||
flash["referer"] ||= request.referer
|
||||
|
||||
|
Reference in New Issue
Block a user