From a46ff394b12304988a697999b68b52c1db7a245c Mon Sep 17 00:00:00 2001 From: Raphael Sofaer <raphael@joindiaspora.com> Date: Thu, 12 May 2011 14:46:19 -0700 Subject: [PATCH] update devise_invitable and devise --- Gemfile | 4 +-- Gemfile.lock | 25 ++++++++----------- app/models/invitation.rb | 3 ++- ...haml => invitation_instructions.html.haml} | 0 config/locales/devise/devise.en.yml | 2 +- spec/models/invitation_spec.rb | 4 +-- 6 files changed, 18 insertions(+), 20 deletions(-) rename app/views/devise/mailer/{invitation.html.haml => invitation_instructions.html.haml} (100%) diff --git a/Gemfile b/Gemfile index a92a25eca5..cb6d11592f 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,8 @@ gem 'ohai', '0.5.8', :require => false #Chef dependency gem 'nokogiri', '1.4.3.1' #Security -gem 'devise', '1.1.3' -gem 'devise_invitable', :git => 'git://github.com/zhitomirskiyi/devise_invitable.git', :branch => '0.3.5' +gem 'devise', '1.3.1' +gem 'devise_invitable', '0.5.0' #Authentication gem 'omniauth', '0.1.6' diff --git a/Gemfile.lock b/Gemfile.lock index be193e65b1..1312cdc570 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,14 +50,6 @@ GIT multi_xml (~> 0.2.0) simple_oauth (~> 0.1.2) -GIT - remote: git://github.com/zhitomirskiyi/devise_invitable.git - revision: 85abb5fef4ab4f74db818ed3d8104c2f7d24b94e - branch: 0.3.5 - specs: - devise_invitable (0.3.5) - devise (~> 1.1.0) - PATH remote: vendor/gems/jasmine specs: @@ -166,9 +158,13 @@ GEM culerity (0.2.15) daemons (1.1.2) database_cleaner (0.6.0) - devise (1.1.3) + devise (1.3.1) bcrypt-ruby (~> 2.1.2) - warden (~> 0.10.7) + orm_adapter (~> 0.0.3) + warden (~> 1.0.3) + devise_invitable (0.5.0) + devise (~> 1.3.1) + rails (>= 3.0.0, <= 3.2) diff-lcs (1.1.2) erubis (2.6.6) abstract (>= 1.0.0) @@ -301,6 +297,7 @@ GEM oa-oauth (= 0.1.6) oa-openid (= 0.1.6) open4 (1.0.1) + orm_adapter (0.0.5) polyglot (0.3.1) pyu-ruby-sasl (0.0.3.2) rack (1.2.2) @@ -391,8 +388,8 @@ GEM uuidtools (2.1.2) vegas (0.1.8) rack (>= 1.0.0) - warden (0.10.7) - rack (>= 1.0.0) + warden (1.0.4) + rack (>= 1.0) webmock (1.6.2) addressable (>= 2.2.2) crack (>= 0.1.7) @@ -418,8 +415,8 @@ DEPENDENCIES cloudfiles (= 1.4.10) cucumber-rails (= 0.3.2) database_cleaner (= 0.6.0) - devise (= 1.1.3) - devise_invitable! + devise (= 1.3.1) + devise_invitable (= 0.5.0) em-websocket! excon (= 0.2.4) factory_girl_rails diff --git a/app/models/invitation.rb b/app/models/invitation.rb index 0463bc08b9..0ac394dba5 100644 --- a/app/models/invitation.rb +++ b/app/models/invitation.rb @@ -74,7 +74,8 @@ class Invitation < ActiveRecord::Base opts[:from].save! invitee.reload end - invitee.invite!(:email => (opts[:service] == 'email')) + invitee.skip_invitation = (opts[:service] != 'email') + invitee.invite! log_string = "event=invitation_sent to=#{opts[:identifier]} service=#{opts[:service]} " log_string << "inviter=#{opts[:from].diaspora_handle} inviter_uid=#{opts[:from].id} inviter_created_at_unix=#{opts[:from].created_at.to_i}" if opts[:from] Rails.logger.info(log_string) diff --git a/app/views/devise/mailer/invitation.html.haml b/app/views/devise/mailer/invitation_instructions.html.haml similarity index 100% rename from app/views/devise/mailer/invitation.html.haml rename to app/views/devise/mailer/invitation_instructions.html.haml diff --git a/config/locales/devise/devise.en.yml b/config/locales/devise/devise.en.yml index 4af4062336..c3c86413b6 100644 --- a/config/locales/devise/devise.en.yml +++ b/config/locales/devise/devise.en.yml @@ -72,7 +72,7 @@ en: account_locked: "Your account has been locked due to an excessive amount of unsuccessful sign in attempts." click_to_unlock: "Click the link below to unlock your account:" unlock: "Unlock my account" - invitation: + invitation_instructions: subject: "You've been invited to join Diaspora!" accept: "Accept invitation" ignore: "If you don't want to accept the invitation, please ignore this email." diff --git a/spec/models/invitation_spec.rb b/spec/models/invitation_spec.rb index 004fd66125..93a412b146 100644 --- a/spec/models/invitation_spec.rb +++ b/spec/models/invitation_spec.rb @@ -225,10 +225,10 @@ describe Invitation do }.should_not change { @invitee.reload.serialized_private_key } end - it "changes the invitation token" do + it "does not change the invitation token" do old_token = @invitee.invitation_token Invitation.create_invitee(@valid_params) - @invitee.reload.invitation_token.should_not == old_token + @invitee.reload.invitation_token.should == old_token end end context 'with an inviter' do -- GitLab