Refactor open composer action
Dieser Commit ist enthalten in:
Ursprung
cda316a9c6
Commit
79fc4eee24
1 geänderte Dateien mit 22 neuen und 29 gelöschten Zeilen
|
@ -151,36 +151,29 @@ class CustomWizard::Action
|
||||||
end
|
end
|
||||||
|
|
||||||
def open_composer
|
def open_composer
|
||||||
if action['custom_title_enabled']
|
params = basic_topic_params
|
||||||
title = mapper.interpolate(action['custom_title'])
|
|
||||||
else
|
|
||||||
title = data[action['title']]
|
|
||||||
end
|
|
||||||
|
|
||||||
url = "/new-topic?title=#{title}"
|
if params[:title].present? && params[:raw].present?
|
||||||
|
url = "/new-topic?title=#{params[:title]}"
|
||||||
|
url += "&body=#{params[:raw]}"
|
||||||
|
|
||||||
if action['post_builder']
|
if category_id = action_category
|
||||||
post = mapper.interpolate(action['post_template'])
|
if category_id && category = Category.find(category_id)
|
||||||
else
|
url += "&category=#{category.full_slug('/')}"
|
||||||
post = data[action['post']]
|
end
|
||||||
end
|
|
||||||
|
|
||||||
url += "&body=#{post}"
|
|
||||||
|
|
||||||
if category_id = action_category
|
|
||||||
if category = Category.find(category_id)
|
|
||||||
url += "&category=#{category.full_slug('/')}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if tags = action_tags
|
||||||
|
url += "&tags=#{tags.join(',')}"
|
||||||
|
end
|
||||||
|
|
||||||
|
route_to = Discourse.base_uri + URI.encode(url)
|
||||||
|
data['redirect_on_complete'] = route_to
|
||||||
|
|
||||||
|
log_info("route: #{route_to}")
|
||||||
|
else
|
||||||
|
log_error("invalid composer params", "title: #{params[:title]}; post: #{params[:raw]}")
|
||||||
end
|
end
|
||||||
|
|
||||||
if tags = action_tags
|
|
||||||
url += "&tags=#{tags.join(',')}"
|
|
||||||
end
|
|
||||||
|
|
||||||
route_to = Discourse.base_uri + URI.encode(url)
|
|
||||||
data['redirect_on_complete'] = route_to
|
|
||||||
|
|
||||||
log_info("route: #{route_to}")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_to_group
|
def add_to_group
|
||||||
|
|
Laden …
In neuem Issue referenzieren