Commit 16987144a167d00d0dc2c5e327c0b30a63d304f1

Authored by Tallys Martins
1 parent ce7e7458

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>
src/noosfero-spb/software_communities/lib/tasks/templates.rake
... ... @@ -41,12 +41,12 @@ namespace :templates do
41 41  
42 42 desc "Copy mail list article from template to all Communities"
43 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 45 puts "Copying article #{article.title}: "
46 46 if article.present?
47 47 SoftwareInfo.find_each do |software|
48 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 50 a_copy.profile = software.community
51 51 a_copy.save if a_copy.profile.present?
52 52 box = community.boxes.detect {|x| x.blocks.find_by_title("Participe") } if community.present?
... ...