Commit 7520c2b977febbbf716be2049a1debc7f7b78213

Authored by Evandro Magalhaes Leite Junior - SUPDE/DEPAE/DE009
1 parent 03d0f238
Exists in master

code cleaned

controllers/email_article_plugin_myprofile_controller.rb
@@ -4,41 +4,24 @@ class EmailArticlePluginMyprofileController < MyProfileController @@ -4,41 +4,24 @@ class EmailArticlePluginMyprofileController < MyProfileController
4 # before_filter :check_access_to_profile, :except => [:join, :join_not_logged, :index, :add] 4 # before_filter :check_access_to_profile, :except => [:join, :join_not_logged, :index, :add]
5 # before_filter :store_location, :only => [:join, :join_not_logged, :report_abuse, :send_mail] 5 # before_filter :store_location, :only => [:join, :join_not_logged, :report_abuse, :send_mail]
6 # before_filter :login_required, :only => [:add, :join, :join_not_logged, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_activities, :view_more_network_activities, :report_abuse, :register_report, :leave_comment_on_activity, :send_mail] 6 # before_filter :login_required, :only => [:add, :join, :join_not_logged, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_activities, :view_more_network_activities, :report_abuse, :register_report, :leave_comment_on_activity, :send_mail]
7 -  
8 -  
9 7
10 def send_email 8 def send_email
11 -# puts "ID ***************************"  
12 -# y params[:id]  
13 -# puts "END ID ***************************"  
14 -# profile = Profile[params[:profile]]  
15 article = Article.find(params[:id]) 9 article = Article.find(params[:id])
16 EmailArticlePluginMyprofileController::Sender.deliver_mail(article) 10 EmailArticlePluginMyprofileController::Sender.deliver_mail(article)
17 render :text=>'ok' 11 render :text=>'ok'
18 end 12 end
19 13
20 -  
21 class Sender < ActionMailer::Base 14 class Sender < ActionMailer::Base
22 def mail(article) 15 def mail(article)
23 -  
24 members = article.profile.members 16 members = article.profile.members
25 emails = [] 17 emails = []
26 members.each{ |m| 18 members.each{ |m|
27 emails.push(m.user.email) 19 emails.push(m.user.email)
28 } 20 }
29 -# puts "***************************"  
30 -# y emails  
31 -# puts "***************************"  
32 content_type 'text/html' 21 content_type 'text/html'
33 recipients emails 22 recipients emails
34 from "#{article.author.user.name} <#{article.author.user.email}>" 23 from "#{article.author.user.name} <#{article.author.user.email}>"
35 reply_to article.author.user.email 24 reply_to article.author.user.email
36 -# if contact.sender  
37 -# headers 'X-Noosfero-Sender' => contact.sender.identifier  
38 -# end  
39 -# if contact.receive_a_copy  
40 -# cc "#{@article.author.user.name} <#{@article.author.user.email}>"  
41 -# end  
42 subject "[Artigo] " + article.title 25 subject "[Artigo] " + article.title
43 body article.body 26 body article.body
44 end 27 end