Pass discourse username to TopicRetriever from embed controller

When you specify `discourse_username` param on the embed URL, it should
translate to creating the post with that username.

This commit ensures that this is now the case.
This commit is contained in:
Sam Davies
2016-02-25 11:16:27 +00:00
parent a01b2a48d5
commit b2f4659792
2 changed files with 9 additions and 1 deletions

View File

@ -8,6 +8,7 @@ class EmbedController < ApplicationController
def comments
embed_url = params[:embed_url]
embed_username = params[:discourse_username]
topic_id = nil
if embed_url.present?
@ -35,7 +36,7 @@ class EmbedController < ApplicationController
end
elsif embed_url.present?
Jobs.enqueue(:retrieve_topic, user_id: current_user.try(:id), embed_url: embed_url)
Jobs.enqueue(:retrieve_topic, user_id: current_user.try(:id), embed_url: embed_url, author_username: embed_username)
render 'loading'
end