activity_notification 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +33 -0
  3. data/.rubocop.yml +1157 -0
  4. data/.yardopts +3 -0
  5. data/CHANGELOG.md +25 -0
  6. data/Gemfile.lock +15 -17
  7. data/README.md +154 -27
  8. data/activity_notification.gemspec +1 -1
  9. data/app/controllers/activity_notification/notifications_controller.rb +30 -104
  10. data/app/controllers/activity_notification/notifications_with_devise_controller.rb +1 -33
  11. data/app/controllers/activity_notification/subscriptions_controller.rb +184 -0
  12. data/app/controllers/activity_notification/subscriptions_with_devise_controller.rb +6 -0
  13. data/app/mailers/activity_notification/mailer.rb +3 -3
  14. data/app/views/activity_notification/notifications/default/_index.html.erb +3 -0
  15. data/app/views/activity_notification/notifications/default/index.html.erb +8 -10
  16. data/app/views/activity_notification/notifications/default/show.html.erb +24 -2
  17. data/app/views/activity_notification/subscriptions/default/_form.html.erb +52 -0
  18. data/app/views/activity_notification/subscriptions/default/_notification_keys.html.erb +89 -0
  19. data/app/views/activity_notification/subscriptions/default/_subscription.html.erb +73 -0
  20. data/app/views/activity_notification/subscriptions/default/_subscriptions.html.erb +13 -0
  21. data/app/views/activity_notification/subscriptions/default/create.js.erb +5 -0
  22. data/app/views/activity_notification/subscriptions/default/destroy.js.erb +5 -0
  23. data/app/views/activity_notification/subscriptions/default/index.html.erb +197 -0
  24. data/app/views/activity_notification/subscriptions/default/show.html.erb +177 -0
  25. data/app/views/activity_notification/subscriptions/default/subscribe.js.erb +8 -0
  26. data/app/views/activity_notification/subscriptions/default/subscribe_to_email.js.erb +6 -0
  27. data/app/views/activity_notification/subscriptions/default/unsubscribe.js.erb +8 -0
  28. data/app/views/activity_notification/subscriptions/default/unsubscribe_to_email.js.erb +6 -0
  29. data/gemfiles/Gemfile.rails-4.2.lock +18 -20
  30. data/gemfiles/Gemfile.rails-5.0.lock +18 -20
  31. data/lib/activity_notification.rb +7 -3
  32. data/lib/activity_notification/apis/notification_api.rb +95 -61
  33. data/lib/activity_notification/apis/subscription_api.rb +51 -0
  34. data/lib/activity_notification/common.rb +1 -1
  35. data/lib/activity_notification/config.rb +65 -17
  36. data/lib/activity_notification/controllers/common_controller.rb +118 -0
  37. data/lib/activity_notification/controllers/devise_authentication_controller.rb +41 -0
  38. data/lib/activity_notification/helpers/view_helpers.rb +131 -3
  39. data/lib/activity_notification/mailers/helpers.rb +6 -8
  40. data/lib/activity_notification/models/concerns/notifiable.rb +45 -27
  41. data/lib/activity_notification/models/concerns/subscriber.rb +149 -0
  42. data/lib/activity_notification/models/concerns/target.rb +100 -66
  43. data/lib/activity_notification/models/notification.rb +7 -5
  44. data/lib/activity_notification/models/subscription.rb +93 -0
  45. data/lib/activity_notification/rails/routes.rb +148 -33
  46. data/lib/activity_notification/renderable.rb +3 -4
  47. data/lib/activity_notification/roles/acts_as_notifiable.rb +14 -1
  48. data/lib/activity_notification/roles/acts_as_target.rb +11 -8
  49. data/lib/activity_notification/version.rb +1 -1
  50. data/lib/generators/activity_notification/controllers_generator.rb +2 -2
  51. data/lib/generators/activity_notification/install_generator.rb +0 -1
  52. data/lib/generators/activity_notification/migration/migration_generator.rb +8 -2
  53. data/lib/generators/activity_notification/models_generator.rb +53 -0
  54. data/lib/generators/activity_notification/views_generator.rb +7 -7
  55. data/lib/generators/templates/activity_notification.rb +17 -3
  56. data/lib/generators/templates/controllers/notifications_controller.rb +18 -17
  57. data/lib/generators/templates/controllers/notifications_with_devise_controller.rb +18 -17
  58. data/lib/generators/templates/controllers/subscriptions_controller.rb +79 -0
  59. data/lib/generators/templates/controllers/subscriptions_with_devise_controller.rb +87 -0
  60. data/lib/generators/templates/migrations/migration.rb +57 -0
  61. data/lib/generators/templates/models/README +10 -0
  62. data/lib/generators/templates/{notification → models}/notification.rb +1 -3
  63. data/lib/generators/templates/models/subscription.rb +4 -0
  64. data/spec/concerns/apis/notification_api_spec.rb +48 -11
  65. data/spec/concerns/apis/subscription_api_spec.rb +167 -0
  66. data/spec/concerns/models/notifiable_spec.rb +60 -0
  67. data/spec/concerns/models/subscriber_spec.rb +525 -0
  68. data/spec/concerns/models/target_spec.rb +271 -42
  69. data/spec/controllers/common_controller_spec.rb +25 -0
  70. data/spec/controllers/dummy_common_controller.rb +5 -0
  71. data/spec/controllers/notifications_controller_shared_examples.rb +2 -6
  72. data/spec/controllers/subscriptions_controller_shared_examples.rb +735 -0
  73. data/spec/controllers/subscriptions_controller_spec.rb +12 -0
  74. data/spec/controllers/subscriptions_with_devise_controller_spec.rb +91 -0
  75. data/spec/factories/dummy/dummy_subscriber.rb +4 -0
  76. data/spec/factories/subscriptions.rb +8 -0
  77. data/spec/generators/controllers_generator_spec.rb +25 -2
  78. data/spec/generators/migration/migration_generator_spec.rb +3 -3
  79. data/spec/generators/models_generator_spec.rb +96 -0
  80. data/spec/generators/views_generator_spec.rb +84 -0
  81. data/spec/helpers/view_helpers_spec.rb +143 -0
  82. data/spec/mailers/mailer_spec.rb +5 -4
  83. data/spec/models/dummy/dummy_subscriber_spec.rb +5 -0
  84. data/spec/models/notification_spec.rb +7 -7
  85. data/spec/models/subscription_spec.rb +158 -0
  86. data/spec/rails_app/app/controllers/users/notifications_controller.rb +67 -0
  87. data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +75 -0
  88. data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +79 -0
  89. data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +87 -0
  90. data/spec/rails_app/app/models/admin.rb +1 -0
  91. data/spec/rails_app/app/models/dummy/dummy_subscriber.rb +4 -0
  92. data/spec/rails_app/app/models/user.rb +2 -1
  93. data/spec/rails_app/app/views/activity_notification/mailer/dummy_subscribers/test_key.text.erb +1 -0
  94. data/spec/rails_app/app/views/articles/index.html.erb +6 -0
  95. data/spec/rails_app/config/initializers/activity_notification.rb +17 -3
  96. data/spec/rails_app/config/routes.rb +2 -2
  97. data/spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb +33 -0
  98. data/spec/rails_app/db/schema.rb +18 -0
  99. data/spec/roles/acts_as_notifiable_spec.rb +1 -1
  100. data/spec/roles/acts_as_target_spec.rb +1 -1
  101. metadata +70 -11
  102. data/lib/generators/activity_notification/notification/notification_generator.rb +0 -20
  103. data/lib/generators/templates/active_record/migration.rb +0 -18
  104. data/spec/generators/notification/notification_generator_spec.rb +0 -41
  105. data/spec/rails_app/db/migrate/20160715050420_create_notifications.rb +0 -18
@@ -0,0 +1,87 @@
1
+ class Users::SubscriptionsWithDeviseController < ActivityNotification::SubscriptionsWithDeviseController
2
+ # GET /:target_type/:target_id/subscriptions
3
+ # def index
4
+ # super
5
+ # end
6
+
7
+ # POST /:target_type/:target_id/subscriptions
8
+ # def create
9
+ # super
10
+ # end
11
+
12
+ # GET /:target_type/:target_id/subscriptions/:id
13
+ # def show
14
+ # super
15
+ # end
16
+
17
+ # DELETE /:target_type/:target_id/subscriptions/:id
18
+ # def destroy
19
+ # super
20
+ # end
21
+
22
+ # POST /:target_type/:target_id/subscriptions/:id/subscribe
23
+ # def subscribe
24
+ # super
25
+ # end
26
+
27
+ # POST /:target_type/:target_id/subscriptions/:id/unsubscribe
28
+ # def unsubscribe
29
+ # super
30
+ # end
31
+
32
+ # POST /:target_type/:target_id/subscriptions/:id/subscribe_to_email
33
+ # def subscribe_to_email
34
+ # super
35
+ # end
36
+
37
+ # POST /:target_type/:target_id/subscriptions/:id/unsubscribe_to_email
38
+ # def unsubscribe_to_email
39
+ # super
40
+ # end
41
+
42
+ # protected
43
+
44
+ # def set_target
45
+ # super
46
+ # end
47
+
48
+ # def set_subscription
49
+ # super
50
+ # end
51
+
52
+ # def subscription_params
53
+ # super
54
+ # end
55
+
56
+ # def set_index_options
57
+ # super
58
+ # end
59
+
60
+ # def load_subscription_index(options = {})
61
+ # super(options)
62
+ # end
63
+
64
+ # def controller_path
65
+ # super
66
+ # end
67
+
68
+ # def target_view_path
69
+ # super
70
+ # end
71
+
72
+ # def set_view_prefixes
73
+ # super
74
+ # end
75
+
76
+ # def return_back_or_ajax
77
+ # super
78
+ # end
79
+
80
+ # def authenticate_devise_resource!
81
+ # super
82
+ # end
83
+
84
+ # def authenticate_target!
85
+ # super
86
+ # end
87
+ end
@@ -4,6 +4,7 @@ class Admin < ActiveRecord::Base
4
4
 
5
5
  acts_as_notification_target email: :email,
6
6
  email_allowed: ->(admin, key) { admin.user.confirmed_at.present? },
7
+ subscription_allowed: true,
7
8
  devise_resource: :user,
8
9
  printable_name: ->(admin) { "admin (#{admin.user.name})" }
9
10
  end
@@ -0,0 +1,4 @@
1
+ class Dummy::DummySubscriber < ActiveRecord::Base
2
+ self.table_name = :users
3
+ acts_as_target email: 'dummy@example.com', email_allowed: true, batch_email_allowed: true, subscription_allowed: true
4
+ end
@@ -4,7 +4,8 @@ class User < ActiveRecord::Base
4
4
  has_many :articles, dependent: :destroy
5
5
  has_one :admin, dependent: :destroy
6
6
 
7
- acts_as_target email: :email, email_allowed: :confirmed_at, batch_email_allowed: :confirmed_at, printable_name: :name
7
+ acts_as_target email: :email, email_allowed: :confirmed_at, batch_email_allowed: :confirmed_at,
8
+ subscription_allowed: true, printable_name: :name
8
9
  acts_as_notifier printable_name: :name
9
10
 
10
11
  def admin?
@@ -0,0 +1 @@
1
+ Dummy subscriber's notification email template.
@@ -7,6 +7,9 @@
7
7
  <p class="list_description">
8
8
  <span><%= user.name %></span> · <%= user.email %><br>
9
9
  <%= link_to 'Notifications', user_notifications_path(user) %>
10
+ <% if User.subscription_enabled? %>
11
+ <%= link_to 'Subscriptions', user_subscriptions_path(user) %>
12
+ <% end %>
10
13
  </p>
11
14
  </div>
12
15
  </div>
@@ -22,6 +25,9 @@
22
25
  <p class="list_description">
23
26
  <span><%= admin.user.name %></span> · <%= admin.user.email %><br>
24
27
  <%= link_to 'Notifications', admin_notifications_path(admin) %>
28
+ <% if Admin.subscription_enabled? %>
29
+ <%= link_to 'Subscriptions', admin_subscriptions_path(admin) %>
30
+ <% end %>
25
31
  </p>
26
32
  </div>
27
33
  </div>
@@ -5,13 +5,27 @@ ActivityNotification.configure do |config|
5
5
  config.enabled = true
6
6
 
7
7
  # Configure table name to store notification data
8
- config.table_name = "notifications"
8
+ config.notification_table_name = "notifications"
9
9
 
10
- # Configure if email notification is enabled as default
10
+ # Configure table name to store subscription data
11
+ config.subscription_table_name = "subscriptions"
12
+
13
+ # Configure if email notification is enabled as default.
11
14
  # Note that you can configure them for each model by acts_as roles.
12
- # Set true when you want to turn on email notifications as default
15
+ # Set true when you want to turn on email notifications as default.
13
16
  config.email_enabled = false
14
17
 
18
+ # Configure if subscription is managed.
19
+ # Note that this parameter must be true when you want use subscription management.
20
+ # However, you can also configure them for each model by acts_as roles.
21
+ # Set true when you want to turn on subscription management as default.
22
+ config.subscription_enabled = false
23
+
24
+ # Configure default subscription value to use when the subscription record does not configured.
25
+ # Note that you can configure them for each method calling as default argument.
26
+ # Set false when you want to unsubscribe to any notifications as default.
27
+ config.subscribe_as_default = true
28
+
15
29
  # Configure the e-mail address which will be shown in ActivityNotification::Mailer,
16
30
  # note that it will be overwritten if you use your own mailer class with default "from" parameter.
17
31
  config.mailer_sender = 'please-change-me-at-config-initializers-activity_notification@example.com'
@@ -4,6 +4,6 @@ Rails.application.routes.draw do
4
4
  resources :articles
5
5
  resources :comments, only: [:create, :destroy]
6
6
 
7
- notify_to :users
8
- notify_to :admins, with_devise: :users
7
+ notify_to :users, with_subscription: true
8
+ notify_to :admins, with_devise: :users, with_subscription: true
9
9
  end
@@ -0,0 +1,33 @@
1
+ # Migration responsible for creating a table with notifications
2
+ class CreateActivityNotificationTables < ActiveRecord::Migration
3
+ # Create tables
4
+ def change
5
+ create_table :notifications do |t|
6
+ t.belongs_to :target, polymorphic: true, index: true, null: false
7
+ t.belongs_to :notifiable, polymorphic: true, index: true, null: false
8
+ t.string :key, null: false
9
+ t.belongs_to :group, polymorphic: true, index: true
10
+ t.integer :group_owner_id, index: true
11
+ t.belongs_to :notifier, polymorphic: true, index: true
12
+ t.text :parameters
13
+ t.datetime :opened_at
14
+
15
+ t.timestamps
16
+ end
17
+
18
+ create_table :subscriptions do |t|
19
+ t.belongs_to :target, polymorphic: true, index: true, null: false
20
+ t.string :key, index: true, null: false
21
+ t.boolean :subscribing, null: false, default: true
22
+ t.boolean :subscribing_to_email, null: false, default: true
23
+ t.datetime :subscribed_at
24
+ t.datetime :unsubscribed_at
25
+ t.datetime :subscribed_to_email_at
26
+ t.datetime :unsubscribed_to_email_at
27
+ t.text :parameters
28
+
29
+ t.timestamps
30
+ end
31
+ add_index :subscriptions, [:target_type, :target_id, :key], unique: true
32
+ end
33
+ end
@@ -60,6 +60,24 @@ ActiveRecord::Schema.define(version: 20160715050433) do
60
60
  t.index ["target_type", "target_id"], name: "index_notifications_on_target_type_and_target_id"
61
61
  end
62
62
 
63
+ create_table "subscriptions", force: :cascade do |t|
64
+ t.string "target_type", null: false
65
+ t.integer "target_id", null: false
66
+ t.string "key", null: false
67
+ t.boolean "subscribing", default: true, null: false
68
+ t.boolean "subscribing_to_email", default: true, null: false
69
+ t.datetime "subscribed_at"
70
+ t.datetime "unsubscribed_at"
71
+ t.datetime "subscribed_to_email_at"
72
+ t.datetime "unsubscribed_to_email_at"
73
+ t.text "parameters"
74
+ t.datetime "created_at"
75
+ t.datetime "updated_at"
76
+ t.index ["key"], name: "index_subscriptions_on_key"
77
+ t.index ["target_type", "target_id", "key"], name: "index_subscriptions_on_target_type_and_target_id_and_key", unique: true
78
+ t.index ["target_type", "target_id"], name: "index_subscriptions_on_target_type_and_target_id"
79
+ end
80
+
63
81
  create_table "users", force: :cascade do |t|
64
82
  t.string "email", default: "", null: false
65
83
  t.string "encrypted_password", default: "", null: false
@@ -25,7 +25,7 @@ describe ActivityNotification::ActsAsNotifiable do
25
25
  describe ".available_notifiable_options" do
26
26
  it "returns list of available options in acts_as_notifiable" do
27
27
  expect(dummy_model_class.available_notifiable_options)
28
- .to eq([:targets, :group, :notifier, :parameters, :email_allowed, :notifiable_path, :printable_notifiable_name, :printable_name, :dependent_notifications])
28
+ .to eq([:targets, :group, :group_expiry_delay, :notifier, :parameters, :email_allowed, :notifiable_path, :printable_notifiable_name, :printable_name, :dependent_notifications])
29
29
  end
30
30
  end
31
31
  end
@@ -33,7 +33,7 @@ describe ActivityNotification::ActsAsTarget do
33
33
  describe ".available_target_options" do
34
34
  it "returns list of available options in acts_as_target" do
35
35
  expect(dummy_model_class.available_target_options)
36
- .to eq([:email, :email_allowed, :batch_email_allowed, :devise_resource, :printable_notification_target_name, :printable_name])
36
+ .to eq([:email, :email_allowed, :batch_email_allowed, :subscription_allowed, :devise_resource, :printable_notification_target_name, :printable_name])
37
37
  end
38
38
  end
39
39
  end
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.2
4
+ version: 1.1.0
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-14 00:00:00.000000000 Z
11
+ date: 2016-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -106,14 +106,14 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: 4.7.0
109
+ version: 4.8.0
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: 4.7.0
116
+ version: 4.8.0
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: simplecov
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -179,9 +179,11 @@ executables: []
179
179
  extensions: []
180
180
  extra_rdoc_files: []
181
181
  files:
182
+ - ".codeclimate.yml"
182
183
  - ".coveralls.yml"
183
184
  - ".gitignore"
184
185
  - ".rspec"
186
+ - ".rubocop.yml"
185
187
  - ".travis.yml"
186
188
  - ".yardopts"
187
189
  - CHANGELOG.md
@@ -193,6 +195,8 @@ files:
193
195
  - activity_notification.gemspec
194
196
  - app/controllers/activity_notification/notifications_controller.rb
195
197
  - app/controllers/activity_notification/notifications_with_devise_controller.rb
198
+ - app/controllers/activity_notification/subscriptions_controller.rb
199
+ - app/controllers/activity_notification/subscriptions_with_devise_controller.rb
196
200
  - app/mailers/activity_notification/mailer.rb
197
201
  - app/views/activity_notification/mailer/default/batch_default.html.erb
198
202
  - app/views/activity_notification/mailer/default/batch_default.text.erb
@@ -206,14 +210,29 @@ files:
206
210
  - app/views/activity_notification/notifications/default/open.js.erb
207
211
  - app/views/activity_notification/notifications/default/open_all.js.erb
208
212
  - app/views/activity_notification/notifications/default/show.html.erb
213
+ - app/views/activity_notification/subscriptions/default/_form.html.erb
214
+ - app/views/activity_notification/subscriptions/default/_notification_keys.html.erb
215
+ - app/views/activity_notification/subscriptions/default/_subscription.html.erb
216
+ - app/views/activity_notification/subscriptions/default/_subscriptions.html.erb
217
+ - app/views/activity_notification/subscriptions/default/create.js.erb
218
+ - app/views/activity_notification/subscriptions/default/destroy.js.erb
219
+ - app/views/activity_notification/subscriptions/default/index.html.erb
220
+ - app/views/activity_notification/subscriptions/default/show.html.erb
221
+ - app/views/activity_notification/subscriptions/default/subscribe.js.erb
222
+ - app/views/activity_notification/subscriptions/default/subscribe_to_email.js.erb
223
+ - app/views/activity_notification/subscriptions/default/unsubscribe.js.erb
224
+ - app/views/activity_notification/subscriptions/default/unsubscribe_to_email.js.erb
209
225
  - gemfiles/Gemfile.rails-4.2
210
226
  - gemfiles/Gemfile.rails-4.2.lock
211
227
  - gemfiles/Gemfile.rails-5.0
212
228
  - gemfiles/Gemfile.rails-5.0.lock
213
229
  - lib/activity_notification.rb
214
230
  - lib/activity_notification/apis/notification_api.rb
231
+ - lib/activity_notification/apis/subscription_api.rb
215
232
  - lib/activity_notification/common.rb
216
233
  - lib/activity_notification/config.rb
234
+ - lib/activity_notification/controllers/common_controller.rb
235
+ - lib/activity_notification/controllers/devise_authentication_controller.rb
217
236
  - lib/activity_notification/controllers/store_controller.rb
218
237
  - lib/activity_notification/helpers/polymorphic_helpers.rb
219
238
  - lib/activity_notification/helpers/view_helpers.rb
@@ -222,8 +241,10 @@ files:
222
241
  - lib/activity_notification/models/concerns/group.rb
223
242
  - lib/activity_notification/models/concerns/notifiable.rb
224
243
  - lib/activity_notification/models/concerns/notifier.rb
244
+ - lib/activity_notification/models/concerns/subscriber.rb
225
245
  - lib/activity_notification/models/concerns/target.rb
226
246
  - lib/activity_notification/models/notification.rb
247
+ - lib/activity_notification/models/subscription.rb
227
248
  - lib/activity_notification/rails.rb
228
249
  - lib/activity_notification/rails/routes.rb
229
250
  - lib/activity_notification/renderable.rb
@@ -236,40 +257,53 @@ files:
236
257
  - lib/generators/activity_notification/controllers_generator.rb
237
258
  - lib/generators/activity_notification/install_generator.rb
238
259
  - lib/generators/activity_notification/migration/migration_generator.rb
239
- - lib/generators/activity_notification/notification/notification_generator.rb
260
+ - lib/generators/activity_notification/models_generator.rb
240
261
  - lib/generators/activity_notification/views_generator.rb
241
262
  - lib/generators/templates/README
242
- - lib/generators/templates/active_record/migration.rb
243
263
  - lib/generators/templates/activity_notification.rb
244
264
  - lib/generators/templates/controllers/README
245
265
  - lib/generators/templates/controllers/notifications_controller.rb
246
266
  - lib/generators/templates/controllers/notifications_with_devise_controller.rb
267
+ - lib/generators/templates/controllers/subscriptions_controller.rb
268
+ - lib/generators/templates/controllers/subscriptions_with_devise_controller.rb
247
269
  - lib/generators/templates/locales/en.yml
248
- - lib/generators/templates/notification/notification.rb
270
+ - lib/generators/templates/migrations/migration.rb
271
+ - lib/generators/templates/models/README
272
+ - lib/generators/templates/models/notification.rb
273
+ - lib/generators/templates/models/subscription.rb
249
274
  - lib/tasks/activity_notification_tasks.rake
250
275
  - spec/concerns/apis/notification_api_spec.rb
276
+ - spec/concerns/apis/subscription_api_spec.rb
251
277
  - spec/concerns/common_spec.rb
252
278
  - spec/concerns/models/group_spec.rb
253
279
  - spec/concerns/models/notifiable_spec.rb
254
280
  - spec/concerns/models/notifier_spec.rb
281
+ - spec/concerns/models/subscriber_spec.rb
255
282
  - spec/concerns/models/target_spec.rb
256
283
  - spec/concerns/renderable_spec.rb
284
+ - spec/controllers/common_controller_spec.rb
285
+ - spec/controllers/dummy_common_controller.rb
257
286
  - spec/controllers/notifications_controller_shared_examples.rb
258
287
  - spec/controllers/notifications_controller_spec.rb
259
288
  - spec/controllers/notifications_with_devise_controller_spec.rb
289
+ - spec/controllers/subscriptions_controller_shared_examples.rb
290
+ - spec/controllers/subscriptions_controller_spec.rb
291
+ - spec/controllers/subscriptions_with_devise_controller_spec.rb
260
292
  - spec/factories/admins.rb
261
293
  - spec/factories/articles.rb
262
294
  - spec/factories/comments.rb
263
295
  - spec/factories/dummy/dummy_group.rb
264
296
  - spec/factories/dummy/dummy_notifiable.rb
265
297
  - spec/factories/dummy/dummy_notifier.rb
298
+ - spec/factories/dummy/dummy_subscriber.rb
266
299
  - spec/factories/dummy/dummy_target.rb
267
300
  - spec/factories/notifications.rb
301
+ - spec/factories/subscriptions.rb
268
302
  - spec/factories/users.rb
269
303
  - spec/generators/controllers_generator_spec.rb
270
304
  - spec/generators/install_generator_spec.rb
271
305
  - spec/generators/migration/migration_generator_spec.rb
272
- - spec/generators/notification/notification_generator_spec.rb
306
+ - spec/generators/models_generator_spec.rb
273
307
  - spec/generators/views_generator_spec.rb
274
308
  - spec/helpers/polymorphic_helpers_spec.rb
275
309
  - spec/helpers/view_helpers_spec.rb
@@ -277,8 +311,10 @@ files:
277
311
  - spec/models/dummy/dummy_group_spec.rb
278
312
  - spec/models/dummy/dummy_notifiable_spec.rb
279
313
  - spec/models/dummy/dummy_notifier_spec.rb
314
+ - spec/models/dummy/dummy_subscriber_spec.rb
280
315
  - spec/models/dummy/dummy_target_spec.rb
281
316
  - spec/models/notification_spec.rb
317
+ - spec/models/subscription_spec.rb
282
318
  - spec/rails_app/Rakefile
283
319
  - spec/rails_app/app/assets/javascripts/application.js
284
320
  - spec/rails_app/app/assets/stylesheets/application.css
@@ -288,6 +324,10 @@ files:
288
324
  - spec/rails_app/app/controllers/articles_controller.rb
289
325
  - spec/rails_app/app/controllers/comments_controller.rb
290
326
  - spec/rails_app/app/controllers/concerns/.keep
327
+ - spec/rails_app/app/controllers/users/notifications_controller.rb
328
+ - spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb
329
+ - spec/rails_app/app/controllers/users/subscriptions_controller.rb
330
+ - spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb
291
331
  - spec/rails_app/app/helpers/application_helper.rb
292
332
  - spec/rails_app/app/mailers/.keep
293
333
  - spec/rails_app/app/models/.keep
@@ -298,9 +338,11 @@ files:
298
338
  - spec/rails_app/app/models/dummy/dummy_group.rb
299
339
  - spec/rails_app/app/models/dummy/dummy_notifiable.rb
300
340
  - spec/rails_app/app/models/dummy/dummy_notifier.rb
341
+ - spec/rails_app/app/models/dummy/dummy_subscriber.rb
301
342
  - spec/rails_app/app/models/dummy/dummy_target.rb
302
343
  - spec/rails_app/app/models/notification.rb
303
344
  - spec/rails_app/app/models/user.rb
345
+ - spec/rails_app/app/views/activity_notification/mailer/dummy_subscribers/test_key.text.erb
304
346
  - spec/rails_app/app/views/activity_notification/notifications/default/custom/_path_test.html.erb
305
347
  - spec/rails_app/app/views/activity_notification/notifications/default/custom/_test.html.erb
306
348
  - spec/rails_app/app/views/activity_notification/notifications/users/_custom_index.html.erb
@@ -338,7 +380,7 @@ files:
338
380
  - spec/rails_app/config/locales/devise.en.yml
339
381
  - spec/rails_app/config/routes.rb
340
382
  - spec/rails_app/config/secrets.yml
341
- - spec/rails_app/db/migrate/20160715050420_create_notifications.rb
383
+ - spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb
342
384
  - spec/rails_app/db/migrate/20160715050433_create_test_tables.rb
343
385
  - spec/rails_app/db/schema.rb
344
386
  - spec/rails_app/db/seeds.rb
@@ -378,28 +420,37 @@ specification_version: 4
378
420
  summary: Integrated user activity notifications for Ruby on Rails
379
421
  test_files:
380
422
  - spec/concerns/apis/notification_api_spec.rb
423
+ - spec/concerns/apis/subscription_api_spec.rb
381
424
  - spec/concerns/common_spec.rb
382
425
  - spec/concerns/models/group_spec.rb
383
426
  - spec/concerns/models/notifiable_spec.rb
384
427
  - spec/concerns/models/notifier_spec.rb
428
+ - spec/concerns/models/subscriber_spec.rb
385
429
  - spec/concerns/models/target_spec.rb
386
430
  - spec/concerns/renderable_spec.rb
431
+ - spec/controllers/common_controller_spec.rb
432
+ - spec/controllers/dummy_common_controller.rb
387
433
  - spec/controllers/notifications_controller_shared_examples.rb
388
434
  - spec/controllers/notifications_controller_spec.rb
389
435
  - spec/controllers/notifications_with_devise_controller_spec.rb
436
+ - spec/controllers/subscriptions_controller_shared_examples.rb
437
+ - spec/controllers/subscriptions_controller_spec.rb
438
+ - spec/controllers/subscriptions_with_devise_controller_spec.rb
390
439
  - spec/factories/admins.rb
391
440
  - spec/factories/articles.rb
392
441
  - spec/factories/comments.rb
393
442
  - spec/factories/dummy/dummy_group.rb
394
443
  - spec/factories/dummy/dummy_notifiable.rb
395
444
  - spec/factories/dummy/dummy_notifier.rb
445
+ - spec/factories/dummy/dummy_subscriber.rb
396
446
  - spec/factories/dummy/dummy_target.rb
397
447
  - spec/factories/notifications.rb
448
+ - spec/factories/subscriptions.rb
398
449
  - spec/factories/users.rb
399
450
  - spec/generators/controllers_generator_spec.rb
400
451
  - spec/generators/install_generator_spec.rb
401
452
  - spec/generators/migration/migration_generator_spec.rb
402
- - spec/generators/notification/notification_generator_spec.rb
453
+ - spec/generators/models_generator_spec.rb
403
454
  - spec/generators/views_generator_spec.rb
404
455
  - spec/helpers/polymorphic_helpers_spec.rb
405
456
  - spec/helpers/view_helpers_spec.rb
@@ -407,8 +458,10 @@ test_files:
407
458
  - spec/models/dummy/dummy_group_spec.rb
408
459
  - spec/models/dummy/dummy_notifiable_spec.rb
409
460
  - spec/models/dummy/dummy_notifier_spec.rb
461
+ - spec/models/dummy/dummy_subscriber_spec.rb
410
462
  - spec/models/dummy/dummy_target_spec.rb
411
463
  - spec/models/notification_spec.rb
464
+ - spec/models/subscription_spec.rb
412
465
  - spec/rails_app/Rakefile
413
466
  - spec/rails_app/app/assets/javascripts/application.js
414
467
  - spec/rails_app/app/assets/stylesheets/application.css
@@ -418,6 +471,10 @@ test_files:
418
471
  - spec/rails_app/app/controllers/articles_controller.rb
419
472
  - spec/rails_app/app/controllers/comments_controller.rb
420
473
  - spec/rails_app/app/controllers/concerns/.keep
474
+ - spec/rails_app/app/controllers/users/notifications_controller.rb
475
+ - spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb
476
+ - spec/rails_app/app/controllers/users/subscriptions_controller.rb
477
+ - spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb
421
478
  - spec/rails_app/app/helpers/application_helper.rb
422
479
  - spec/rails_app/app/mailers/.keep
423
480
  - spec/rails_app/app/models/.keep
@@ -428,9 +485,11 @@ test_files:
428
485
  - spec/rails_app/app/models/dummy/dummy_group.rb
429
486
  - spec/rails_app/app/models/dummy/dummy_notifiable.rb
430
487
  - spec/rails_app/app/models/dummy/dummy_notifier.rb
488
+ - spec/rails_app/app/models/dummy/dummy_subscriber.rb
431
489
  - spec/rails_app/app/models/dummy/dummy_target.rb
432
490
  - spec/rails_app/app/models/notification.rb
433
491
  - spec/rails_app/app/models/user.rb
492
+ - spec/rails_app/app/views/activity_notification/mailer/dummy_subscribers/test_key.text.erb
434
493
  - spec/rails_app/app/views/activity_notification/notifications/default/custom/_path_test.html.erb
435
494
  - spec/rails_app/app/views/activity_notification/notifications/default/custom/_test.html.erb
436
495
  - spec/rails_app/app/views/activity_notification/notifications/users/_custom_index.html.erb
@@ -468,7 +527,7 @@ test_files:
468
527
  - spec/rails_app/config/locales/devise.en.yml
469
528
  - spec/rails_app/config/routes.rb
470
529
  - spec/rails_app/config/secrets.yml
471
- - spec/rails_app/db/migrate/20160715050420_create_notifications.rb
530
+ - spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb
472
531
  - spec/rails_app/db/migrate/20160715050433_create_test_tables.rb
473
532
  - spec/rails_app/db/schema.rb
474
533
  - spec/rails_app/db/seeds.rb