mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Big commit:
- Support for a popup that shows similar topics - Cleaned up a lot of Javascript - Cleaned up use of Promises
This commit is contained in:
@ -59,6 +59,17 @@ class TopicsController < ApplicationController
|
||||
render nothing: true
|
||||
end
|
||||
|
||||
def similar_to
|
||||
requires_parameters(:title, :raw)
|
||||
title, raw = params[:title], params[:raw]
|
||||
|
||||
raise Discourse::InvalidParameters.new(:title) if title.length < SiteSetting.min_title_similar_length
|
||||
raise Discourse::InvalidParameters.new(:raw) if raw.length < SiteSetting.min_body_similar_length
|
||||
|
||||
topics = Topic.similar_to(title, raw)
|
||||
render_serialized(topics, BasicTopicSerializer)
|
||||
end
|
||||
|
||||
def status
|
||||
requires_parameters(:status, :enabled)
|
||||
|
||||
|
Reference in New Issue
Block a user