Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-09 02:49:11 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-03-09 02:49:11 +0300
commit8b551ee31858db9c5da1ff5245359151d5b71211 (patch)
tree39fc875c2e2cade77dd4723630782200fef33dcf /app/models/project_services/emails_on_push_service.rb
parentc025c0d58948680c3021a598822c2814f7fe1cce (diff)
parent4658e554b7129c44221a73fe8ec3b73b4b9b8b24 (diff)
Merge branch 'emails-on-push'
Conflicts: app/controllers/projects/services_controller.rb app/models/project_services/emails_on_push_service.rb
Diffstat (limited to 'app/models/project_services/emails_on_push_service.rb')
-rw-r--r--app/models/project_services/emails_on_push_service.rb21
1 files changed, 18 insertions, 3 deletions
diff --git a/app/models/project_services/emails_on_push_service.rb b/app/models/project_services/emails_on_push_service.rb
index d894d2913d7..acb5e7f1af5 100644
--- a/app/models/project_services/emails_on_push_service.rb
+++ b/app/models/project_services/emails_on_push_service.rb
@@ -18,6 +18,8 @@
#
class EmailsOnPushService < Service
+ prop_accessor :send_from_committer_email
+ prop_accessor :disable_diffs
prop_accessor :recipients
validates :recipients, presence: true, if: :activated?
@@ -37,14 +39,27 @@ class EmailsOnPushService < Service
%w(push)
end
- def execute(data)
- return unless supported_events.include?(data[:object_kind])
+ def execute(push_data)
+ return unless supported_events.include?(push_data[:object_kind])
- EmailsOnPushWorker.perform_async(project_id, recipients, data)
+ EmailsOnPushWorker.perform_async(project_id, recipients, push_data, send_from_committer_email?, disable_diffs?)
+ end
+
+ def send_from_committer_email?
+ self.send_from_committer_email == "1"
+ end
+
+ def disable_diffs?
+ self.disable_diffs == "1"
end
def fields
+ domains = Notify.allowed_email_domains.map { |domain| "user@#{domain}" }.join(", ")
[
+ { type: 'checkbox', name: 'send_from_committer_email', title: "Send from committer",
+ help: "Send notifications from the committer's email address if the domain is part of the domain GitLab is running on (e.g. #{domains})." },
+ { type: 'checkbox', name: 'disable_diffs', title: "Disable code diffs",
+ help: "Don't include possibly sensitive code diffs in notification body." },
{ type: 'textarea', name: 'recipients', placeholder: 'Emails separated by whitespace' },
]
end