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.
- checksums.yaml +4 -4
- data/.codeclimate.yml +33 -0
- data/.rubocop.yml +1157 -0
- data/.yardopts +3 -0
- data/CHANGELOG.md +25 -0
- data/Gemfile.lock +15 -17
- data/README.md +154 -27
- data/activity_notification.gemspec +1 -1
- data/app/controllers/activity_notification/notifications_controller.rb +30 -104
- data/app/controllers/activity_notification/notifications_with_devise_controller.rb +1 -33
- data/app/controllers/activity_notification/subscriptions_controller.rb +184 -0
- data/app/controllers/activity_notification/subscriptions_with_devise_controller.rb +6 -0
- data/app/mailers/activity_notification/mailer.rb +3 -3
- data/app/views/activity_notification/notifications/default/_index.html.erb +3 -0
- data/app/views/activity_notification/notifications/default/index.html.erb +8 -10
- data/app/views/activity_notification/notifications/default/show.html.erb +24 -2
- data/app/views/activity_notification/subscriptions/default/_form.html.erb +52 -0
- data/app/views/activity_notification/subscriptions/default/_notification_keys.html.erb +89 -0
- data/app/views/activity_notification/subscriptions/default/_subscription.html.erb +73 -0
- data/app/views/activity_notification/subscriptions/default/_subscriptions.html.erb +13 -0
- data/app/views/activity_notification/subscriptions/default/create.js.erb +5 -0
- data/app/views/activity_notification/subscriptions/default/destroy.js.erb +5 -0
- data/app/views/activity_notification/subscriptions/default/index.html.erb +197 -0
- data/app/views/activity_notification/subscriptions/default/show.html.erb +177 -0
- data/app/views/activity_notification/subscriptions/default/subscribe.js.erb +8 -0
- data/app/views/activity_notification/subscriptions/default/subscribe_to_email.js.erb +6 -0
- data/app/views/activity_notification/subscriptions/default/unsubscribe.js.erb +8 -0
- data/app/views/activity_notification/subscriptions/default/unsubscribe_to_email.js.erb +6 -0
- data/gemfiles/Gemfile.rails-4.2.lock +18 -20
- data/gemfiles/Gemfile.rails-5.0.lock +18 -20
- data/lib/activity_notification.rb +7 -3
- data/lib/activity_notification/apis/notification_api.rb +95 -61
- data/lib/activity_notification/apis/subscription_api.rb +51 -0
- data/lib/activity_notification/common.rb +1 -1
- data/lib/activity_notification/config.rb +65 -17
- data/lib/activity_notification/controllers/common_controller.rb +118 -0
- data/lib/activity_notification/controllers/devise_authentication_controller.rb +41 -0
- data/lib/activity_notification/helpers/view_helpers.rb +131 -3
- data/lib/activity_notification/mailers/helpers.rb +6 -8
- data/lib/activity_notification/models/concerns/notifiable.rb +45 -27
- data/lib/activity_notification/models/concerns/subscriber.rb +149 -0
- data/lib/activity_notification/models/concerns/target.rb +100 -66
- data/lib/activity_notification/models/notification.rb +7 -5
- data/lib/activity_notification/models/subscription.rb +93 -0
- data/lib/activity_notification/rails/routes.rb +148 -33
- data/lib/activity_notification/renderable.rb +3 -4
- data/lib/activity_notification/roles/acts_as_notifiable.rb +14 -1
- data/lib/activity_notification/roles/acts_as_target.rb +11 -8
- data/lib/activity_notification/version.rb +1 -1
- data/lib/generators/activity_notification/controllers_generator.rb +2 -2
- data/lib/generators/activity_notification/install_generator.rb +0 -1
- data/lib/generators/activity_notification/migration/migration_generator.rb +8 -2
- data/lib/generators/activity_notification/models_generator.rb +53 -0
- data/lib/generators/activity_notification/views_generator.rb +7 -7
- data/lib/generators/templates/activity_notification.rb +17 -3
- data/lib/generators/templates/controllers/notifications_controller.rb +18 -17
- data/lib/generators/templates/controllers/notifications_with_devise_controller.rb +18 -17
- data/lib/generators/templates/controllers/subscriptions_controller.rb +79 -0
- data/lib/generators/templates/controllers/subscriptions_with_devise_controller.rb +87 -0
- data/lib/generators/templates/migrations/migration.rb +57 -0
- data/lib/generators/templates/models/README +10 -0
- data/lib/generators/templates/{notification → models}/notification.rb +1 -3
- data/lib/generators/templates/models/subscription.rb +4 -0
- data/spec/concerns/apis/notification_api_spec.rb +48 -11
- data/spec/concerns/apis/subscription_api_spec.rb +167 -0
- data/spec/concerns/models/notifiable_spec.rb +60 -0
- data/spec/concerns/models/subscriber_spec.rb +525 -0
- data/spec/concerns/models/target_spec.rb +271 -42
- data/spec/controllers/common_controller_spec.rb +25 -0
- data/spec/controllers/dummy_common_controller.rb +5 -0
- data/spec/controllers/notifications_controller_shared_examples.rb +2 -6
- data/spec/controllers/subscriptions_controller_shared_examples.rb +735 -0
- data/spec/controllers/subscriptions_controller_spec.rb +12 -0
- data/spec/controllers/subscriptions_with_devise_controller_spec.rb +91 -0
- data/spec/factories/dummy/dummy_subscriber.rb +4 -0
- data/spec/factories/subscriptions.rb +8 -0
- data/spec/generators/controllers_generator_spec.rb +25 -2
- data/spec/generators/migration/migration_generator_spec.rb +3 -3
- data/spec/generators/models_generator_spec.rb +96 -0
- data/spec/generators/views_generator_spec.rb +84 -0
- data/spec/helpers/view_helpers_spec.rb +143 -0
- data/spec/mailers/mailer_spec.rb +5 -4
- data/spec/models/dummy/dummy_subscriber_spec.rb +5 -0
- data/spec/models/notification_spec.rb +7 -7
- data/spec/models/subscription_spec.rb +158 -0
- data/spec/rails_app/app/controllers/users/notifications_controller.rb +67 -0
- data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +75 -0
- data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +79 -0
- data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +87 -0
- data/spec/rails_app/app/models/admin.rb +1 -0
- data/spec/rails_app/app/models/dummy/dummy_subscriber.rb +4 -0
- data/spec/rails_app/app/models/user.rb +2 -1
- data/spec/rails_app/app/views/activity_notification/mailer/dummy_subscribers/test_key.text.erb +1 -0
- data/spec/rails_app/app/views/articles/index.html.erb +6 -0
- data/spec/rails_app/config/initializers/activity_notification.rb +17 -3
- data/spec/rails_app/config/routes.rb +2 -2
- data/spec/rails_app/db/migrate/20160715050420_create_activity_notification_tables.rb +33 -0
- data/spec/rails_app/db/schema.rb +18 -0
- data/spec/roles/acts_as_notifiable_spec.rb +1 -1
- data/spec/roles/acts_as_target_spec.rb +1 -1
- metadata +70 -11
- data/lib/generators/activity_notification/notification/notification_generator.rb +0 -20
- data/lib/generators/templates/active_record/migration.rb +0 -18
- data/spec/generators/notification/notification_generator_spec.rb +0 -41
- data/spec/rails_app/db/migrate/20160715050420_create_notifications.rb +0 -18
data/spec/mailers/mailer_spec.rb
CHANGED
@@ -3,6 +3,7 @@ describe ActivityNotification::Mailer do
|
|
3
3
|
let(:notification) { create(:notification) }
|
4
4
|
let(:test_target) { notification.target }
|
5
5
|
let(:notifications) { [create(:notification, target: test_target), create(:notification, target: test_target)] }
|
6
|
+
let(:batch_key) { 'test_batch_key' }
|
6
7
|
|
7
8
|
before do
|
8
9
|
ActivityNotification::Mailer.deliveries.clear
|
@@ -117,7 +118,7 @@ describe ActivityNotification::Mailer do
|
|
117
118
|
context "with deliver_now" do
|
118
119
|
context "as default" do
|
119
120
|
before do
|
120
|
-
ActivityNotification::Mailer.send_batch_notification_email(test_target, notifications).deliver_now
|
121
|
+
ActivityNotification::Mailer.send_batch_notification_email(test_target, notifications, batch_key).deliver_now
|
121
122
|
end
|
122
123
|
|
123
124
|
it "sends batch notification email now" do
|
@@ -132,7 +133,7 @@ describe ActivityNotification::Mailer do
|
|
132
133
|
|
133
134
|
context "when fallback option is :none and the template is missing" do
|
134
135
|
it "raise ActionView::MissingTemplate" do
|
135
|
-
expect { ActivityNotification::Mailer.send_batch_notification_email(test_target, notifications, fallback: :none).deliver_now }
|
136
|
+
expect { ActivityNotification::Mailer.send_batch_notification_email(test_target, notifications, batch_key, fallback: :none).deliver_now }
|
136
137
|
.to raise_error(ActionView::MissingTemplate)
|
137
138
|
end
|
138
139
|
end
|
@@ -142,7 +143,7 @@ describe ActivityNotification::Mailer do
|
|
142
143
|
it "sends notification email later" do
|
143
144
|
expect {
|
144
145
|
perform_enqueued_jobs do
|
145
|
-
ActivityNotification::Mailer.send_batch_notification_email(test_target, notifications).deliver_later
|
146
|
+
ActivityNotification::Mailer.send_batch_notification_email(test_target, notifications, batch_key).deliver_later
|
146
147
|
end
|
147
148
|
}.to change { ActivityNotification::Mailer.deliveries.size }.by(1)
|
148
149
|
expect(ActivityNotification::Mailer.deliveries.size).to eq(1)
|
@@ -150,7 +151,7 @@ describe ActivityNotification::Mailer do
|
|
150
151
|
|
151
152
|
it "sends notification email with active job queue" do
|
152
153
|
expect {
|
153
|
-
ActivityNotification::Mailer.send_batch_notification_email(test_target, notifications).deliver_later
|
154
|
+
ActivityNotification::Mailer.send_batch_notification_email(test_target, notifications, batch_key).deliver_later
|
154
155
|
}.to change(ActiveJob::Base.queue_adapter.enqueued_jobs, :size).by(1)
|
155
156
|
end
|
156
157
|
end
|
@@ -55,19 +55,19 @@ describe ActivityNotification::Notification, type: :model do
|
|
55
55
|
it "is valid with target, notifiable and key" do
|
56
56
|
expect(@notification).to be_valid
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
it "is invalid with blank target" do
|
60
60
|
@notification.target = nil
|
61
61
|
expect(@notification).to be_invalid
|
62
62
|
expect(@notification.errors[:target].size).to eq(1)
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
it "is invalid with blank notifiable" do
|
66
66
|
@notification.notifiable = nil
|
67
67
|
expect(@notification).to be_invalid
|
68
68
|
expect(@notification.errors[:notifiable].size).to eq(1)
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
it "is invalid with blank key" do
|
72
72
|
@notification.key = nil
|
73
73
|
expect(@notification).to be_invalid
|
@@ -81,8 +81,8 @@ describe ActivityNotification::Notification, type: :model do
|
|
81
81
|
ActivityNotification::Notification.delete_all
|
82
82
|
@unopened_group_owner = create(:notification, group_owner: nil)
|
83
83
|
@unopened_group_member = create(:notification, group_owner: @unopened_group_owner)
|
84
|
-
@opened_group_owner = create(:notification, group_owner: nil, opened_at:
|
85
|
-
@opened_group_member = create(:notification, group_owner: @opened_group_owner, opened_at:
|
84
|
+
@opened_group_owner = create(:notification, group_owner: nil, opened_at: Time.current)
|
85
|
+
@opened_group_member = create(:notification, group_owner: @opened_group_owner, opened_at: Time.current)
|
86
86
|
end
|
87
87
|
|
88
88
|
it "works with group_owners_only scope" do
|
@@ -291,8 +291,8 @@ describe ActivityNotification::Notification, type: :model do
|
|
291
291
|
ActivityNotification::Notification.delete_all
|
292
292
|
unopened_group_owner = create(:notification, group_owner: nil)
|
293
293
|
unopened_group_member = create(:notification, group_owner: unopened_group_owner)
|
294
|
-
opened_group_owner = create(:notification, group_owner: nil, opened_at:
|
295
|
-
opened_group_member = create(:notification, group_owner: opened_group_owner, opened_at:
|
294
|
+
opened_group_owner = create(:notification, group_owner: nil, opened_at: Time.current)
|
295
|
+
opened_group_member = create(:notification, group_owner: opened_group_owner, opened_at: Time.current)
|
296
296
|
@earliest_notification = unopened_group_owner
|
297
297
|
@latest_notification = opened_group_member
|
298
298
|
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
describe ActivityNotification::Subscription, type: :model do
|
2
|
+
|
3
|
+
it_behaves_like :subscription_api
|
4
|
+
|
5
|
+
describe "with association" do
|
6
|
+
it "belongs to target" do
|
7
|
+
target = create(:confirmed_user)
|
8
|
+
subscription = create(:subscription, target: target)
|
9
|
+
expect(subscription.reload.target).to eq(target)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "with validation" do
|
14
|
+
before { @subscription = build(:subscription) }
|
15
|
+
|
16
|
+
it "is valid with target and key" do
|
17
|
+
expect(@subscription).to be_valid
|
18
|
+
end
|
19
|
+
|
20
|
+
it "is invalid with blank target" do
|
21
|
+
@subscription.target = nil
|
22
|
+
expect(@subscription).to be_invalid
|
23
|
+
expect(@subscription.errors[:target].size).to eq(1)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "is invalid with blank key" do
|
27
|
+
@subscription.key = nil
|
28
|
+
expect(@subscription).to be_invalid
|
29
|
+
expect(@subscription.errors[:key].size).to eq(1)
|
30
|
+
end
|
31
|
+
|
32
|
+
#TODO
|
33
|
+
# it "is invalid with non boolean value of subscribing" do
|
34
|
+
# @subscription.subscribing = 'hoge'
|
35
|
+
# expect(@subscription).to be_invalid
|
36
|
+
# expect(@subscription.errors[:subscribing].size).to eq(1)
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# it "is invalid with non boolean value of subscribing_to_email" do
|
40
|
+
# @subscription.subscribing_to_email = 'hoge'
|
41
|
+
# expect(@subscription).to be_invalid
|
42
|
+
# expect(@subscription.errors[:subscribing_to_email].size).to eq(1)
|
43
|
+
# end
|
44
|
+
|
45
|
+
it "is invalid with true as subscribing_to_email and false as subscribing" do
|
46
|
+
@subscription.subscribing = false
|
47
|
+
@subscription.subscribing_to_email = true
|
48
|
+
expect(@subscription).to be_invalid
|
49
|
+
expect(@subscription.errors[:subscribing_to_email].size).to eq(1)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "with scope" do
|
54
|
+
context "to filter by association" do
|
55
|
+
before do
|
56
|
+
ActivityNotification::Subscription.delete_all
|
57
|
+
@target_1, @key_1 = create(:confirmed_user), "key.1"
|
58
|
+
@target_2, @key_2 = create(:confirmed_user), "key.2"
|
59
|
+
@subscription_1 = create(:subscription, target: @target_1, key: @key_1)
|
60
|
+
@subscription_2 = create(:subscription, target: @target_2, key: @key_2)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "works with filtered_by_target scope" do
|
64
|
+
subscriptions = ActivityNotification::Subscription.filtered_by_target(@target_1)
|
65
|
+
expect(subscriptions.size).to eq(1)
|
66
|
+
expect(subscriptions.first).to eq(@subscription_1)
|
67
|
+
subscriptions = ActivityNotification::Subscription.filtered_by_target(@target_2)
|
68
|
+
expect(subscriptions.size).to eq(1)
|
69
|
+
expect(subscriptions.first).to eq(@subscription_2)
|
70
|
+
end
|
71
|
+
|
72
|
+
it "works with filtered_by_key scope" do
|
73
|
+
subscriptions = ActivityNotification::Subscription.filtered_by_key(@key_1)
|
74
|
+
expect(subscriptions.size).to eq(1)
|
75
|
+
expect(subscriptions.first).to eq(@subscription_1)
|
76
|
+
subscriptions = ActivityNotification::Subscription.filtered_by_key(@key_2)
|
77
|
+
expect(subscriptions.size).to eq(1)
|
78
|
+
expect(subscriptions.first).to eq(@subscription_2)
|
79
|
+
end
|
80
|
+
|
81
|
+
describe 'filtered_by_options scope' do
|
82
|
+
context 'with filtered_by_key options' do
|
83
|
+
it "works with filtered_by_options scope" do
|
84
|
+
subscriptions = ActivityNotification::Subscription.filtered_by_options({ filtered_by_key: @key_1 })
|
85
|
+
expect(subscriptions.size).to eq(1)
|
86
|
+
expect(subscriptions.first).to eq(@subscription_1)
|
87
|
+
subscriptions = ActivityNotification::Subscription.filtered_by_options({ filtered_by_key: @key_2 })
|
88
|
+
expect(subscriptions.size).to eq(1)
|
89
|
+
expect(subscriptions.first).to eq(@subscription_2)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'with custom_filter options' do
|
94
|
+
it "works with filtered_by_options scope" do
|
95
|
+
subscriptions = ActivityNotification::Subscription.filtered_by_options({ custom_filter: ["key = ?", @key_1] })
|
96
|
+
expect(subscriptions.size).to eq(1)
|
97
|
+
expect(subscriptions.first).to eq(@subscription_1)
|
98
|
+
subscriptions = ActivityNotification::Subscription.filtered_by_options({ custom_filter: { key: @key_2 } })
|
99
|
+
expect(subscriptions.size).to eq(1)
|
100
|
+
expect(subscriptions.first).to eq(@subscription_2)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context 'with no options' do
|
105
|
+
it "works with filtered_by_options scope" do
|
106
|
+
subscriptions = ActivityNotification::Subscription.filtered_by_options
|
107
|
+
expect(subscriptions.size).to eq(2)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context "to make order by created_at" do
|
114
|
+
before do
|
115
|
+
ActivityNotification::Subscription.delete_all
|
116
|
+
@subscription_1 = create(:subscription, key: 'key.1')
|
117
|
+
@subscription_2 = create(:subscription, key: 'key.2')
|
118
|
+
@subscription_3 = create(:subscription, key: 'key.3')
|
119
|
+
@subscription_4 = create(:subscription, key: 'key.4')
|
120
|
+
end
|
121
|
+
|
122
|
+
it "works with latest_order scope" do
|
123
|
+
subscriptions = ActivityNotification::Subscription.latest_order
|
124
|
+
expect(subscriptions.size).to eq(4)
|
125
|
+
expect(subscriptions.first).to eq(@subscription_4)
|
126
|
+
expect(subscriptions.last).to eq(@subscription_1)
|
127
|
+
end
|
128
|
+
|
129
|
+
it "works with earliest_order scope" do
|
130
|
+
subscriptions = ActivityNotification::Subscription.earliest_order
|
131
|
+
expect(subscriptions.size).to eq(4)
|
132
|
+
expect(subscriptions.first).to eq(@subscription_1)
|
133
|
+
expect(subscriptions.last).to eq(@subscription_4)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "works with latest_subscribed_order scope" do
|
137
|
+
@subscription_2.subscribe
|
138
|
+
subscriptions = ActivityNotification::Subscription.latest_subscribed_order
|
139
|
+
expect(subscriptions.size).to eq(4)
|
140
|
+
expect(subscriptions.first).to eq(@subscription_2)
|
141
|
+
end
|
142
|
+
|
143
|
+
it "works with earliest_subscribed_order scope" do
|
144
|
+
@subscription_3.subscribe
|
145
|
+
subscriptions = ActivityNotification::Subscription.earliest_subscribed_order
|
146
|
+
expect(subscriptions.size).to eq(4)
|
147
|
+
expect(subscriptions.last).to eq(@subscription_3)
|
148
|
+
end
|
149
|
+
|
150
|
+
it "works with key_order scope" do
|
151
|
+
subscriptions = ActivityNotification::Subscription.key_order
|
152
|
+
expect(subscriptions.size).to eq(4)
|
153
|
+
expect(subscriptions.first).to eq(@subscription_1)
|
154
|
+
expect(subscriptions.last).to eq(@subscription_4)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
class Users::NotificationsController < ActivityNotification::NotificationsController
|
2
|
+
# GET /:target_type/:target_id/notifications
|
3
|
+
# def index
|
4
|
+
# super
|
5
|
+
# end
|
6
|
+
|
7
|
+
# POST /:target_type/:target_id/notifications/open_all
|
8
|
+
# def open_all
|
9
|
+
# super
|
10
|
+
# end
|
11
|
+
|
12
|
+
# GET /:target_type/:target_id/notifications/:id
|
13
|
+
# def show
|
14
|
+
# super
|
15
|
+
# end
|
16
|
+
|
17
|
+
# DELETE /:target_type/:target_id/notifications/:id
|
18
|
+
# def destroy
|
19
|
+
# super
|
20
|
+
# end
|
21
|
+
|
22
|
+
# POST /:target_type/:target_id/notifications/:id/open
|
23
|
+
# def open
|
24
|
+
# super
|
25
|
+
# end
|
26
|
+
|
27
|
+
# GET /:target_type/:target_id/notifications/:id/move
|
28
|
+
# def move
|
29
|
+
# super
|
30
|
+
# end
|
31
|
+
|
32
|
+
# No action routing
|
33
|
+
# This method needs to be public since it is called from view helper
|
34
|
+
# def target_view_path
|
35
|
+
# super
|
36
|
+
# end
|
37
|
+
|
38
|
+
# protected
|
39
|
+
|
40
|
+
# def set_target
|
41
|
+
# super
|
42
|
+
# end
|
43
|
+
|
44
|
+
# def set_notification
|
45
|
+
# super
|
46
|
+
# end
|
47
|
+
|
48
|
+
# def set_index_options
|
49
|
+
# super
|
50
|
+
# end
|
51
|
+
|
52
|
+
# def load_notification_index(options = {})
|
53
|
+
# super(options)
|
54
|
+
# end
|
55
|
+
|
56
|
+
# def controller_path
|
57
|
+
# super
|
58
|
+
# end
|
59
|
+
|
60
|
+
# def set_view_prefixes
|
61
|
+
# super
|
62
|
+
# end
|
63
|
+
|
64
|
+
# def return_back_or_ajax
|
65
|
+
# super
|
66
|
+
# end
|
67
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
class Users::NotificationsWithDeviseController < ActivityNotification::NotificationsWithDeviseController
|
2
|
+
# GET /:target_type/:target_id/notifications
|
3
|
+
# def index
|
4
|
+
# super
|
5
|
+
# end
|
6
|
+
|
7
|
+
# POST /:target_type/:target_id/notifications/open_all
|
8
|
+
# def open_all
|
9
|
+
# super
|
10
|
+
# end
|
11
|
+
|
12
|
+
# GET /:target_type/:target_id/notifications/:id
|
13
|
+
# def show
|
14
|
+
# super
|
15
|
+
# end
|
16
|
+
|
17
|
+
# DELETE /:target_type/:target_id/notifications/:id
|
18
|
+
# def destroy
|
19
|
+
# super
|
20
|
+
# end
|
21
|
+
|
22
|
+
# POST /:target_type/:target_id/notifications/:id/open
|
23
|
+
# def open
|
24
|
+
# super
|
25
|
+
# end
|
26
|
+
|
27
|
+
# GET /:target_type/:target_id/notifications/:id/move
|
28
|
+
# def move
|
29
|
+
# super
|
30
|
+
# end
|
31
|
+
|
32
|
+
# No action routing
|
33
|
+
# This method needs to be public since it is called from view helper
|
34
|
+
# def target_view_path
|
35
|
+
# super
|
36
|
+
# end
|
37
|
+
|
38
|
+
# protected
|
39
|
+
|
40
|
+
# def set_target
|
41
|
+
# super
|
42
|
+
# end
|
43
|
+
|
44
|
+
# def set_notification
|
45
|
+
# super
|
46
|
+
# end
|
47
|
+
|
48
|
+
# def set_index_options
|
49
|
+
# super
|
50
|
+
# end
|
51
|
+
|
52
|
+
# def load_notification_index(options = {})
|
53
|
+
# super(options)
|
54
|
+
# end
|
55
|
+
|
56
|
+
# def controller_path
|
57
|
+
# super
|
58
|
+
# end
|
59
|
+
|
60
|
+
# def set_view_prefixes
|
61
|
+
# super
|
62
|
+
# end
|
63
|
+
|
64
|
+
# def return_back_or_ajax
|
65
|
+
# super
|
66
|
+
# end
|
67
|
+
|
68
|
+
# def authenticate_devise_resource!
|
69
|
+
# super
|
70
|
+
# end
|
71
|
+
|
72
|
+
# def authenticate_target!
|
73
|
+
# super
|
74
|
+
# end
|
75
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
class Users::SubscriptionsController < ActivityNotification::SubscriptionsController
|
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
|
+
end
|