Commit 6242ac64 authored by zhitomirskiyi's avatar zhitomirskiyi

removed unique index on email to a regular index in order to make inviting...

removed unique index on email to a regular index in order to make inviting users through fb work (no email present)
parent be57170b
......@@ -11,8 +11,8 @@ gem 'nokogiri', '1.4.3.1'
gem "fog"
#Security
gem 'devise', '1.2.rc'
gem 'devise_invitable', :git => 'git://github.com/zhitomirskiyi/devise_invitable.git'
gem 'devise', '1.1.3'
gem 'devise_invitable', :git => 'git://github.com/zhitomirskiyi/devise_invitable.git', :branch => '0.3.5'
#Authentication
gem 'omniauth', '0.1.6'
......
......@@ -46,11 +46,11 @@ GIT
GIT
remote: git://github.com/zhitomirskiyi/devise_invitable.git
revision: 5f74da32a81a2332bac266316dab333a4eed9525
revision: 85abb5fef4ab4f74db818ed3d8104c2f7d24b94e
branch: 0.3.5
specs:
devise_invitable (0.4.rc)
devise (~> 1.2.rc)
rails (~> 3.0.0)
devise_invitable (0.3.5)
devise (~> 1.1.0)
PATH
remote: vendor/gems/jasmine
......@@ -145,10 +145,9 @@ GEM
culerity (0.2.15)
daemons (1.1.0)
database_cleaner (0.6.0)
devise (1.2.rc)
devise (1.1.3)
bcrypt-ruby (~> 2.1.2)
orm_adapter (~> 0.0.2)
warden (~> 1.0.2)
warden (~> 0.10.7)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
......@@ -264,7 +263,6 @@ GEM
oa-enterprise (= 0.1.6)
oa-oauth (= 0.1.6)
oa-openid (= 0.1.6)
orm_adapter (0.0.4)
polyglot (0.3.1)
pyu-ruby-sasl (0.0.3.2)
rack (1.2.1)
......@@ -351,7 +349,7 @@ GEM
uuidtools (2.1.1)
vegas (0.1.8)
rack (>= 1.0.0)
warden (1.0.3)
warden (0.10.7)
rack (>= 1.0.0)
webmock (1.6.2)
addressable (>= 2.2.2)
......@@ -374,7 +372,7 @@ DEPENDENCIES
cloudfiles (= 1.4.10)
cucumber-rails (= 0.3.2)
database_cleaner (= 0.6.0)
devise (= 1.2.rc)
devise (= 1.1.3)
devise_invitable!
em-websocket!
factory_girl_rails
......
......@@ -71,8 +71,6 @@ class Invitation < ActiveRecord::Base
opts[:from].save!
invitee.reload
end
pp opts[:service]
pp opts[:service] == 'email'
invitee.invite!(:email => (opts[:service] == 'email'))
Rails.logger.info("event=invitation_sent to=#{opts[:identifier]} #{"inviter=#{opts[:from].diaspora_handle}" if opts[:from]}")
invitee
......
class RemoveUniqueIndexOnEmailOnUsers < ActiveRecord::Migration
def self.up
remove_index :users, :email
add_index :users, :email
end
def self.down
remove_index :users, :email
add_index :users, :email, :unique => true
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20110126015407) do
ActiveRecord::Schema.define(:version => 20110126225202) do
create_table "aspect_memberships", :force => true do |t|
t.integer "aspect_id"
......@@ -273,7 +273,8 @@ ActiveRecord::Schema.define(:version => 20110126015407) do
t.string "language"
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "invitation_token", :limit => 60
t.string "password_salt", :default => "", :null => false
t.string "invitation_token", :limit => 20
t.datetime "invitation_sent_at"
t.string "reset_password_token"
t.string "remember_token"
......@@ -433,7 +434,8 @@ ActiveRecord::Schema.define(:version => 20110126015407) do
t.string "language"
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "invitation_token", :limit => 60
t.string "password_salt", :default => "", :null => false
t.string "invitation_token", :limit => 20
t.datetime "invitation_sent_at"
t.string "reset_password_token"
t.string "remember_token"
......@@ -450,7 +452,7 @@ ActiveRecord::Schema.define(:version => 20110126015407) do
t.string "invitation_identifier"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
add_index "users", ["email"], :name => "index_users_on_email"
add_index "users", ["invitation_token"], :name => "index_users_on_invitation_token"
add_index "users", ["mongo_id"], :name => "index_users_on_mongo_id"
add_index "users", ["username"], :name => "index_users_on_username", :unique => true
......
......@@ -239,7 +239,6 @@ describe Invitation do
it 'mails the optional message' do
new_user = Invitation.create_invitee(@valid_params)
pp Devise.mailer.deliveries
Devise.mailer.deliveries.first.to_s.include?(@message).should be_true
end
......@@ -257,7 +256,11 @@ describe Invitation do
it 'does not save a user with an empty string email' do
@valid_params[:service] = 'facebook'
@valid_params[:identifier] = '3423423'
Invitation.create_invitee(@valid_params).email.should_not == ''
Invitation.create_invitee(@valid_params)
@valid_params[:identifier] = 'dfadsfdas'
lambda {
Invitation.create_invitee(@valid_params)
}.should_not raise_error
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment