activity_notification 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1233ff17443dc741c5c016057dc8c8f86e9c8ae0
4
- data.tar.gz: e5a4f6930f8ecdd5789a49e082a8ac570bfb43a8
3
+ metadata.gz: f2a8ddee8ebe99622eaabfc2827b1163625f5eaa
4
+ data.tar.gz: d55b69c877f4cf2d04ad1fc3397314b71da72333
5
5
  SHA512:
6
- metadata.gz: 99c10ba18583a79dff88da3b12ab4e491f96d1906b9ebf448e31ec3d0e3139abf20d46bef8994b112b0794c20c072f02013f3ebfaa5804c266c59fd8368f6df3
7
- data.tar.gz: 7f885776939b37d430638fb7a6b84937b7c86dfbcae5c2060e84b5f36b98b557c5497c823567d9f220f052e04d9e82c4450fa6c444129c13c7f5a2636476b659
6
+ metadata.gz: 795e3e038b7e329b567018afc4b9ae2eb4d98fcb4283500092267fb6bbbdf34a5abf1f66823ed5677bd840856c519fa6e3b1b1bf9e41e2dd2d2dea1abbe478f2
7
+ data.tar.gz: 7f6d257a66540873366c4122632beceee21126598467c82243cd526953ea3050d4a054b9ba11f8c833c2c117f65d3400cef65af4b6b9831e717018cbc328120e
data/CHANGELOG.md CHANGED
@@ -1,9 +1,20 @@
1
+ ## 1.4.2 / 2017-07-22
2
+ [Full Changelog](http://github.com/simukappu/activity_notification/compare/v1.4.1...v1.4.2)
3
+
4
+ Enhancements:
5
+
6
+ * Add function to override the subject of notification email
7
+
8
+ Bug Fixes:
9
+
10
+ * Fix a bug which ActivityNotificaion.config.mailer configuration was ignored
11
+
1
12
  ## 1.4.1 / 2017-05-17
2
13
  [Full Changelog](http://github.com/simukappu/activity_notification/compare/v1.4.0...v1.4.1)
3
14
 
4
15
  Enhancements:
5
16
 
6
- * Remove dependency on *activerecord* from gem runtime dependency
17
+ * Remove dependency on *activerecord* from gemspec
7
18
 
8
19
  ## 1.4.0 / 2017-05-10
9
20
  [Full Changelog](http://github.com/simukappu/activity_notification/compare/v1.3.0...v1.4.0)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activity_notification (1.4.1)
4
+ activity_notification (1.4.2)
5
5
  i18n (>= 0.5.0)
6
6
  jquery-rails (>= 3.1.1)
7
7
  railties (>= 4.2.0, < 5.2)
@@ -9,39 +9,39 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (5.1.1)
13
- actionpack (= 5.1.1)
12
+ actioncable (5.1.2)
13
+ actionpack (= 5.1.2)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (~> 0.6.1)
16
- actionmailer (5.1.1)
17
- actionpack (= 5.1.1)
18
- actionview (= 5.1.1)
19
- activejob (= 5.1.1)
16
+ actionmailer (5.1.2)
17
+ actionpack (= 5.1.2)
18
+ actionview (= 5.1.2)
19
+ activejob (= 5.1.2)
20
20
  mail (~> 2.5, >= 2.5.4)
21
21
  rails-dom-testing (~> 2.0)
22
- actionpack (5.1.1)
23
- actionview (= 5.1.1)
24
- activesupport (= 5.1.1)
22
+ actionpack (5.1.2)
23
+ actionview (= 5.1.2)
24
+ activesupport (= 5.1.2)
25
25
  rack (~> 2.0)
26
26
  rack-test (~> 0.6.3)
27
27
  rails-dom-testing (~> 2.0)
28
28
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.1.1)
30
- activesupport (= 5.1.1)
29
+ actionview (5.1.2)
30
+ activesupport (= 5.1.2)
31
31
  builder (~> 3.1)
32
32
  erubi (~> 1.4)
33
33
  rails-dom-testing (~> 2.0)
34
34
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (5.1.1)
36
- activesupport (= 5.1.1)
35
+ activejob (5.1.2)
36
+ activesupport (= 5.1.2)
37
37
  globalid (>= 0.3.6)
38
- activemodel (5.1.1)
39
- activesupport (= 5.1.1)
40
- activerecord (5.1.1)
41
- activemodel (= 5.1.1)
42
- activesupport (= 5.1.1)
38
+ activemodel (5.1.2)
39
+ activesupport (= 5.1.2)
40
+ activerecord (5.1.2)
41
+ activemodel (= 5.1.2)
42
+ activesupport (= 5.1.2)
43
43
  arel (~> 8.0)
44
- activesupport (5.1.1)
44
+ activesupport (5.1.2)
45
45
  concurrent-ruby (~> 1.0, >= 1.0.2)
46
46
  i18n (~> 0.7)
47
47
  minitest (~> 5.1)
@@ -51,18 +51,18 @@ GEM
51
51
  railties (>= 3.0)
52
52
  rspec-rails (>= 2.2)
53
53
  arel (8.0.0)
54
- aws-sdk (2.9.19)
55
- aws-sdk-resources (= 2.9.19)
56
- aws-sdk-core (2.9.19)
54
+ aws-sdk (2.10.15)
55
+ aws-sdk-resources (= 2.10.15)
56
+ aws-sdk-core (2.10.15)
57
57
  aws-sigv4 (~> 1.0)
58
58
  jmespath (~> 1.0)
59
- aws-sdk-resources (2.9.19)
60
- aws-sdk-core (= 2.9.19)
61
- aws-sigv4 (1.0.0)
59
+ aws-sdk-resources (2.10.15)
60
+ aws-sdk-core (= 2.10.15)
61
+ aws-sigv4 (1.0.1)
62
62
  bcrypt (3.1.11)
63
- bson (4.2.1)
63
+ bson (4.2.2)
64
64
  builder (3.2.3)
65
- bullet (5.5.1)
65
+ bullet (5.6.0)
66
66
  activesupport (>= 3.0.0)
67
67
  uniform_notifier (~> 1.10.0)
68
68
  concurrent-ruby (1.0.5)
@@ -84,7 +84,7 @@ GEM
84
84
  dotenv-rails (2.2.1)
85
85
  dotenv (= 2.2.1)
86
86
  railties (>= 3.2, < 5.2)
87
- erubi (1.6.0)
87
+ erubi (1.6.1)
88
88
  factory_girl (4.8.0)
89
89
  activesupport (>= 3.0.0)
90
90
  factory_girl_rails (4.8.0)
@@ -92,7 +92,7 @@ GEM
92
92
  railties (>= 3.0.0)
93
93
  globalid (0.4.0)
94
94
  activesupport (>= 4.2.0)
95
- i18n (0.8.1)
95
+ i18n (0.8.6)
96
96
  jmespath (1.3.1)
97
97
  jquery-rails (4.3.1)
98
98
  rails-dom-testing (>= 1, < 3)
@@ -101,39 +101,39 @@ GEM
101
101
  json (2.1.0)
102
102
  loofah (2.0.3)
103
103
  nokogiri (>= 1.5.9)
104
- mail (2.6.5)
104
+ mail (2.6.6)
105
105
  mime-types (>= 1.16, < 4)
106
106
  method_source (0.8.2)
107
107
  mime-types (3.1)
108
108
  mime-types-data (~> 3.2015)
109
109
  mime-types-data (3.2016.0521)
110
- mini_portile2 (2.1.0)
111
- minitest (5.10.2)
112
- mongo (2.4.1)
110
+ mini_portile2 (2.2.0)
111
+ minitest (5.10.3)
112
+ mongo (2.4.2)
113
113
  bson (>= 4.2.1, < 5.0.0)
114
- mongoid (6.1.0)
115
- activemodel (~> 5.0)
114
+ mongoid (6.2.0)
115
+ activemodel (~> 5.1)
116
116
  mongo (>= 2.4.1, < 3.0.0)
117
- mysql2 (0.4.6)
118
- nio4r (2.0.0)
119
- nokogiri (1.7.2)
120
- mini_portile2 (~> 2.1.0)
117
+ mysql2 (0.4.8)
118
+ nio4r (2.1.0)
119
+ nokogiri (1.8.0)
120
+ mini_portile2 (~> 2.2.0)
121
121
  orm_adapter (0.5.0)
122
- pg (0.20.0)
122
+ pg (0.21.0)
123
123
  rack (2.0.3)
124
124
  rack-test (0.6.3)
125
125
  rack (>= 1.0)
126
- rails (5.1.1)
127
- actioncable (= 5.1.1)
128
- actionmailer (= 5.1.1)
129
- actionpack (= 5.1.1)
130
- actionview (= 5.1.1)
131
- activejob (= 5.1.1)
132
- activemodel (= 5.1.1)
133
- activerecord (= 5.1.1)
134
- activesupport (= 5.1.1)
126
+ rails (5.1.2)
127
+ actioncable (= 5.1.2)
128
+ actionmailer (= 5.1.2)
129
+ actionpack (= 5.1.2)
130
+ actionview (= 5.1.2)
131
+ activejob (= 5.1.2)
132
+ activemodel (= 5.1.2)
133
+ activerecord (= 5.1.2)
134
+ activesupport (= 5.1.2)
135
135
  bundler (>= 1.3.0, < 2.0)
136
- railties (= 5.1.1)
136
+ railties (= 5.1.2)
137
137
  sprockets-rails (>= 2.0.0)
138
138
  rails-controller-testing (1.0.2)
139
139
  actionpack (~> 5.x, >= 5.0.1)
@@ -144,9 +144,9 @@ GEM
144
144
  nokogiri (>= 1.6)
145
145
  rails-html-sanitizer (1.0.3)
146
146
  loofah (~> 2.0)
147
- railties (5.1.1)
148
- actionpack (= 5.1.1)
149
- activesupport (= 5.1.1)
147
+ railties (5.1.2)
148
+ actionpack (= 5.1.2)
149
+ activesupport (= 5.1.2)
150
150
  method_source
151
151
  rake (>= 0.8.7)
152
152
  thor (>= 0.18.1, < 2.0)
@@ -175,8 +175,8 @@ GEM
175
175
  docile (~> 1.1.0)
176
176
  json (>= 1.8, < 3)
177
177
  simplecov-html (~> 0.10.0)
178
- simplecov-html (0.10.0)
179
- slack-notifier (2.1.0)
178
+ simplecov-html (0.10.1)
179
+ slack-notifier (2.2.2)
180
180
  sprockets (3.7.1)
181
181
  concurrent-ruby (~> 1.0)
182
182
  rack (> 1, < 3)
@@ -189,8 +189,8 @@ GEM
189
189
  tins (~> 1.0)
190
190
  thor (0.19.4)
191
191
  thread_safe (0.3.6)
192
- timecop (0.8.1)
193
- tins (1.14.0)
192
+ timecop (0.9.1)
193
+ tins (1.15.0)
194
194
  tzinfo (1.2.3)
195
195
  thread_safe (~> 0.1)
196
196
  uniform_notifier (1.10.0)
@@ -216,8 +216,8 @@ DEPENDENCIES
216
216
  dotenv-rails
217
217
  factory_girl_rails (~> 4.8.0)
218
218
  mongoid (>= 4.0.0)
219
- mysql2 (~> 0.4.6)
220
- pg (~> 0.20.0)
219
+ mysql2 (~> 0.4.8)
220
+ pg (~> 0.21.0)
221
221
  rails (~> 5.1)
222
222
  rails-controller-testing
223
223
  rspec-rails (~> 3.6.0)
data/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  *activity_notification* provides integrated user activity notifications for Ruby on Rails. You can easily use it to configure multiple notification targets and make activity notifications with notifiable models, like adding comments, responding etc.
12
12
 
13
- *activity_notification* supports Rails 4.2+ with ActiveRecord and [Mongoid](http://mongoid.org) ORM. It is tested for MySQL, PostgreSQL, SQLite with ActiveRecord and MongoDB with Mongoid.
13
+ *activity_notification* supports Rails 4.2+ with ActiveRecord and [Mongoid](http://mongoid.org) ORM. It is tested for MySQL, PostgreSQL, SQLite3 with ActiveRecord and MongoDB with Mongoid.
14
14
 
15
15
 
16
16
  ## About
@@ -49,11 +49,12 @@
49
49
  - [Setup](#setup)
50
50
  - [Gem installation](#gem-installation)
51
51
  - [Database setup](#database-setup)
52
- - [Using ActiveRecord ORM](#using_activerecord_orm)
53
- - [Using Mongoid ORM](#using_mongoid_orm)
52
+ - [Using ActiveRecord ORM](#using-activerecord-orm)
53
+ - [Using Mongoid ORM](#using-mongoid-orm)
54
54
  - [Configuring models](#configuring-models)
55
- - [Configuring target model](#configuring-target-model)
56
- - [Configuring notifiable model](#configuring-notifiable-model)
55
+ - [Configuring target models](#configuring-target-models)
56
+ - [Configuring notifiable models](#configuring-notifiable-models)
57
+ - [Advanced notifiable path](#advanced-notifiable-path)
57
58
  - [Configuring views](#configuring-views)
58
59
  - [Configuring routes](#configuring-routes)
59
60
  - [Creating notifications](#creating-notifications)
@@ -64,7 +65,7 @@
64
65
  - [Rendering notifications](#rendering-notifications)
65
66
  - [Notification views](#notification-views)
66
67
  - [i18n for notifications](#i18n-for-notifications)
67
- - [Customizing controllers (optional)](#customizing-controllers-optional-)
68
+ - [Customizing controllers (optional)](#customizing-controllers-optional)
68
69
  - [Functions](#functions)
69
70
  - [Email notification](#email-notification)
70
71
  - [Mailer setup](#mailer-setup)
@@ -91,6 +92,9 @@
91
92
  - [Testing gem alone](#testing-gem-alone)
92
93
  - [Documentation](#documentation)
93
94
  - **[Common examples](#common-examples)**
95
+ - [Help](#help)
96
+ - [Contributing](#contributing)
97
+ - [License](#license)
94
98
 
95
99
 
96
100
  ## Setup
@@ -129,6 +133,19 @@ $ bin/rails generate activity_notification:migration
129
133
  $ bin/rake db:migrate
130
134
  ```
131
135
 
136
+ If you are using a different table name from *"notifications"*, change the settings in your *config/initializers/activity_notification.rb* file, e.g., if you're using the table name *"activity_notifications"* instead of the default *"notifications"*:
137
+
138
+ ```ruby
139
+ config.notification_table_name = "activity_notifications"
140
+ ```
141
+
142
+ The same can be done for the subscription table name, e.g., if you're using the table name *"notifications_subscriptions"* instead of the default *"subscriptions"*:
143
+
144
+ ```ruby
145
+ config.subscription_table_name = "notifications_subscriptions"
146
+ ```
147
+
148
+
132
149
  #### Using Mongoid ORM
133
150
 
134
151
  When you use *activity_notification* with [Mongoid](http://mongoid.org) ORM, set **AN_ORM** environment variable to **mongoid**:
@@ -147,12 +164,12 @@ You need to configure Mongoid in your Rails application for your MongoDB environ
147
164
 
148
165
  ### Configuring models
149
166
 
150
- #### Configuring target model
167
+ #### Configuring target models
151
168
 
152
169
  Configure your target model (e.g. *app/models/user.rb*).
153
170
  Add **acts_as_target** configuration to your target model to get notifications.
154
171
 
155
- ##### Target as ActiveRecord model
172
+ ##### Target as an ActiveRecord model
156
173
 
157
174
  ```ruby
158
175
  class User < ActiveRecord::Base
@@ -163,7 +180,7 @@ class User < ActiveRecord::Base
163
180
  end
164
181
  ```
165
182
 
166
- ##### Target as Mongoid model
183
+ ##### Target as a Mongoid model
167
184
 
168
185
  ```ruby
169
186
  require 'mongoid'
@@ -172,7 +189,7 @@ class User
172
189
  include Mongoid::Timestamps
173
190
  include GlobalID::Identification
174
191
 
175
- # You need include ActivityNotification::Models except models which extends ActiveRecord::Base
192
+ # You need include ActivityNotification::Models except models which extend ActiveRecord::Base
176
193
  include ActivityNotification::Models
177
194
  acts_as_target
178
195
  end
@@ -180,13 +197,13 @@ end
180
197
 
181
198
  *Note*: *acts_as_notification_target* is an alias for *acts_as_target* and does the same.
182
199
 
183
- #### Configuring notifiable model
200
+ #### Configuring notifiable models
184
201
 
185
202
  Configure your notifiable model (e.g. *app/models/comment.rb*).
186
203
  Add **acts_as_notifiable** configuration to your notifiable model representing activity to notify for each of your target model.
187
204
  You have to define notification targets for all notifications from this notifiable model by *:targets* option. Other configurations are options. *:notifiable_path* option is a path to move when the notification is opened by the target user.
188
205
 
189
- ##### Notifiable as ActiveRecord model
206
+ ##### Notifiable as an ActiveRecord model
190
207
 
191
208
  ```ruby
192
209
  class Article < ActiveRecord::Base
@@ -218,7 +235,7 @@ class Comment < ActiveRecord::Base
218
235
  end
219
236
  ```
220
237
 
221
- ##### Notifiable as Mongoid model
238
+ ##### Notifiable as a Mongoid model
222
239
 
223
240
  ```ruby
224
241
  require 'mongoid'
@@ -240,7 +257,7 @@ class Comment
240
257
  include Mongoid::Timestamps
241
258
  include GlobalID::Identification
242
259
 
243
- # You need include ActivityNotification::Models except models which extends ActiveRecord::Base
260
+ # You need include ActivityNotification::Models except models which extend ActiveRecord::Base
244
261
  include ActivityNotification::Models
245
262
  acts_as_notifiable :users,
246
263
  targets: ->(comment, key) {
@@ -254,6 +271,20 @@ class Comment
254
271
  end
255
272
  ```
256
273
 
274
+ ###### Advanced notifiable path
275
+
276
+ Sometimes it might be necessary to provide extra information in the *notifiable_path*. In those cases, passing a lambda function to the *notifiable_path* will give you the notifiable object and the notifiable key to play around with:
277
+
278
+ ```ruby
279
+ acts_as_notifiable :users,
280
+ targets: ->(comment, key) {
281
+ ([comment.article.user] + comment.article.commented_users.to_a - [comment.user]).uniq
282
+ },
283
+  notifiable_path: ->(comment, key) { "#{comment.article_notifiable_path}##{key}" }
284
+ ```
285
+
286
+ This will attach the key of the notification to the notifiable path.
287
+
257
288
  ### Configuring views
258
289
 
259
290
  *activity_notification* provides view templates to customize your notification views. The view generator can generate default views for all targets.
@@ -746,13 +777,17 @@ class User < ActiveRecord::Base
746
777
  end
747
778
  ```
748
779
 
749
- If you do not have subscriptions table in you database, create migration for subscriptions and migrate the database in your Rails project:
780
+ If you do not have a subscriptions table in you database, create a migration for subscriptions and migrate the database in your Rails project:
750
781
 
751
782
  ```console
752
783
  $ bin/rails generate activity_notification:migration CreateSubscriptions -t subscriptions
753
784
  $ bin/rake db:migrate
754
785
  ```
786
+ If you are using a different table name than the default "subscriptions", change the settings in your config/initializers/activity_notification.rb file, e.g, if you use the table name "notifications_subscription" instead:
755
787
 
788
+ ```
789
+ config.subscription_table_name = "notifications_subscriptions"
790
+ ```
756
791
 
757
792
  #### Managing subscriptions
758
793
 
@@ -1171,7 +1206,15 @@ To be prepared. See dummy Rails application in *spec/rails_app*.
1171
1206
 
1172
1207
  ## Help
1173
1208
 
1174
- Contact us by email of this repository.
1209
+ We are welcome your Github issues for gem problems or enhancement requests. If you have any questions or problems for your own application environment, contact us by email of this repository.
1210
+
1211
+
1212
+ ## Contributing
1213
+
1214
+ We are welcome all of your pull requests! Please check out the followings:
1215
+ * Write tests with RSpec
1216
+ * Write code docs and README if necessary
1217
+ * Send your pull request to *development* branch (Do NOT send to *master* branch)
1175
1218
 
1176
1219
 
1177
1220
  ## License
@@ -25,8 +25,8 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency 'jquery-rails', '>= 3.1.1'
26
26
 
27
27
  s.add_development_dependency 'sqlite3', '~> 1.3.13'
28
- s.add_development_dependency 'mysql2', '~> 0.4.6'
29
- s.add_development_dependency 'pg', '~> 0.20.0'
28
+ s.add_development_dependency 'mysql2', '~> 0.4.8'
29
+ s.add_development_dependency 'pg', '~> 0.21.0'
30
30
  s.add_development_dependency 'mongoid', '>= 4.0.0'
31
31
  s.add_development_dependency 'rspec-rails', '~> 3.6.0'
32
32
  s.add_development_dependency 'factory_girl_rails', '~> 4.8.0'
@@ -1,6 +1,6 @@
1
1
  module ActivityNotification
2
2
  # Controller to manage notifications with Devise authentication.
3
3
  class NotificationsWithDeviseController < NotificationsController
4
- include DeviceAuthenticationController
4
+ include DeviseAuthenticationController
5
5
  end
6
6
  end