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.
- checksums.yaml +5 -5
- data/README.md +3 -0
- data/app/models/pointless_feedback/message.rb +17 -2
- data/lib/pointless_feedback/version.rb +1 -1
- data/lib/pointless_feedback.rb +3 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +19 -0
- data/test/dummy/log/test.log +1268 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/-San3EpdqmXucKjWKzj9Y4ohakTwPve802nHvuwO7Jo.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/-TbbWWLFMt3DZ-5B-vJndj1TPRC1zyxAx9oZII0qDIs.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/-pidKv4sRS1AHIdUq8SdhCbK7RBLxqZOj2J2IrQ2MNc.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/0VTf0cLtjXR4AmORRQFKGgColA8oNkthmlSu3--4vkA.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/2LTXJO_QqTJ-5H5vls5NuO33l2HnQEPCKyys1rJ9CHU.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/38mZ9NIe5KF1MIDDVKe1TEFBcbukU8SM-tJue0yS3wk.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/6FZ81vWyUKy_DcxXDyZXdmGk9uRdL45m8mIRYeAAki0.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/887XcE3QtqTB1awIHVQ-wZbPREASak6jnAIv5c8YkWs.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/8UZRZEdnJXQI7pEZv5web_6NYGb4tsqrjexyklH9diw.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/AZJGtFTJnm8JYaSaOYw5ksyiBB2wnq7xUR03pySV74s.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/BrYu8MASRWPjOHXf27JbA7JxBQut8DGQqvNrSSbXcRo.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/EWWsa5wkShiSKZ2PTmerV3jNjniPCSr6VKY8-AeWlDA.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/IOGWMsC0BM_CMkmkUN8bS1rbgafmhkAC8dcxottrV4Y.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/KKSQk2Nb-fK9dAUIu54bCqJmsIl8CfyyMiL2kI6RhZA.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/LKQqIm9BPozk5o1llvYa7OYd_UP5yTwGvgR42mgrcgg.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/QrWJdwZgo4HAZ_7Vuhk9kz53541WB0e2f_EZd51klNs.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/UyxPIgqnOJ95iAcVy9cpZEBquCjaDqLAo-ZLVmMQTtY.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ZbStkrcw5La9IsJfkcHZtBR6GXZIYYsZEkeoiAejt14.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/_F3f3F0jM19jFISuXW_iDifAYddNggPVDu0nZsAQ1qs.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/cfiN2OwI0tIVEMcsMPNe3Ne9SI-eG5gK9SUCClSF5PU.cache +3 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ixs_LE4mzdmsCUhekBJ0_i4P33LTFSIfqISpj_BRXQM.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/lUTpNNW813UzMkR7C2NJ5W6EhyzD2WMmeLp94WjnhLY.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/rDNrWZd1_Nv7apS-pCv6ymh9c9MxOx_jBYxb0ecEbJM.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/uFVbUDnZucyvZeWah0qrbvBAmACAym8OCVUhBU80FV8.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/xmAOdsDeC2k2YPPp5IBPPyzY4uZgOtYDMWM4RzxKGuI.cache +1 -0
- data/test/integration/pointless_feedback/feedback_submission_test.rb +23 -0
- data/test/tmp/config/initializers/pointless_feedback.rb +37 -0
- data/test/unit/pointless_feedback/message_test.rb +11 -0
- metadata +65 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d1006c4a0633cba8ab2619732e261e25b68ac3a5
|
4
|
+
data.tar.gz: 14b85dd1f5d81c67e23b2fd9a35ce6e884ffd44b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 => :
|
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)")
|
data/lib/pointless_feedback.rb
CHANGED
@@ -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
|
data/test/dummy/db/schema.rb
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
ActiveRecord::Schema.define(version: 20130501182659) do
|
15
15
|
|
16
|
-
create_table "pointless_feedback_messages", force:
|
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
|
+
[1m[36m (1.4ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
2
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
3
|
+
[1m[36m (1.2ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
4
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
5
|
+
Migrating to CreatePointlessFeedbackMessages (20130501182659)
|
6
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
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
|
+
[1m[35m (0.5ms)[0m 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
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20130501182659"]]
|
10
|
+
[1m[35m (1.1ms)[0m commit transaction
|
11
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
12
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
13
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
14
|
+
[1m[36m (1.5ms)[0m [1mCREATE 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) [0m
|
15
|
+
[1m[35m (1.4ms)[0m CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
|
16
|
+
[1m[36m (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
17
|
+
[1m[35m (1.4ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
18
|
+
[1m[36m (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
19
|
+
[1m[35m (1.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20130501182659')
|