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 class DeliverWorkPackageCreatedJob
include MailNotificationJob include MailNotificationJob
def initialize(user_id, work_package_id, current_user_id) def initialize(recipient_id, work_package_id, author_id)
@user_id = user_id @recipient_id = recipient_id
@work_package_id = work_package_id @work_package_id = work_package_id
@current_user_id = current_user_id @author_id = author_id
end end
private private
def notification_mail 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 end
def user def recipient
@user ||= Principal.find(@user_id) @recipient ||= Principal.find(@recipient_id)
end end
def work_package def work_package
@work_package ||= WorkPackage.find(@work_package_id) @work_package ||= WorkPackage.find(@work_package_id)
end end
def current_user def author
@current_user ||= Principal.find(@current_user_id) @author ||= Principal.find(@author_id)
end end
end end

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

Loading…
Cancel
Save