Merge branch 'production' of github.com:diaspora/diaspora into production
Conflicts: app/models/user.rb config/deploy.rb spec/factories.rb spec/models/request_spec.rb spec/spec_helper.rb
This commit is contained in:
commit
c1a9a89be7
12 changed files with 89 additions and 17 deletions
|
|
@ -53,4 +53,4 @@ class UsersController < ApplicationController
|
|||
params[:profile][:image_url] = "http://" + request.host + ":" + request.port.to_s + params[:profile][:image_url]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -46,7 +46,10 @@ class User
|
|||
|
||||
many :aspects, :class_name => 'Aspect'
|
||||
|
||||
before_validation_on_create :setup_person
|
||||
after_validation_on_create :setup_person
|
||||
after_create :seed_groups
|
||||
after_save :check_for_tommy
|
||||
|
||||
before_validation :do_bad_things
|
||||
before_save :downcase_username
|
||||
|
||||
|
|
@ -61,6 +64,23 @@ class User
|
|||
|
||||
######## Making things work ########
|
||||
key :email, String
|
||||
validates_true_for :email, :logic => lambda {self.allowed_email? unless email.nil?}
|
||||
|
||||
|
||||
def allowed_email?
|
||||
allowed_emails = ["@pivotallabs.com", "@joindiaspora.com", "@sofaer.net",
|
||||
"wchulley@gmail.com", "kimfuh@yahoo.com", "CJichi@yahoo.com",
|
||||
"madkisso@mit.edu", "bribak@msn.com", "asykley@verizon.net",
|
||||
"paulhaeberli@gmail.com","bondovatic@gmail.com", "dixon1e@yahoo.com"]
|
||||
|
||||
allowed_emails.each{|allowed|
|
||||
if email.include?(allowed)
|
||||
return true
|
||||
end
|
||||
}
|
||||
false
|
||||
end
|
||||
|
||||
ensure_index :email
|
||||
|
||||
def method_missing(method, *args)
|
||||
|
|
@ -313,10 +333,19 @@ class User
|
|||
"#{self.username}@#{self.terse_url}"
|
||||
end
|
||||
|
||||
|
||||
def do_bad_things
|
||||
self.password_confirmation = self.password
|
||||
end
|
||||
|
||||
def seed_groups
|
||||
group(:name => "Acquaintances")
|
||||
group(:name => "Family")
|
||||
group(:name => "Work")
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def setup_person
|
||||
self.person.serialized_key ||= User.generate_key.export
|
||||
self.person.email ||= email
|
||||
|
|
|
|||
|
|
@ -35,8 +35,19 @@ Diaspora::Application.configure do
|
|||
config.action_controller.perform_caching = false
|
||||
|
||||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
config.action_mailer.raise_delivery_errors = true
|
||||
config.active_support.deprecation = :log
|
||||
config.middleware.use MongoMapper::ClearDevMemory
|
||||
#config.threadsafe!
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
|
||||
config.action_mailer.smtp_settings = {
|
||||
:address => 'smtp.gmail.com',
|
||||
:port => 587,
|
||||
:domain => 'mail.joindiaspora.com',
|
||||
:authentication => 'plain',
|
||||
:user_name => 'diaspora-pivots@joindiaspora.com',
|
||||
:password => "xy289|]G+R*-kA",
|
||||
:enable_starttls_auto => true
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ Diaspora::Application.configure do
|
|||
config.action_controller.perform_caching = true
|
||||
|
||||
# Specifies the header that your server uses for sending files
|
||||
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
||||
#config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
||||
|
||||
# For nginx:
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
||||
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
||||
|
||||
# If you have no front-end server that supports something like X-Sendfile,
|
||||
# just comment this out and Rails will serve the files
|
||||
|
|
@ -48,7 +48,7 @@ Diaspora::Application.configure do
|
|||
|
||||
# Disable Rails's static asset server
|
||||
# In production, Apache or nginx will already do this
|
||||
config.serve_static_assets = true
|
||||
#config.serve_static_assets = true
|
||||
|
||||
# Enable serving of images, stylesheets, and javascripts from an asset server
|
||||
# config.action_controller.asset_host = "http://assets.example.com"
|
||||
|
|
@ -56,12 +56,20 @@ Diaspora::Application.configure do
|
|||
# Disable delivery errors, bad email addresses will be ignored
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Enable threaded mode
|
||||
# config.threadsafe!
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation can not be found)
|
||||
config.i18n.fallbacks = true
|
||||
config.threadsafe!
|
||||
|
||||
config.action_mailer.delivery_method = :smtp
|
||||
config.action_mailer.default_url_options = {:host => 'pivots.joindiaspora.com'}
|
||||
config.action_mailer.smtp_settings = {
|
||||
:address => 'smtp.gmail.com',
|
||||
:port => 587,
|
||||
:domain => 'mail.joindiaspora.com',
|
||||
:authentication => 'plain',
|
||||
:user_name => 'diaspora-pivots@joindiaspora.com',
|
||||
:password => "xy289|]G+R*-kA",
|
||||
:enable_starttls_auto => true
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ http {
|
|||
server {
|
||||
|
||||
listen 80;
|
||||
server_name babycakes.sofaer.net www.babycakes.sofaer.net;
|
||||
server_name pivots.joindiaspora.com www.pivots.joindiaspora.com;
|
||||
root /usr/local/app/diaspora/current;
|
||||
|
||||
location / {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ require "#{File.dirname(__FILE__)}/packages/server"
|
|||
require "#{File.dirname(__FILE__)}/packages/scm"
|
||||
require "#{File.dirname(__FILE__)}/packages/ruby"
|
||||
|
||||
policy :diaspora, :roles => [:tom,:backer] do
|
||||
policy :diaspora, :roles => [:pivots] do
|
||||
# requires :clean_dreamhost
|
||||
requires :tools
|
||||
requires :rubygems
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ max_conns: 1024
|
|||
require: []
|
||||
|
||||
max_persistent_conns: 512
|
||||
environment: development
|
||||
environment: production
|
||||
servers: 1
|
||||
daemonize: true
|
||||
#chdir: /usr/applications/localhash/current
|
||||
#socket: /tmp/thin.sock
|
||||
port: 80
|
||||
socket: /tmp/thin.sock
|
||||
#port: 80
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
require 'config/environment'
|
||||
|
||||
remote_url = "http://tom.joindiaspora.com/"
|
||||
remote_url = "http://localhost:3000/"
|
||||
# Create seed user
|
||||
user = User.instantiate!( :email => "tom@tom.joindiaspora.com",
|
||||
:username => "tom",
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ end
|
|||
|
||||
Factory.define :user do |u|
|
||||
u.sequence(:username) {|n| "bob#{n}"}
|
||||
u.sequence(:email) {|n| "bob#{n}@aol.com"}
|
||||
u.sequence(:email) {|n| "bob#{n}@pivotallabs.com"}
|
||||
u.password "bluepin7"
|
||||
u.password_confirmation "bluepin7"
|
||||
u.person { |a| Factory.create(:person_with_user, :owner_id => a._id)}
|
||||
|
|
|
|||
|
|
@ -34,12 +34,11 @@ describe Request do
|
|||
end
|
||||
|
||||
it 'should generate xml for the User as a Person' do
|
||||
|
||||
request = @user.send_friend_request_to Factory.create(:person), @aspect
|
||||
|
||||
xml = request.to_xml.to_s
|
||||
|
||||
xml.include?(@user.person.email).should be true
|
||||
xml.include?(@user.email).should be true
|
||||
xml.include?(@user.url).should be true
|
||||
xml.include?(@user.profile.first_name).should be true
|
||||
xml.include?(@user.profile.last_name).should be true
|
||||
|
|
|
|||
|
|
@ -25,6 +25,29 @@ describe User do
|
|||
@user = Factory.create(:user)
|
||||
@aspect = @user.aspect(:name => 'heroes')
|
||||
end
|
||||
|
||||
it 'should create with pivotal or allowed emails' do
|
||||
user1 = Factory.create(:user, :email => "kimfuh@yahoo.com")
|
||||
user2 = Factory.create(:user, :email => "awesome@sofaer.net")
|
||||
user3 = Factory.create(:user, :email => "steveellis@pivotallabs.com")
|
||||
user1.created_at.nil?.should be false
|
||||
user2.created_at.nil?.should be false
|
||||
user3.created_at.nil?.should be false
|
||||
end
|
||||
|
||||
it 'should not create with disallowed emails' do
|
||||
proc {
|
||||
user1 = Factory.create(:user, :email => "kimuh@yahoo.com")
|
||||
}.should raise_error /Validation failed/
|
||||
|
||||
proc {
|
||||
user2 = Factory.create(:user, :email => "awesome@sobear.net")
|
||||
}.should raise_error /Validation failed/
|
||||
|
||||
proc {
|
||||
user3 = Factory.create(:user, :email => "steveellis@pivotalabs.com")
|
||||
}.should raise_error /Validation failed/
|
||||
end
|
||||
|
||||
describe 'profiles' do
|
||||
it 'should be able to update their profile and send it to their friends' do
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ RSpec.configure do |config|
|
|||
config.before(:each) do
|
||||
DatabaseCleaner.start
|
||||
stub_sockets
|
||||
User.stub!(:allowed_email?).and_return(:true)
|
||||
end
|
||||
|
||||
config.after(:each) do
|
||||
|
|
|
|||
Loading…
Reference in a new issue