Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
connection_pool (2.2.1)
connection_pool (2.2.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.4)
Expand Down Expand Up @@ -186,9 +186,9 @@ GEM
pry (>= 0.10.4)
public_suffix (3.0.0)
puma (3.8.2)
rack (2.0.1)
rack (2.0.5)
rack-cors (0.4.1)
rack-protection (2.0.0)
rack-protection (2.0.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
Expand Down Expand Up @@ -226,7 +226,7 @@ GEM
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
redis (3.3.3)
redis (3.3.5)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
rubocop (0.55.0)
Expand All @@ -248,11 +248,10 @@ GEM
ruby_http_client (~> 3.0.1)
sentry-raven (2.5.3)
faraday (>= 0.7.6, < 1.0)
sidekiq (4.2.10)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
sidekiq (5.2.1)
connection_pool (~> 2.2, >= 2.2.2)
rack-protection (>= 1.5.0)
redis (~> 3.2, >= 3.2.1)
redis (>= 3.3.5, < 5)
skylight (1.5.0)
activesupport (>= 3.0.0)
spring (2.0.1)
Expand Down
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
RAILS_CONTAINER := web
DOCKER := docker

.PHONY: all
all: run
all: run


.PHONY: nuke
nuke:
${DOCKER} system prune -a --volumes

.PHONY: rmi
rmi:
${DOCKER} images -q | xargs docker rmi -f

.PHONY: rmdi
rmdi:
${DOCKER} images -a --filter=dangling=true -q | xargs ${DOCKER} rmi

.PHONY: rm-exited-containers
rm-exited-containers:
${DOCKER} ps -a -q -f status=exited | xargs ${DOCKER} rm -v

.PHONY: console-sandbox
console-sandbox:
Expand Down
8 changes: 2 additions & 6 deletions app/jobs/send_email_to_leaders_job.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
class SendEmailToLeadersJob < ActiveJob::Base
queue_as :default

def perform(user_id)
user = User.find(user_id)

User.community_leaders_nearby(user.latitude, user.longitude, 50).each do |leader|
UserMailer.new_user_in_leader_area(leader, user)
end
def perform(_user_id)
logger.debug 'Deprecated pathway, trying to determine what is placing this on queue.'
end
end
5 changes: 2 additions & 3 deletions app/jobs/slack_jobs/inviter_job.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
class SlackJobs
class InviterJob < SlackJobs
def perform(email)
# Invites user to general channel
slack_client.invite(email: email, channels: ['C03GSNF77'])
def perform(_email)
logger.debug 'Deprecated pathway, trying to determine what is placing this on queue.'
end
end
end
5 changes: 2 additions & 3 deletions app/jobs/slack_jobs/notifier_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ class SlackJobs
class SlackNotifierJob < SlackJobs
queue_as :default

def perform(message, channel: '#general')
res = slack_client.post_message_to channel: channel, with_text: message
Rails.logger.debug("Notified channel: #{res.inspect}")
def perform(_message, *)
logger.debug 'Deprecated pathway, trying to determine what is placing this on queue.'
end
end
end
14 changes: 7 additions & 7 deletions config/initializers/sidekiq.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require 'sidekiq'

# Setting the ENV['DATABASE_URL'] explicitly to allow for use of a
# dynamic database host variable ENV['POSTGRES_HOST']
#
# @see https://github.com/mperham/sidekiq/wiki/Advanced-Options#rails-32-and-newer
#
Sidekiq.configure_server do |config|
ENV['DATABASE_URL'] = ENV['POSTGRES_HOST'].present? ? ENV['POSTGRES_HOST'] : 'operationcode-psql'

# https://stackoverflow.com/questions/28412913/disable-automatic-retry-with-activejob-used-with-sidekiq
# prevent excessive retries from some default status.
config.death_handlers << lambda { |job, e|
# thanks rob for the nice message
evt = Raven::Event.new(message: "#{job['class']} #{job['jid']} done run outta tries.")
Raven.send_event(evt)
}
Rails.logger = Sidekiq::Logging.logger
ActiveRecord::Base.logger = Sidekiq::Logging.logger
end
13 changes: 0 additions & 13 deletions test/jobs/send_email_to_leaders_job_test.rb

This file was deleted.

15 changes: 0 additions & 15 deletions test/models/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,6 @@ def user_opts
refute '@example.com' =~ User::VALID_EMAIL
end

test '.community_leaders_nearby returns leaders within a radius from a lat/long' do
User.any_instance.stubs(:geocode)
tom = create :user, latitude: 1, longitude: 1
tom.tag_list.add(User::LEADER)
tom.save!
far_away_leader = create :user, latitude: 20, longitude: 20
far_away_leader.tag_list.add(User::LEADER)
far_away_leader.save!
not_a_leader = create :user, latitude: 1, longitude: 1
results = User.community_leaders_nearby(1, 1, 10)
assert_includes results, tom
assert_not_includes results, far_away_leader
assert_not_includes results, not_a_leader
end

test '.fetch_social_user_and_redirect_path returns the user and redirect path in an array' do
data = { first_name: 'Sterling', last_name: 'Archer', email: 'cyril@kickme.org', zip: '12345', password: 'VoiceMail' }
results = User.fetch_social_user_and_redirect_path(data)
Expand Down