Commit 302147928ffa59d3b5cb693054b1f558a4f20b14
1 parent
212d640e
Exists in
master
and in
22 other branches
rails3: move environment_mailing to mailers folders
Showing
2 changed files
with
25 additions
and
25 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | +class EnvironmentMailing < Mailing | |
| 2 | + | |
| 3 | + def recipients(offset=0, limit=100) | |
| 4 | + source.people.all(:order => :id, :offset => offset, :limit => limit, :joins => "LEFT OUTER JOIN mailing_sents m ON (m.mailing_id = #{id} AND m.person_id = profiles.id)", :conditions => { "m.person_id" => nil }) | |
| 5 | + end | |
| 6 | + | |
| 7 | + def each_recipient | |
| 8 | + offset = 0 | |
| 9 | + limit = 100 | |
| 10 | + while !(people = recipients(offset, limit)).empty? | |
| 11 | + people.each do |person| | |
| 12 | + yield person | |
| 13 | + end | |
| 14 | + offset = offset + limit | |
| 15 | + end | |
| 16 | + end | |
| 17 | + | |
| 18 | + def signature_message | |
| 19 | + _('Sent by %s.') % source.name | |
| 20 | + end | |
| 21 | + | |
| 22 | + def url | |
| 23 | + source.top_url | |
| 24 | + end | |
| 25 | +end | ... | ... |
app/models/environment_mailing.rb
| ... | ... | @@ -1,25 +0,0 @@ |
| 1 | -class EnvironmentMailing < Mailing | |
| 2 | - | |
| 3 | - def recipients(offset=0, limit=100) | |
| 4 | - source.people.all(:order => :id, :offset => offset, :limit => limit, :joins => "LEFT OUTER JOIN mailing_sents m ON (m.mailing_id = #{id} AND m.person_id = profiles.id)", :conditions => { "m.person_id" => nil }) | |
| 5 | - end | |
| 6 | - | |
| 7 | - def each_recipient | |
| 8 | - offset = 0 | |
| 9 | - limit = 100 | |
| 10 | - while !(people = recipients(offset, limit)).empty? | |
| 11 | - people.each do |person| | |
| 12 | - yield person | |
| 13 | - end | |
| 14 | - offset = offset + limit | |
| 15 | - end | |
| 16 | - end | |
| 17 | - | |
| 18 | - def signature_message | |
| 19 | - _('Sent by %s.') % source.name | |
| 20 | - end | |
| 21 | - | |
| 22 | - def url | |
| 23 | - source.top_url | |
| 24 | - end | |
| 25 | -end |