mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Support for creating embedded topics via API
This commit is contained in:
parent
ecf211aa3f
commit
dbab628e16
3 changed files with 26 additions and 1 deletions
|
@ -64,6 +64,7 @@ class PostCreator
|
|||
track_topic
|
||||
update_topic_stats
|
||||
update_user_counts
|
||||
create_embedded_topic
|
||||
|
||||
publish
|
||||
ensure_in_allowed_users if guardian.is_staff?
|
||||
|
@ -82,7 +83,6 @@ class PostCreator
|
|||
@post
|
||||
end
|
||||
|
||||
|
||||
def self.create(user, opts)
|
||||
PostCreator.new(user, opts).create
|
||||
end
|
||||
|
@ -110,6 +110,14 @@ class PostCreator
|
|||
|
||||
protected
|
||||
|
||||
# You can supply an `embed_url` for a post to set up the embedded relationship.
|
||||
# This is used by the wp-discourse plugin to associate a remote post with a
|
||||
# discourse post.
|
||||
def create_embedded_topic
|
||||
return unless @opts[:embed_url].present?
|
||||
TopicEmbed.create!(topic_id: @post.topic_id, post_id: @post.id, embed_url: @opts[:embed_url])
|
||||
end
|
||||
|
||||
def handle_spam
|
||||
if @spam
|
||||
GroupMessage.create( Group[:moderators].name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue