Merge pull request #4635 from consul/dependabot/bundler/master/ahoy_matey-3.2.0
Bump ahoy_matey from 1.6.0 to 3.2.0
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -4,7 +4,7 @@ gem "rails", "5.2.6"
|
|||||||
|
|
||||||
gem "acts-as-taggable-on", "~> 8.1.0"
|
gem "acts-as-taggable-on", "~> 8.1.0"
|
||||||
gem "acts_as_votable", "~> 0.13.1"
|
gem "acts_as_votable", "~> 0.13.1"
|
||||||
gem "ahoy_matey", "~> 1.6.0"
|
gem "ahoy_matey", "~> 3.2.0"
|
||||||
gem "airbrake", "~> 7.4.0"
|
gem "airbrake", "~> 7.4.0"
|
||||||
gem "ancestry", "~> 4.1.0"
|
gem "ancestry", "~> 4.1.0"
|
||||||
gem "audited", "~> 5.0.1"
|
gem "audited", "~> 5.0.1"
|
||||||
@@ -59,6 +59,7 @@ gem "translator-text", "~> 0.1.0"
|
|||||||
gem "turbolinks", "~> 5.2.1"
|
gem "turbolinks", "~> 5.2.1"
|
||||||
gem "turnout", "~> 2.5.0"
|
gem "turnout", "~> 2.5.0"
|
||||||
gem "uglifier", "~> 4.2.0"
|
gem "uglifier", "~> 4.2.0"
|
||||||
|
gem "uuidtools", "~> 2.1.5"
|
||||||
gem "view_component", "~> 2.37.0", require: "view_component/engine"
|
gem "view_component", "~> 2.37.0", require: "view_component/engine"
|
||||||
gem "whenever", "~> 1.0.0", require: false
|
gem "whenever", "~> 1.0.0", require: false
|
||||||
gem "wicked_pdf", "~> 2.1.0"
|
gem "wicked_pdf", "~> 2.1.0"
|
||||||
|
|||||||
33
Gemfile.lock
33
Gemfile.lock
@@ -48,17 +48,11 @@ GEM
|
|||||||
acts_as_votable (0.13.1)
|
acts_as_votable (0.13.1)
|
||||||
addressable (2.8.0)
|
addressable (2.8.0)
|
||||||
public_suffix (>= 2.0.2, < 5.0)
|
public_suffix (>= 2.0.2, < 5.0)
|
||||||
ahoy_matey (1.6.0)
|
ahoy_matey (3.2.0)
|
||||||
addressable
|
activesupport (>= 5)
|
||||||
browser (~> 2.0)
|
device_detector
|
||||||
geocoder
|
geocoder (>= 1.4.5)
|
||||||
rack-attack (< 6)
|
safely_block (>= 0.2.1)
|
||||||
railties
|
|
||||||
referer-parser (>= 0.3.0)
|
|
||||||
request_store
|
|
||||||
safely_block (>= 0.1.1)
|
|
||||||
user_agent_parser
|
|
||||||
uuidtools
|
|
||||||
airbrake (7.4.0)
|
airbrake (7.4.0)
|
||||||
airbrake-ruby (~> 2.12)
|
airbrake-ruby (~> 2.12)
|
||||||
airbrake-ruby (2.12.0)
|
airbrake-ruby (2.12.0)
|
||||||
@@ -89,7 +83,6 @@ GEM
|
|||||||
parser (>= 2.4)
|
parser (>= 2.4)
|
||||||
smart_properties
|
smart_properties
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
browser (2.5.3)
|
|
||||||
builder (3.2.4)
|
builder (3.2.4)
|
||||||
bullet (6.1.4)
|
bullet (6.1.4)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
@@ -172,6 +165,7 @@ GEM
|
|||||||
delayed_job_active_record (4.1.6)
|
delayed_job_active_record (4.1.6)
|
||||||
activerecord (>= 3.0, < 6.2)
|
activerecord (>= 3.0, < 6.2)
|
||||||
delayed_job (>= 3.0, < 5)
|
delayed_job (>= 3.0, < 5)
|
||||||
|
device_detector (1.0.5)
|
||||||
devise (4.8.0)
|
devise (4.8.0)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
@@ -222,7 +216,7 @@ GEM
|
|||||||
rainbow
|
rainbow
|
||||||
rubocop
|
rubocop
|
||||||
smart_properties
|
smart_properties
|
||||||
errbase (0.0.3)
|
errbase (0.2.1)
|
||||||
erubi (1.10.0)
|
erubi (1.10.0)
|
||||||
eslintrb (2.1.0)
|
eslintrb (2.1.0)
|
||||||
execjs
|
execjs
|
||||||
@@ -269,7 +263,7 @@ GEM
|
|||||||
activemodel (>= 4.1, < 7.0)
|
activemodel (>= 4.1, < 7.0)
|
||||||
activesupport (>= 4.1, < 7.0)
|
activesupport (>= 4.1, < 7.0)
|
||||||
railties (>= 4.1, < 7.0)
|
railties (>= 4.1, < 7.0)
|
||||||
geocoder (1.6.3)
|
geocoder (1.6.7)
|
||||||
github_changelog_generator (1.15.2)
|
github_changelog_generator (1.15.2)
|
||||||
activesupport
|
activesupport
|
||||||
faraday-http-cache
|
faraday-http-cache
|
||||||
@@ -476,8 +470,6 @@ GEM
|
|||||||
rack (2.2.3)
|
rack (2.2.3)
|
||||||
rack-accept (0.4.5)
|
rack-accept (0.4.5)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
rack-attack (5.0.1)
|
|
||||||
rack
|
|
||||||
rack-proxy (0.7.0)
|
rack-proxy (0.7.0)
|
||||||
rack
|
rack
|
||||||
rack-test (1.1.0)
|
rack-test (1.1.0)
|
||||||
@@ -519,7 +511,6 @@ GEM
|
|||||||
recipient_interceptor (0.3.0)
|
recipient_interceptor (0.3.0)
|
||||||
mail
|
mail
|
||||||
redcarpet (3.5.1)
|
redcarpet (3.5.1)
|
||||||
referer-parser (0.3.0)
|
|
||||||
regexp_parser (2.1.1)
|
regexp_parser (2.1.1)
|
||||||
request_store (1.5.0)
|
request_store (1.5.0)
|
||||||
rack (>= 1.4)
|
rack (>= 1.4)
|
||||||
@@ -575,8 +566,8 @@ GEM
|
|||||||
rvm1-capistrano3 (1.4.0)
|
rvm1-capistrano3 (1.4.0)
|
||||||
capistrano (~> 3.0)
|
capistrano (~> 3.0)
|
||||||
sshkit (>= 1.2)
|
sshkit (>= 1.2)
|
||||||
safely_block (0.2.0)
|
safely_block (0.3.0)
|
||||||
errbase
|
errbase (>= 0.1.1)
|
||||||
sass (3.7.4)
|
sass (3.7.4)
|
||||||
sass-listen (~> 4.0.0)
|
sass-listen (~> 4.0.0)
|
||||||
sass-listen (4.0.0)
|
sass-listen (4.0.0)
|
||||||
@@ -664,7 +655,6 @@ GEM
|
|||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
unicode-display_width (1.7.0)
|
unicode-display_width (1.7.0)
|
||||||
uniform_notifier (1.14.2)
|
uniform_notifier (1.14.2)
|
||||||
user_agent_parser (2.6.0)
|
|
||||||
uuidtools (2.1.5)
|
uuidtools (2.1.5)
|
||||||
view_component (2.37.0)
|
view_component (2.37.0)
|
||||||
activesupport (>= 5.0.0, < 8.0)
|
activesupport (>= 5.0.0, < 8.0)
|
||||||
@@ -702,7 +692,7 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
acts-as-taggable-on (~> 8.1.0)
|
acts-as-taggable-on (~> 8.1.0)
|
||||||
acts_as_votable (~> 0.13.1)
|
acts_as_votable (~> 0.13.1)
|
||||||
ahoy_matey (~> 1.6.0)
|
ahoy_matey (~> 3.2.0)
|
||||||
airbrake (~> 7.4.0)
|
airbrake (~> 7.4.0)
|
||||||
ancestry (~> 4.1.0)
|
ancestry (~> 4.1.0)
|
||||||
audited (~> 5.0.1)
|
audited (~> 5.0.1)
|
||||||
@@ -796,6 +786,7 @@ DEPENDENCIES
|
|||||||
turbolinks (~> 5.2.1)
|
turbolinks (~> 5.2.1)
|
||||||
turnout (~> 2.5.0)
|
turnout (~> 2.5.0)
|
||||||
uglifier (~> 4.2.0)
|
uglifier (~> 4.2.0)
|
||||||
|
uuidtools (~> 2.1.5)
|
||||||
view_component (~> 2.37.0)
|
view_component (~> 2.37.0)
|
||||||
web-console (~> 3.7.0)
|
web-console (~> 3.7.0)
|
||||||
webdrivers (~> 4.6.0)
|
webdrivers (~> 4.6.0)
|
||||||
|
|||||||
@@ -48,8 +48,7 @@ class Debate < ApplicationRecord
|
|||||||
scope :featured, -> { where.not(featured_at: nil) }
|
scope :featured, -> { where.not(featured_at: nil) }
|
||||||
scope :public_for_api, -> { all }
|
scope :public_for_api, -> { all }
|
||||||
|
|
||||||
# Ahoy setup
|
visitable class_name: "Visit"
|
||||||
visitable # Ahoy will automatically assign visit_id on create
|
|
||||||
|
|
||||||
attr_accessor :link_required
|
attr_accessor :link_required
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,36 @@
|
|||||||
Ahoy.geocode = false
|
Ahoy.geocode = false
|
||||||
|
Ahoy.api = true
|
||||||
|
Ahoy.server_side_visits = :when_needed
|
||||||
|
|
||||||
class Ahoy::Store < Ahoy::Stores::ActiveRecordStore
|
# Most code comes from:
|
||||||
# Track user IP
|
# https://github.com/ankane/ahoy/blob/3661b7f9a/docs/Ahoy-2-Upgrade.md
|
||||||
def track_event(name, properties, options)
|
class Ahoy::Store < Ahoy::DatabaseStore
|
||||||
super do |event|
|
def track_visit(data)
|
||||||
event.ip = request.ip
|
data[:id] = ensure_uuid(data.delete(:visit_token))
|
||||||
|
data[:visitor_id] = ensure_uuid(data.delete(:visitor_token))
|
||||||
|
super(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def track_event(data)
|
||||||
|
data[:id] = ensure_uuid(data.delete(:event_id))
|
||||||
|
data[:ip] = request.ip
|
||||||
|
super(data)
|
||||||
|
end
|
||||||
|
|
||||||
|
def visit
|
||||||
|
@visit ||= visit_model.find_by(id: ensure_uuid(ahoy.visit_token)) if ahoy.visit_token
|
||||||
|
end
|
||||||
|
|
||||||
|
def visit_model
|
||||||
|
Visit
|
||||||
|
end
|
||||||
|
|
||||||
|
UUID_NAMESPACE = UUIDTools::UUID.parse("a82ae811-5011-45ab-a728-569df7499c5f")
|
||||||
|
|
||||||
|
def ensure_uuid(id)
|
||||||
|
UUIDTools::UUID.parse(id).to_s
|
||||||
|
rescue
|
||||||
|
UUIDTools::UUID.sha1_create(UUID_NAMESPACE, id).to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def exclude?
|
def exclude?
|
||||||
|
|||||||
Reference in New Issue
Block a user