pointless_feedback 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 22c0743002d373401305b783af5a1eb1d5f894df
4
+ data.tar.gz: de0bec8b6b7f0ad40472a8c60c793336d5aed801
5
+ SHA512:
6
+ metadata.gz: 46abc7c95c0aa00090624e45d8dd9e2ac134d92c2df9fb2976f1dc3a0d3bf06586bbc04dc9f0f2b10ea4780a84dfc558028f04118cd6496e869ded1df32570da
7
+ data.tar.gz: 7ab344903b80b2f536078b80dca080ddfefcf47db19f9736798adc045c4fdff41511c51560acd67f6791029eacf0b3ea0b8fe279a621e61758f88d96555d8eed
@@ -2,15 +2,19 @@ module PointlessFeedback
2
2
  class FeedbackMailer < ActionMailer::Base
3
3
  default :from => PointlessFeedback.from_email
4
4
 
5
- def feedback(email, message)
5
+ def feedback(message)
6
6
  @message = message
7
- mail(:to => email, :subject => feedback_subject)
7
+ mail(:to => to_emails, :subject => feedback_subject)
8
8
  end
9
9
 
10
10
  private
11
11
 
12
+ def to_emails
13
+ Array(PointlessFeedback.to_emails)
14
+ end
15
+
12
16
  def feedback_subject
13
- I18n.t('pointless_feedback.email.subject', :default => 'Pointless Feedback')
17
+ I18n.t('pointless_feedback.email.subject', :default => 'Feedback')
14
18
  end
15
19
  end
16
20
  end
@@ -6,6 +6,7 @@ module PointlessFeedback
6
6
  validates :name, :email_address, :topic, :description, :presence => true
7
7
  validates :topic, :inclusion => PointlessFeedback.message_topics
8
8
  validates :email_address, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
9
+ validate :is_not_spam
9
10
 
10
11
  after_save :export_feedback, :unless => :honeypot_filled_in?
11
12
 
@@ -13,14 +14,18 @@ module PointlessFeedback
13
14
 
14
15
  def export_feedback
15
16
  if PointlessFeedback.email_feedback
16
- PointlessFeedback.to_emails.each do |email|
17
- FeedbackMailer.feedback(email, self).deliver
18
- end
17
+ FeedbackMailer.feedback(self).deliver
19
18
  end
20
19
  end
21
20
 
22
21
  def honeypot_filled_in?
23
22
  contact_info.present?
24
23
  end
24
+
25
+ def is_not_spam
26
+ if URI.extract(description || "").count >= 3
27
+ errors.add(:description, "can not contain more than 2 http links (often a sign of spam)")
28
+ end
29
+ end
25
30
  end
26
31
  end
@@ -1,3 +1,3 @@
1
1
  module PointlessFeedback
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -185,3 +185,8 @@ Served asset /jquery_ujs.js - 304 Not Modified (2ms)
185
185
 
186
186
  Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-11-07 15:50:08 -0700
187
187
  Served asset /application.js - 304 Not Modified (3ms)
188
+ Connecting to database specified by database.yml
189
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
190
+ Migrating to CreatePointlessFeedbackMessages (20130501182659)
191
+  (0.1ms) select sqlite_version(*)
192
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"