Skip to content

Commit

Permalink
Cleaning up HasStateMailer
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Apr 14, 2014
1 parent 4dc827e commit 35bdfb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/mailers/has_state_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class HasStateMailer < ApplicationMailer

def state(to, state_machine, state_name, state_updated_at)
def state(to, state_machine)
@machine = state_machine
@state_name = state_name
@updated_at = state_updated_at
@state_name = @machine.human_state_name
@updated_at = @machine.state_updated_at
@change = @machine.state_changes.newest_first.first
mail(:to => to, :subject => t(:mailer_subject_state, :machine => @machine.title))
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/has_state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def in_final_state?
# the role designed using the macro method assign_state
def notify_state
people = ([self.user, :tsp, :assistant] + self.class.roles_assigned_to(state)).uniq - [:requester]
HasStateMailer::notify_to(people, :state, self, self.human_state_name, self.state_updated_at)
HasStateMailer::notify_to(people, :state, self)
end

# Sets the state to 'canceled'
Expand Down Expand Up @@ -173,7 +173,7 @@ def roles_assigned_to(state)
def notify_inactive_since(date)
where(["state in (?) and state_updated_at < ?", @assigned_roles.keys, date]).joins(:user).each do |m|
people = roles_assigned_to(m.state).map {|i| i.to_sym == :requester ? m.user : i }
HasStateMailer::notify_to(people, :state, m, m.human_state_name, m.state_updated_at)
HasStateMailer::notify_to(people, :state, m)
end
end
end
Expand Down

0 comments on commit 35bdfb5

Please sign in to comment.