quo_vadis 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/app/mailers/quo_vadis/notifier.rb +7 -2
- data/lib/quo_vadis/version.rb +1 -1
- data/test/integration/activation_test.rb +10 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -161,9 +161,9 @@ Write the mailer view, i.e. the email which will be sent to your new users ([exa
|
|
161
161
|
* be at `app/views/quo_vadis/notifier/invite.text.erb`
|
162
162
|
* render `@url` somewhere (this is the link the user clicks to go to the invitation page)
|
163
163
|
|
164
|
-
You can also refer to `@user` in the email view, as well as any other data you pass to `invite_to_activate`.
|
164
|
+
You can also refer to `@user` in the email view, as well as any other data you pass to `invite_to_activate`. Note that passing `:from` and/or `:subject` in the hash to `invite_to_activate` overrides the default `QuoVadis.from` and/or `QuoVadis.subject_invitation` respectively.
|
165
165
|
|
166
|
-
Configure the email's from address in `config/initializers/quo_vadis.rb
|
166
|
+
Configure the email's from address in `config/initializers/quo_vadis.rb` (or pass in the data hash to `invite_to_activate`).
|
167
167
|
|
168
168
|
Configure the default host so ActionMailer can generate the URL. In `config/environments/<env>.rb`:
|
169
169
|
|
@@ -13,12 +13,17 @@ module QuoVadis
|
|
13
13
|
# can choose their username and password.
|
14
14
|
#
|
15
15
|
# `data` - hash of data to pass to view via instance variables. A key of `:foo`
|
16
|
-
# will be available via `@foo`.
|
16
|
+
# will be available via `@foo`. `:from` and `:subject` are deleted from
|
17
|
+
# the hash and used to override `QuoVadis#from` and `#subject_invitation`.
|
17
18
|
def invite(user, data = {})
|
18
19
|
@user = user
|
19
20
|
@url = invitation_url user.token
|
21
|
+
|
22
|
+
from = data.delete(:from) || QuoVadis.from
|
23
|
+
subject = data.delete(:subject) || QuoVadis.subject_invitation
|
24
|
+
|
20
25
|
data.each { |k,v| instance_variable_set :"@#{k}", v }
|
21
|
-
mail :to => user.email, :from =>
|
26
|
+
mail :to => user.email, :from => from, :subject => subject
|
22
27
|
end
|
23
28
|
|
24
29
|
end
|
data/lib/quo_vadis/version.rb
CHANGED
@@ -95,4 +95,14 @@ class ActivationTest < ActiveSupport::IntegrationCase
|
|
95
95
|
email = ActionMailer::Base.deliveries.last
|
96
96
|
assert_match Regexp.new('Barbaz'), email.encoded
|
97
97
|
end
|
98
|
+
|
99
|
+
test 'data can be passed to invitation email to override :from and :subject' do
|
100
|
+
user = User.new_for_activation :name => 'Bob', :email => 'bob@example.com'
|
101
|
+
assert user.save
|
102
|
+
assert QuoVadis::SessionsController.new.invite_to_activate user,
|
103
|
+
:subject => 'Foo', :from => 'Bar <bar@example.com>'
|
104
|
+
email = ActionMailer::Base.deliveries.last
|
105
|
+
assert_equal ['bar@example.com'], email.from
|
106
|
+
assert_equal 'Foo', email.subject
|
107
|
+
end
|
98
108
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quo_vadis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -237,7 +237,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
237
237
|
version: '0'
|
238
238
|
segments:
|
239
239
|
- 0
|
240
|
-
hash:
|
240
|
+
hash: 2281906662398485868
|
241
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
242
|
none: false
|
243
243
|
requirements:
|
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
246
|
version: '0'
|
247
247
|
segments:
|
248
248
|
- 0
|
249
|
-
hash:
|
249
|
+
hash: 2281906662398485868
|
250
250
|
requirements: []
|
251
251
|
rubyforge_project: quo_vadis
|
252
252
|
rubygems_version: 1.8.23
|