Skip to content

Commit

Permalink
Simplified to use only users inside a domain.
Browse files Browse the repository at this point in the history
  • Loading branch information
gpambrozio committed Jan 5, 2012
1 parent 01f5e68 commit 498ef3e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions reviewthis.rb
Expand Up @@ -3,7 +3,6 @@
require 'json'
require 'mustache/sinatra'
require 'pony'
require 'octopussy'

configure do
set :mustache, {
Expand All @@ -20,7 +19,8 @@
# production vars
configure :production do
# only run on Heroku
set :from, ENV['SENDGRID_USERNAME']
set :from, 'development@getarrived.com'
set :domain, 'getarrived.com'
set :via, :smtp
set :via_options, {
:address => "smtp.sendgrid.net",
Expand Down Expand Up @@ -62,7 +62,7 @@ def mail(vars)
:repo_name => "test",
:repo_url => "http://github.com",
:username => "test",
:email => params[:testemail],
:email => "#{params[:testemail]}@#{options.domain}",
}
mail(vars)
end
Expand Down Expand Up @@ -93,18 +93,17 @@ def mail(vars)
:repo_url => push['repository']['url'],
}

# let's find all the github users
# Send to our users
message.scan(USER) do |username|
user = Octopussy.user(username) # get the github user info
vars[:username] = user.name
vars[:email] = user.email
vars[:username] = username[0]
vars[:email] = "#{username[0]}@#{options.domain}"
mail(vars)
end

# now let's find any email addresses
message.scan(EMAIL) do |email|
vars[:username] = email
vars[:email] = email
vars[:username] = email[0]
vars[:email] = email[0]
mail(vars)
end

Expand Down

0 comments on commit 498ef3e

Please sign in to comment.