pointless_feedback 4.1.1 → 4.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +3 -0
  3. data/app/models/pointless_feedback/message.rb +17 -2
  4. data/lib/pointless_feedback/version.rb +1 -1
  5. data/lib/pointless_feedback.rb +3 -0
  6. data/test/dummy/db/development.sqlite3 +0 -0
  7. data/test/dummy/db/schema.rb +1 -1
  8. data/test/dummy/db/test.sqlite3 +0 -0
  9. data/test/dummy/log/development.log +19 -0
  10. data/test/dummy/log/test.log +1268 -0
  11. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/-San3EpdqmXucKjWKzj9Y4ohakTwPve802nHvuwO7Jo.cache +1 -0
  12. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/-TbbWWLFMt3DZ-5B-vJndj1TPRC1zyxAx9oZII0qDIs.cache +2 -0
  13. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/-pidKv4sRS1AHIdUq8SdhCbK7RBLxqZOj2J2IrQ2MNc.cache +1 -0
  14. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/0VTf0cLtjXR4AmORRQFKGgColA8oNkthmlSu3--4vkA.cache +0 -0
  15. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/2LTXJO_QqTJ-5H5vls5NuO33l2HnQEPCKyys1rJ9CHU.cache +1 -0
  16. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/38mZ9NIe5KF1MIDDVKe1TEFBcbukU8SM-tJue0yS3wk.cache +0 -0
  17. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/6FZ81vWyUKy_DcxXDyZXdmGk9uRdL45m8mIRYeAAki0.cache +2 -0
  18. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/887XcE3QtqTB1awIHVQ-wZbPREASak6jnAIv5c8YkWs.cache +0 -0
  19. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/8UZRZEdnJXQI7pEZv5web_6NYGb4tsqrjexyklH9diw.cache +0 -0
  20. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/AZJGtFTJnm8JYaSaOYw5ksyiBB2wnq7xUR03pySV74s.cache +1 -0
  21. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/BrYu8MASRWPjOHXf27JbA7JxBQut8DGQqvNrSSbXcRo.cache +2 -0
  22. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/EWWsa5wkShiSKZ2PTmerV3jNjniPCSr6VKY8-AeWlDA.cache +2 -0
  23. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/IOGWMsC0BM_CMkmkUN8bS1rbgafmhkAC8dcxottrV4Y.cache +0 -0
  24. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/KKSQk2Nb-fK9dAUIu54bCqJmsIl8CfyyMiL2kI6RhZA.cache +1 -0
  25. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/LKQqIm9BPozk5o1llvYa7OYd_UP5yTwGvgR42mgrcgg.cache +1 -0
  26. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/QrWJdwZgo4HAZ_7Vuhk9kz53541WB0e2f_EZd51klNs.cache +0 -0
  27. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/UyxPIgqnOJ95iAcVy9cpZEBquCjaDqLAo-ZLVmMQTtY.cache +1 -0
  28. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ZbStkrcw5La9IsJfkcHZtBR6GXZIYYsZEkeoiAejt14.cache +1 -0
  29. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/_F3f3F0jM19jFISuXW_iDifAYddNggPVDu0nZsAQ1qs.cache +0 -0
  30. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/cfiN2OwI0tIVEMcsMPNe3Ne9SI-eG5gK9SUCClSF5PU.cache +3 -0
  31. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ixs_LE4mzdmsCUhekBJ0_i4P33LTFSIfqISpj_BRXQM.cache +2 -0
  32. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/lUTpNNW813UzMkR7C2NJ5W6EhyzD2WMmeLp94WjnhLY.cache +1 -0
  33. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/rDNrWZd1_Nv7apS-pCv6ymh9c9MxOx_jBYxb0ecEbJM.cache +1 -0
  34. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/uFVbUDnZucyvZeWah0qrbvBAmACAym8OCVUhBU80FV8.cache +0 -0
  35. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/xmAOdsDeC2k2YPPp5IBPPyzY4uZgOtYDMWM4RzxKGuI.cache +1 -0
  36. data/test/integration/pointless_feedback/feedback_submission_test.rb +23 -0
  37. data/test/tmp/config/initializers/pointless_feedback.rb +37 -0
  38. data/test/unit/pointless_feedback/message_test.rb +11 -0
  39. metadata +65 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: c708551220ab5045f7291f1f77108b0d4464c70b970f50370033dc0ec14d8bb8
4
- data.tar.gz: 00c3a39082d46221211e902630f3cda5d5d418aca50cef3dded180d5a788fe28
2
+ SHA1:
3
+ metadata.gz: d1006c4a0633cba8ab2619732e261e25b68ac3a5
4
+ data.tar.gz: 14b85dd1f5d81c67e23b2fd9a35ce6e884ffd44b
5
5
  SHA512:
6
- metadata.gz: 77adb12e5be3c75e4183dd689d1d86a93b57065ed06d831ca935ce3ff91b55a549c3ae42a37f02d486e6908a41c317f03f76dd77296e559e29d306655cfbd89d
7
- data.tar.gz: a1eea0c5befc0785fc23b3204160c67e2348afe18b3651baff0032a79dec61fb8b68c2c920b6d8728a27ed486544898cb577a6f12855eb5b6c8154b29b3f4478
6
+ metadata.gz: 06eee19b847d1e7b6757b76ceab315e351b90c8089a7a9c9a9ebd3d97774d1f6f6705808c00d69d38488c826683b2f66a7f3d8996edaf3508cbaffb6588eefd6
7
+ data.tar.gz: 0c7fbe829f3af460bb03d50a934dcbee2d31ef52573a472f4d215e47609d4933b87ff36b4cd8932a33fdcbaf899af007861b327d1bece8b0f268867aa5e0c789
data/README.md CHANGED
@@ -92,6 +92,9 @@ Specifies what address the feedback email is sent from.
92
92
  **table_name:**
93
93
  Defaults to engine's namespace, e.g. `pointless_feedback_messages`. Change to any desired table for `PointlessFeedback::Message` model.
94
94
 
95
+ **invalid_words:**
96
+ List of words in the feedback description that would prevent an email from sending.
97
+
95
98
  **google_captcha_site_key & google_captcha_secret_key:**
96
99
  If you'd like to block out the robots, set up a Google Captcha instance:
97
100
 
@@ -11,7 +11,7 @@ module PointlessFeedback
11
11
  validates :email_address, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
12
12
  validate :is_not_spam
13
13
 
14
- after_save :export_feedback, :unless => :honeypot_filled_in?
14
+ after_save :export_feedback, :unless => :ignore_feedback?
15
15
 
16
16
  private
17
17
 
@@ -34,7 +34,8 @@ module PointlessFeedback
34
34
  "Name" => name,
35
35
  "Email" => email_address,
36
36
  "Topic" => topic,
37
- "Description" => description
37
+ "Description" => description,
38
+ "Date" => created_at.strftime("%m/%d/%y")
38
39
  )
39
40
  rescue => e
40
41
  # ignore errors in production, last thing you want is a 500
@@ -44,10 +45,24 @@ module PointlessFeedback
44
45
  end
45
46
  end
46
47
 
48
+ def ignore_feedback?
49
+ honeypot_filled_in? || contains_invalid_words?
50
+ end
51
+
47
52
  def honeypot_filled_in?
48
53
  contact_info.present?
49
54
  end
50
55
 
56
+ def contains_invalid_words?
57
+ PointlessFeedback.invalid_words.each do |word|
58
+ if description.downcase.include? word.downcase
59
+ return true
60
+ end
61
+ end
62
+
63
+ false
64
+ end
65
+
51
66
  def is_not_spam
52
67
  if URI.extract(description || "").count >= 3
53
68
  errors.add(:description, "can not contain more than 2 http links (often a sign of spam)")
@@ -1,3 +1,3 @@
1
1
  module PointlessFeedback
2
- VERSION = "4.1.1"
2
+ VERSION = "4.1.4"
3
3
  end
@@ -52,6 +52,9 @@ module PointlessFeedback
52
52
  mattr_accessor :airtable_table_name
53
53
  @@airtable_table_name = nil
54
54
 
55
+ mattr_accessor :invalid_words
56
+ @@invalid_words = []
57
+
55
58
  # Default way to setup PointlessFeedback. Run rails generate
56
59
  # pointless_feedback_install to create a fresh initializer with all
57
60
  # configuration values.
Binary file
@@ -13,7 +13,7 @@
13
13
 
14
14
  ActiveRecord::Schema.define(version: 20130501182659) do
15
15
 
16
- create_table "pointless_feedback_messages", force: true do |t|
16
+ create_table "pointless_feedback_messages", force: :cascade do |t|
17
17
  t.string "name"
18
18
  t.string "email_address"
19
19
  t.string "topic"
Binary file
@@ -0,0 +1,19 @@
1
+  (1.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2
+  (0.1ms) select sqlite_version(*)
3
+  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
+ Migrating to CreatePointlessFeedbackMessages (20130501182659)
6
+  (0.1ms) begin transaction
7
+ DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/noahover/projects/pointless-feedback/db/migrate/20130501182659_create_pointless_feedback_messages.rb:9)
8
+  (0.5ms) CREATE TABLE "pointless_feedback_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "email_address" varchar, "topic" varchar, "description" text, "created_at" datetime, "updated_at" datetime)
9
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20130501182659"]]
10
+  (1.1ms) commit transaction
11
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
12
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
13
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
14
+  (1.5ms) CREATE TABLE "pointless_feedback_messages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "email_address" varchar, "topic" varchar, "description" text, "created_at" datetime, "updated_at" datetime) 
15
+  (1.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
16
+  (0.1ms) select sqlite_version(*)
17
+  (1.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
18
+  (0.1ms) SELECT version FROM "schema_migrations"
19
+  (1.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20130501182659')