From 06643fb6258b18bb491a7c321bad39d58212ab5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Wed, 13 May 2015 22:10:02 +0200 Subject: [PATCH] add support for all types of unordered lists in migrate_old_polls --- plugins/poll/lib/tasks/migrate_old_polls.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/poll/lib/tasks/migrate_old_polls.rake b/plugins/poll/lib/tasks/migrate_old_polls.rake index feb7058ddc6..f916422fa65 100644 --- a/plugins/poll/lib/tasks/migrate_old_polls.rake +++ b/plugins/poll/lib/tasks/migrate_old_polls.rake @@ -13,10 +13,10 @@ task "poll:migrate_old_polls" => :environment do putc "." # go back in time Timecop.freeze(post.created_at + 1.minute) do - post.raw = post.raw.gsub(/\n\n([ ]*- )/, "\n\\1") + "\n\n" + post.raw = post.raw.gsub(/\n\n([ ]*[-\*\+] )/, "\n\\1") + "\n\n" # fix the RAW when needed if post.raw !~ /\[poll\]/ - lists = /^[ ]*- .+?$\n\n/m.match(post.raw) + lists = /^[ ]*[-\*\+] .+?$\n\n/m.match(post.raw) next if lists.blank? || lists.length == 0 first_list = lists[0] post.raw = post.raw.sub(first_list, "\n[poll]\n#{first_list}\n[/poll]\n")