diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-03-23 17:00:12 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-03-23 17:08:19 +0300 |
commit | b13bed62eaa047560370692f22041993635f83ee (patch) | |
tree | c0e4fa79b1e6f2f961cbd67bb6a69859f46bc2f7 /app | |
parent | bf235053adc60bb0b940ef6fb68a59485bc815aa (diff) |
Clean up code by using keyword arguments.
Diffstat (limited to 'app')
-rw-r--r-- | app/mailers/emails/projects.rb | 8 | ||||
-rw-r--r-- | app/models/project_services/emails_on_push_service.rb | 8 | ||||
-rw-r--r-- | app/workers/emails_on_push_worker.rb | 16 |
3 files changed, 22 insertions, 10 deletions
diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb index d2165c9f764..48458baa674 100644 --- a/app/mailers/emails/projects.rb +++ b/app/mailers/emails/projects.rb @@ -16,7 +16,13 @@ module Emails subject: subject("Project was moved")) end - def repository_push_email(project_id, recipient, author_id, ref, action, compare, reverse_compare = false, send_from_committer_email = false, disable_diffs = false) + def repository_push_email(project_id, recipient, author_id:, + ref:, + action:, + compare: nil, + reverse_compare: false, + send_from_committer_email: false, + disable_diffs: false) @project = Project.find(project_id) @author = User.find(author_id) @reverse_compare = reverse_compare diff --git a/app/models/project_services/emails_on_push_service.rb b/app/models/project_services/emails_on_push_service.rb index 3e465ab1a38..6f6e5950aab 100644 --- a/app/models/project_services/emails_on_push_service.rb +++ b/app/models/project_services/emails_on_push_service.rb @@ -42,7 +42,13 @@ class EmailsOnPushService < Service def execute(push_data) return unless supported_events.include?(push_data[:object_kind]) - EmailsOnPushWorker.perform_async(project_id, recipients, push_data, send_from_committer_email?, disable_diffs?) + EmailsOnPushWorker.perform_async( + project_id, + recipients, + push_data, + send_from_committer_email: send_from_committer_email?, + disable_diffs: disable_diffs? + ) end def send_from_committer_email? diff --git a/app/workers/emails_on_push_worker.rb b/app/workers/emails_on_push_worker.rb index 429b29525dc..89fa2117dd2 100644 --- a/app/workers/emails_on_push_worker.rb +++ b/app/workers/emails_on_push_worker.rb @@ -1,7 +1,7 @@ class EmailsOnPushWorker include Sidekiq::Worker - def perform(project_id, recipients, push_data, send_from_committer_email = false, disable_diffs = false) + def perform(project_id, recipients, push_data, send_from_committer_email: false, disable_diffs: false) project = Project.find(project_id) before_sha = push_data["before"] after_sha = push_data["after"] @@ -37,13 +37,13 @@ class EmailsOnPushWorker Notify.repository_push_email( project_id, recipient, - author_id, - ref, - action, - compare, - reverse_compare, - send_from_committer_email, - disable_diffs + author_id: author_id, + ref: ref, + action: action, + compare: compare, + reverse_compare: reverse_compare, + send_from_committer_email: send_from_committer_email, + disable_diffs: disable_diffs ).deliver end ensure |