use more specific names than user

author and recipient are matching the domain they are employed in (mail delivery) closer.

Especially the name 'current_user' only happens to be the thing being assigned as author,
but does not transport any special meaning in itself.
pull/3195/head
Jan Sandbrink 9 years ago
parent 2ec1910f20
commit d43803ce85
  1. 16
      app/workers/deliver_work_package_created_job.rb
  2. 18
      app/workers/deliver_work_package_updated_job.rb

@ -30,27 +30,27 @@
class DeliverWorkPackageCreatedJob
include MailNotificationJob
def initialize(user_id, work_package_id, current_user_id)
@user_id = user_id
def initialize(recipient_id, work_package_id, author_id)
@recipient_id = recipient_id
@work_package_id = work_package_id
@current_user_id = current_user_id
@author_id = author_id
end
private
def notification_mail
@notification_mail ||= UserMailer.work_package_added(user, work_package, current_user)
@notification_mail ||= UserMailer.work_package_added(recipient, work_package, author)
end
def user
@user ||= Principal.find(@user_id)
def recipient
@recipient ||= Principal.find(@recipient_id)
end
def work_package
@work_package ||= WorkPackage.find(@work_package_id)
end
def current_user
@current_user ||= Principal.find(@current_user_id)
def author
@author ||= Principal.find(@author_id)
end
end

@ -30,27 +30,27 @@
class DeliverWorkPackageUpdatedJob
include MailNotificationJob
def initialize(user_id, journal_id, current_user_id)
@user_id = user_id
@journal_id = journal_id
@current_user_id = current_user_id
def initialize(recipient_id, journal_id, author_id)
@recipient_id = recipient_id
@journal_id = journal_id
@author_id = author_id
end
private
def notification_mail
@notification_mail ||= UserMailer.work_package_updated(user, journal, current_user)
@notification_mail ||= UserMailer.work_package_updated(recipient, journal, author)
end
def user
@user ||= Principal.find(@user_id)
def recipient
@recipient ||= Principal.find(@recipient_id)
end
def journal
@journal ||= Journal.find(@journal_id)
end
def current_user
@current_user ||= Principal.find(@current_user_id)
def author
@author ||= Principal.find(@author_id)
end
end

Loading…
Cancel
Save