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:
authorDouwe Maan <douwe@gitlab.com>2015-09-21 11:35:56 +0300
committerDouwe Maan <douwe@gitlab.com>2015-09-21 11:35:56 +0300
commit0c833498678603e2fd222a2f6386418822ce0a19 (patch)
tree53eebd325693d42276392d44da6e2dd9f6eef768 /app/models
parentee028d9d60522f8993a0b2429ac8a0631d59229a (diff)
parentd2c90d7494e8ca6b37d4ce57b2bc08f8b1175c4b (diff)
Merge branch 'master' into rename-reply-by-email
Diffstat (limited to 'app/models')
-rw-r--r--app/models/ci/commit.rb2
-rw-r--r--app/models/project.rb2
-rw-r--r--app/models/sent_notification.rb14
3 files changed, 14 insertions, 4 deletions
diff --git a/app/models/ci/commit.rb b/app/models/ci/commit.rb
index 23cd47dfe37..f102d0a7679 100644
--- a/app/models/ci/commit.rb
+++ b/app/models/ci/commit.rb
@@ -236,7 +236,7 @@ module Ci
end
def config_processor
- @config_processor ||= Ci::GitlabCiYamlProcessor.new(push_data[:ci_yaml_file] || project.generated_yaml_config)
+ @config_processor ||= Ci::GitlabCiYamlProcessor.new(push_data[:ci_yaml_file])
rescue Ci::GitlabCiYamlProcessor::ValidationError => e
save_yaml_error(e.message)
nil
diff --git a/app/models/project.rb b/app/models/project.rb
index 6e2f9645661..1a5c1c978c9 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -428,7 +428,7 @@ class Project < ActiveRecord::Base
end
def gitlab_ci?
- gitlab_ci_service && gitlab_ci_service.active
+ gitlab_ci_service && gitlab_ci_service.active && gitlab_ci_project.present?
end
def ci_services
diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb
index 2724af8e613..3eed5c16e45 100644
--- a/app/models/sent_notification.rb
+++ b/app/models/sent_notification.rb
@@ -8,6 +8,7 @@
# noteable_type :string(255)
# recipient_id :integer
# commit_id :string(255)
+# line_code :string(255)
# reply_key :string(255) not null
#
@@ -21,6 +22,7 @@ class SentNotification < ActiveRecord::Base
validates :noteable_id, presence: true, unless: :for_commit?
validates :commit_id, presence: true, if: :for_commit?
+ validates :line_code, format: { with: /\A[a-z0-9]+_\d+_\d+\Z/ }, allow_blank: true
class << self
def reply_key
@@ -33,7 +35,7 @@ class SentNotification < ActiveRecord::Base
find_by(reply_key: reply_key)
end
- def record(noteable, recipient_id, reply_key)
+ def record(noteable, recipient_id, reply_key, params = {})
return unless reply_key
noteable_id = nil
@@ -44,7 +46,7 @@ class SentNotification < ActiveRecord::Base
noteable_id = noteable.id
end
- create(
+ params.reverse_merge!(
project: noteable.project,
noteable_type: noteable.class.name,
noteable_id: noteable_id,
@@ -52,6 +54,14 @@ class SentNotification < ActiveRecord::Base
recipient_id: recipient_id,
reply_key: reply_key
)
+
+ create(params)
+ end
+
+ def record_note(note, recipient_id, reply_key, params = {})
+ params[:line_code] = note.line_code
+
+ record(note.noteable, recipient_id, reply_key, params)
end
end