1
0
Fork 0

Refactor open composer action

Dieser Commit ist enthalten in:
Angus McLeod 2020-04-15 13:52:02 +10:00
Ursprung cda316a9c6
Commit 79fc4eee24

Datei anzeigen

@ -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 if params[:title].present? && params[:raw].present?
title = data[action['title']] url = "/new-topic?title=#{params[:title]}"
end url += "&body=#{params[:raw]}"
url = "/new-topic?title=#{title}" if category_id = action_category
if category_id && category = Category.find(category_id)
if action['post_builder'] url += "&category=#{category.full_slug('/')}"
post = mapper.interpolate(action['post_template']) end
else
post = data[action['post']]
end
url += "&body=#{post}"
if category_id = action_category
if category = Category.find(category_id)
url += "&category=#{category.full_slug('/')}"
end end
end
if tags = action_tags
if tags = action_tags url += "&tags=#{tags.join(',')}"
url += "&tags=#{tags.join(',')}" end
end
route_to = Discourse.base_uri + URI.encode(url)
route_to = Discourse.base_uri + URI.encode(url) data['redirect_on_complete'] = route_to
data['redirect_on_complete'] = route_to
log_info("route: #{route_to}")
log_info("route: #{route_to}") else
log_error("invalid composer params", "title: #{params[:title]}; post: #{params[:raw]}")
end
end end
def add_to_group def add_to_group