Commit 14d57c89d680d08d190b030549b9225d55790da5

Authored by Tallys Martins
1 parent 6f180e74

Create task to import email list article on softwares

Signed-off-by: Gabriel Silva <gabriel93.silva@gmail.com>
Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
(cherry picked from commit 16987144a167d00d0dc2c5e327c0b30a63d304f1)
src/noosfero-spb/software_communities/lib/tasks/templates.rake
@@ -41,12 +41,12 @@ namespace :templates do @@ -41,12 +41,12 @@ namespace :templates do
41 41
42 desc "Copy mail list article from template to all Communities" 42 desc "Copy mail list article from template to all Communities"
43 task :copy_mail_article => :environment do 43 task :copy_mail_article => :environment do
44 - article = Profile['software'].articles.find_by_slug('registro-na-lista') 44 + article = Profile['software'].articles.find_by_slug('como-participar-da-lista-de-discussao')
45 puts "Copying article #{article.title}: " 45 puts "Copying article #{article.title}: "
46 if article.present? 46 if article.present?
47 SoftwareInfo.find_each do |software| 47 SoftwareInfo.find_each do |software|
48 community = software.community 48 community = software.community
49 - a_copy = article.copy_without_save 49 + a_copy = community.articles.find_by_slug('como-participar-da-lista-de-discussao') || article.copy_without_save
50 a_copy.profile = software.community 50 a_copy.profile = software.community
51 a_copy.save if a_copy.profile.present? 51 a_copy.save if a_copy.profile.present?
52 box = community.boxes.detect {|x| x.blocks.find_by_title("Participe") } if community.present? 52 box = community.boxes.detect {|x| x.blocks.find_by_title("Participe") } if community.present?