activity_notification 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +75 -0
- data/Gemfile.lock +1 -1
- data/README.md +26 -4
- data/app/mailers/activity_notification/mailer.rb +4 -4
- data/gemfiles/Gemfile.rails-4.2.lock +3 -3
- data/gemfiles/Gemfile.rails-5.0.lock +4 -4
- data/lib/activity_notification/version.rb +1 -1
- data/lib/generators/activity_notification/{active_record → migration}/migration_generator.rb +0 -0
- data/lib/generators/activity_notification/{models → notification}/notification_generator.rb +0 -0
- data/spec/generators/{active_record → migration}/migration_generator_spec.rb +1 -1
- data/spec/generators/{models → notification}/notification_generator_spec.rb +1 -1
- data/spec/rails_app/app/models/notification.rb +6 -0
- metadata +11 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bdfeb236b9f987b0c7c7cc6aa515349245c1102
|
4
|
+
data.tar.gz: cf9f3952dcd6d7ff380d8c5ac7ab043dbde361e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfe83748a25c77b316798ac7bf0f939f8fc6e11543ecb48c155fbd2cba4d4044bbe01edc0337f6f186c7f50c707e72d60e3b890744872d81d030cff49b553c51
|
7
|
+
data.tar.gz: 42503e4939f33dc2dc2d45cbefd2895c284f695a640100451e588222f8679ea85318793fc16e909ff62727774ae14dbd7fdad0da35bc646c29f18d4541734a6d
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
## 1.0.2 / 2016-11-14
|
2
|
+
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v1.0.1...v1.0.2)
|
3
|
+
|
4
|
+
Bug Fixes:
|
5
|
+
|
6
|
+
* Fix migration and notification generator's path
|
7
|
+
|
8
|
+
## 1.0.1 / 2016-11-05
|
9
|
+
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v1.0.0...v1.0.1)
|
10
|
+
|
11
|
+
Enhancements:
|
12
|
+
|
13
|
+
* Add function to send batch email notification
|
14
|
+
* Batch mailer API
|
15
|
+
* Default batch notification email templates
|
16
|
+
* Target role configuration for batch email notification
|
17
|
+
* Improve target API
|
18
|
+
* Add `:reverse`, `:with_group_members`, `:as_latest_group_member` and `:custom_filter` options to API loading notification index
|
19
|
+
* Add methods to get notifications for specified target type grouped by targets like `notification_index_map`
|
20
|
+
* Arrange default notification email view templates
|
21
|
+
|
22
|
+
## 1.0.0 / 2016-10-06
|
23
|
+
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v0.0.10...v1.0.0)
|
24
|
+
|
25
|
+
Enhancements:
|
26
|
+
|
27
|
+
* Improve notification API
|
28
|
+
* Add methods to count distinct group members or notifiers like `group_member_notifier_count`
|
29
|
+
* Update `send_later` argument of `send_notification_email` method to options hash argument
|
30
|
+
* Improve target API
|
31
|
+
* Update `notification_index` API to automatically load opened notifications with unopend notifications
|
32
|
+
* Improve acts_as roles
|
33
|
+
* Add `acts_as_group` role
|
34
|
+
* Add `printable_name` configuration for all roles
|
35
|
+
* Add `:dependent_notifications` option to `acts_as_notifiable` to make handle notifications with deleted notifiables
|
36
|
+
* Arrange default notification view templates
|
37
|
+
* Arrange bundled test application
|
38
|
+
* Make default rails version 5.0 and update gem dependency
|
39
|
+
|
40
|
+
Breaking Changes:
|
41
|
+
* Rename `opened_limit` configuration parameter to `opened_index_limit`
|
42
|
+
* http://github.com/simukappu/activity_notification/commit/591e53cd8977220f819c11cd702503fc72dd1fd1
|
43
|
+
|
44
|
+
## 0.0.10 / 2016-09-11
|
45
|
+
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v0.0.9...v0.0.10)
|
46
|
+
|
47
|
+
Enhancements:
|
48
|
+
|
49
|
+
* Improve controller action and notification API
|
50
|
+
* Add filter options to `open_all` action and `open_all_of` method
|
51
|
+
* Add source documentation with YARD
|
52
|
+
* Support rails 5.0 and update gem dependency
|
53
|
+
|
54
|
+
Bug Fixes:
|
55
|
+
|
56
|
+
* Fix `Notification#notifiable_path` method to be called with key
|
57
|
+
* Add including `PolymorphicHelpers` statement to `seed.rb` in test application to resolve String extention
|
58
|
+
|
59
|
+
## 0.0.9 / 2016-08-19
|
60
|
+
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v0.0.8...v0.0.9)
|
61
|
+
|
62
|
+
Enhancements:
|
63
|
+
|
64
|
+
* Improve acts_as roles
|
65
|
+
* Enable models to be configured by acts_as role without including statement
|
66
|
+
* Disable email notification as default and add email configurations to acts_as roles
|
67
|
+
* Remove `:skip_email` option from `acts_as_target`
|
68
|
+
* Update `Renderable#text` method to use `#{key}.text` field in i18n properties
|
69
|
+
|
70
|
+
Bug Fixes:
|
71
|
+
|
72
|
+
* Fix wrong method name of `Notification#notifiable_path`
|
73
|
+
|
74
|
+
## 0.0.8 / 2016-07-31
|
75
|
+
* First release
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -57,8 +57,9 @@
|
|
57
57
|
2. [Email templates](#email-templates)
|
58
58
|
3. [i18n for email](#i18n-for-email)
|
59
59
|
2. [Batch email notification](#batch-email-notification)
|
60
|
-
1. [
|
61
|
-
2. [
|
60
|
+
1. [Setup mailer](#setup-mailer)
|
61
|
+
2. [Batch email templates](#batch-email-templates)
|
62
|
+
3. [i18n for batch email](#i18n-for-batch-email)
|
62
63
|
3. [Grouping notifications](#grouping-notifications)
|
63
64
|
4. [Integration with Devise](#integration-with-devise)
|
64
65
|
4. [Testing](#testing)
|
@@ -462,9 +463,30 @@ notification:
|
|
462
463
|
|
463
464
|
### Batch email notification
|
464
465
|
|
465
|
-
`activity_notification` provides batch email notification to the notification targets. You can send notification daily or
|
466
|
+
`activity_notification` provides batch email notification to the notification targets. You can send notification email daily, hourly or weekly and so on with a scheduler like `whenever`.
|
467
|
+
|
468
|
+
#### Setup mailer
|
469
|
+
|
470
|
+
First, you need to set up the default URL options for the `activity_notification` mailer in each environment.
|
471
|
+
|
472
|
+
Batch email notification is disabled as default. You can configure to enable email notification in initializer `activity_notification.rb` like single email notification.
|
473
|
+
|
474
|
+
```ruby
|
475
|
+
config.email_enabled = true
|
476
|
+
config.mailer_sender = 'your_notification_sender@example.com'
|
477
|
+
```
|
478
|
+
|
479
|
+
You can also configure them for each target model by `acts_as_notification_target` role like this.
|
480
|
+
|
481
|
+
```ruby
|
482
|
+
class User < ActiveRecord::Base
|
483
|
+
# Example using confirmed_at of devise field
|
484
|
+
# to decide whether activity_notification sends batch notification email to this user
|
485
|
+
acts_as_notification_target email: :email, batch_email_allowed: :confirmed_at
|
486
|
+
end
|
487
|
+
```
|
466
488
|
|
467
|
-
|
489
|
+
Then, you can automatically send batch notification email for unopened notifications only to the all specified targets with `batch_key`.
|
468
490
|
|
469
491
|
```ruby
|
470
492
|
# Send batch notification email to the users with unopened notifications
|
@@ -8,7 +8,7 @@ if defined?(ActionMailer)
|
|
8
8
|
# @param [Notification] notification Notification instance to send email
|
9
9
|
# @param [Hash] options Options for notification email
|
10
10
|
# @option options [String, Symbol] :fallback (:default) Fallback template to use when MissingTemplate is raised
|
11
|
-
# @return [Mail::Message|ActionMailer::DeliveryJob] Email message or its delivery job
|
11
|
+
# @return [Mail::Message|ActionMailer::DeliveryJob] Email message or its delivery job
|
12
12
|
def send_notification_email(notification, options = {})
|
13
13
|
options[:fallback] ||= :default
|
14
14
|
if options[:fallback] == :none
|
@@ -22,9 +22,9 @@ if defined?(ActionMailer)
|
|
22
22
|
# @param [Object] target Target of batch notification email
|
23
23
|
# @param [Array<Notification>] notifications Target notifications to send batch notification email
|
24
24
|
# @param [Hash] options Options for notification email
|
25
|
-
# @option options [String, Symbol] :fallback
|
26
|
-
# @option options [String] :batch_key
|
27
|
-
# @return [Mail::Message|ActionMailer::DeliveryJob] Email message or its delivery job
|
25
|
+
# @option options [String, Symbol] :fallback (:batch_default) Fallback template to use when MissingTemplate is raised
|
26
|
+
# @option options [String] :batch_key (nil) Key of the batch notification email, a key of the first notification will be used if not specified
|
27
|
+
# @return [Mail::Message|ActionMailer::DeliveryJob] Email message or its delivery job
|
28
28
|
def send_batch_notification_email(target, notifications, options = {})
|
29
29
|
options[:fallback] ||= :batch_default
|
30
30
|
if options[:fallback] == :none
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
activity_notification (1.0.
|
4
|
+
activity_notification (1.0.2)
|
5
5
|
activerecord (>= 4.2.0)
|
6
6
|
i18n (>= 0.5.0)
|
7
7
|
jquery-rails (>= 3.1.1)
|
@@ -154,7 +154,7 @@ GEM
|
|
154
154
|
actionpack (>= 4.0)
|
155
155
|
activesupport (>= 4.0)
|
156
156
|
sprockets (>= 3.0.0)
|
157
|
-
sqlite3 (1.3.
|
157
|
+
sqlite3 (1.3.12)
|
158
158
|
term-ansicolor (1.3.2)
|
159
159
|
tins (~> 1.0)
|
160
160
|
thor (0.19.1)
|
@@ -181,7 +181,7 @@ DEPENDENCIES
|
|
181
181
|
rails (~> 4.2.0)
|
182
182
|
rspec-rails (~> 3.5.1)
|
183
183
|
simplecov (~> 0.12.0)
|
184
|
-
sqlite3 (~> 1.3.
|
184
|
+
sqlite3 (~> 1.3.12)
|
185
185
|
timecop
|
186
186
|
yard (~> 0.9.5)
|
187
187
|
yard-activesupport-concern (~> 0.0.1)
|
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
activity_notification (
|
4
|
+
activity_notification (1.0.2)
|
5
5
|
activerecord (>= 4.2.0)
|
6
6
|
i18n (>= 0.5.0)
|
7
|
+
jquery-rails (>= 3.1.1)
|
7
8
|
railties (>= 4.2.0, < 5.1)
|
8
9
|
|
9
10
|
GEM
|
@@ -160,7 +161,7 @@ GEM
|
|
160
161
|
actionpack (>= 4.0)
|
161
162
|
activesupport (>= 4.0)
|
162
163
|
sprockets (>= 3.0.0)
|
163
|
-
sqlite3 (1.3.
|
164
|
+
sqlite3 (1.3.12)
|
164
165
|
term-ansicolor (1.3.2)
|
165
166
|
tins (~> 1.0)
|
166
167
|
thor (0.19.1)
|
@@ -187,12 +188,11 @@ DEPENDENCIES
|
|
187
188
|
coveralls
|
188
189
|
devise (~> 4.2.0)
|
189
190
|
factory_girl_rails (~> 4.7.0)
|
190
|
-
jquery-rails
|
191
191
|
rails (~> 5.0.0)
|
192
192
|
rails-controller-testing
|
193
193
|
rspec-rails (~> 3.5.1)
|
194
194
|
simplecov (~> 0.12.0)
|
195
|
-
sqlite3
|
195
|
+
sqlite3 (~> 1.3.12)
|
196
196
|
timecop
|
197
197
|
yard (~> 0.9.5)
|
198
198
|
yard-activesupport-concern (~> 0.0.1)
|
data/lib/generators/activity_notification/{active_record → migration}/migration_generator.rb
RENAMED
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activity_notification
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shota Yamazaki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- ".rspec"
|
185
185
|
- ".travis.yml"
|
186
186
|
- ".yardopts"
|
187
|
+
- CHANGELOG.md
|
187
188
|
- Gemfile
|
188
189
|
- Gemfile.lock
|
189
190
|
- MIT-LICENSE
|
@@ -232,10 +233,10 @@ files:
|
|
232
233
|
- lib/activity_notification/roles/acts_as_notifier.rb
|
233
234
|
- lib/activity_notification/roles/acts_as_target.rb
|
234
235
|
- lib/activity_notification/version.rb
|
235
|
-
- lib/generators/activity_notification/active_record/migration_generator.rb
|
236
236
|
- lib/generators/activity_notification/controllers_generator.rb
|
237
237
|
- lib/generators/activity_notification/install_generator.rb
|
238
|
-
- lib/generators/activity_notification/
|
238
|
+
- lib/generators/activity_notification/migration/migration_generator.rb
|
239
|
+
- lib/generators/activity_notification/notification/notification_generator.rb
|
239
240
|
- lib/generators/activity_notification/views_generator.rb
|
240
241
|
- lib/generators/templates/README
|
241
242
|
- lib/generators/templates/active_record/migration.rb
|
@@ -265,10 +266,10 @@ files:
|
|
265
266
|
- spec/factories/dummy/dummy_target.rb
|
266
267
|
- spec/factories/notifications.rb
|
267
268
|
- spec/factories/users.rb
|
268
|
-
- spec/generators/active_record/migration_generator_spec.rb
|
269
269
|
- spec/generators/controllers_generator_spec.rb
|
270
270
|
- spec/generators/install_generator_spec.rb
|
271
|
-
- spec/generators/
|
271
|
+
- spec/generators/migration/migration_generator_spec.rb
|
272
|
+
- spec/generators/notification/notification_generator_spec.rb
|
272
273
|
- spec/generators/views_generator_spec.rb
|
273
274
|
- spec/helpers/polymorphic_helpers_spec.rb
|
274
275
|
- spec/helpers/view_helpers_spec.rb
|
@@ -298,6 +299,7 @@ files:
|
|
298
299
|
- spec/rails_app/app/models/dummy/dummy_notifiable.rb
|
299
300
|
- spec/rails_app/app/models/dummy/dummy_notifier.rb
|
300
301
|
- spec/rails_app/app/models/dummy/dummy_target.rb
|
302
|
+
- spec/rails_app/app/models/notification.rb
|
301
303
|
- spec/rails_app/app/models/user.rb
|
302
304
|
- spec/rails_app/app/views/activity_notification/notifications/default/custom/_path_test.html.erb
|
303
305
|
- spec/rails_app/app/views/activity_notification/notifications/default/custom/_test.html.erb
|
@@ -394,10 +396,10 @@ test_files:
|
|
394
396
|
- spec/factories/dummy/dummy_target.rb
|
395
397
|
- spec/factories/notifications.rb
|
396
398
|
- spec/factories/users.rb
|
397
|
-
- spec/generators/active_record/migration_generator_spec.rb
|
398
399
|
- spec/generators/controllers_generator_spec.rb
|
399
400
|
- spec/generators/install_generator_spec.rb
|
400
|
-
- spec/generators/
|
401
|
+
- spec/generators/migration/migration_generator_spec.rb
|
402
|
+
- spec/generators/notification/notification_generator_spec.rb
|
401
403
|
- spec/generators/views_generator_spec.rb
|
402
404
|
- spec/helpers/polymorphic_helpers_spec.rb
|
403
405
|
- spec/helpers/view_helpers_spec.rb
|
@@ -427,6 +429,7 @@ test_files:
|
|
427
429
|
- spec/rails_app/app/models/dummy/dummy_notifiable.rb
|
428
430
|
- spec/rails_app/app/models/dummy/dummy_notifier.rb
|
429
431
|
- spec/rails_app/app/models/dummy/dummy_target.rb
|
432
|
+
- spec/rails_app/app/models/notification.rb
|
430
433
|
- spec/rails_app/app/models/user.rb
|
431
434
|
- spec/rails_app/app/views/activity_notification/notifications/default/custom/_path_test.html.erb
|
432
435
|
- spec/rails_app/app/views/activity_notification/notifications/default/custom/_test.html.erb
|