activity_notification 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +6 -16
- data/CHANGELOG.md +52 -0
- data/Gemfile +2 -3
- data/README.md +2 -2
- data/activity_notification.gemspec +1 -1
- data/app/channels/activity_notification/notification_api_with_devise_channel.rb +1 -1
- data/app/channels/activity_notification/notification_channel.rb +1 -1
- data/app/channels/activity_notification/notification_with_devise_channel.rb +1 -1
- data/app/controllers/activity_notification/notifications_api_with_devise_controller.rb +1 -1
- data/app/controllers/activity_notification/notifications_controller.rb +0 -20
- data/app/controllers/activity_notification/subscriptions_api_controller.rb +1 -1
- data/app/controllers/activity_notification/subscriptions_api_with_devise_controller.rb +1 -1
- data/bin/bundle_update.sh +0 -1
- data/docs/Functions.md +3 -3
- data/docs/Setup.md +190 -63
- data/gemfiles/Gemfile.rails-5.0 +3 -1
- data/gemfiles/Gemfile.rails-5.1 +3 -1
- data/gemfiles/Gemfile.rails-5.2 +3 -1
- data/gemfiles/Gemfile.rails-6.0 +2 -3
- data/lib/activity_notification.rb +1 -0
- data/lib/activity_notification/apis/notification_api.rb +8 -1
- data/lib/activity_notification/common.rb +15 -4
- data/lib/activity_notification/controllers/common_controller.rb +2 -18
- data/lib/activity_notification/controllers/concerns/swagger/notifications_parameters.rb +2 -2
- data/lib/activity_notification/models/concerns/notifiable.rb +12 -12
- data/lib/activity_notification/models/concerns/swagger/notification_schema.rb +34 -34
- data/lib/activity_notification/models/concerns/swagger/subscription_schema.rb +17 -17
- data/lib/activity_notification/models/concerns/target.rb +5 -9
- data/lib/activity_notification/optional_targets/action_cable_api_channel.rb +1 -1
- data/lib/activity_notification/optional_targets/action_cable_channel.rb +1 -1
- data/lib/activity_notification/orm/active_record.rb +1 -1
- data/lib/activity_notification/orm/active_record/notification.rb +3 -3
- data/lib/activity_notification/orm/dynamoid.rb +10 -3
- data/lib/activity_notification/orm/dynamoid/notification.rb +49 -14
- data/lib/activity_notification/orm/dynamoid/subscription.rb +1 -1
- data/lib/activity_notification/orm/mongoid.rb +10 -3
- data/lib/activity_notification/orm/mongoid/notification.rb +8 -6
- data/lib/activity_notification/orm/mongoid/subscription.rb +1 -1
- data/lib/activity_notification/renderable.rb +2 -2
- data/lib/activity_notification/roles/acts_as_notifiable.rb +13 -16
- data/lib/activity_notification/version.rb +1 -1
- data/lib/generators/templates/migrations/migration.rb +1 -1
- data/spec/channels/notification_api_channel_spec.rb +42 -44
- data/spec/channels/notification_api_with_devise_channel_spec.rb +57 -59
- data/spec/channels/notification_channel_spec.rb +41 -43
- data/spec/channels/notification_with_devise_channel_spec.rb +75 -77
- data/spec/concerns/apis/notification_api_spec.rb +1 -1
- data/spec/concerns/common_spec.rb +25 -3
- data/spec/concerns/models/notifiable_spec.rb +35 -35
- data/spec/concerns/models/target_spec.rb +10 -12
- data/spec/concerns/renderable_spec.rb +5 -5
- data/spec/config_spec.rb +26 -15
- data/spec/controllers/controller_spec_utility.rb +15 -51
- data/spec/generators/migration/migration_generator_spec.rb +2 -10
- data/spec/helpers/view_helpers_spec.rb +1 -1
- data/spec/models/subscription_spec.rb +8 -0
- data/spec/optional_targets/action_cable_api_channel_spec.rb +21 -24
- data/spec/optional_targets/action_cable_channel_spec.rb +26 -29
- data/spec/rails_app/app/controllers/users_controller.rb +5 -0
- data/spec/rails_app/app/javascript/App.vue +8 -72
- data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +3 -4
- data/spec/rails_app/app/javascript/components/Top.vue +2 -3
- data/spec/rails_app/app/javascript/packs/spa.js +6 -3
- data/spec/rails_app/app/javascript/router/index.js +73 -0
- data/spec/rails_app/app/javascript/store/{auth.js → index.js} +0 -0
- data/spec/rails_app/app/models/dummy/dummy_group.rb +8 -0
- data/spec/rails_app/app/models/dummy/dummy_notifiable_target.rb +8 -0
- data/spec/rails_app/app/models/user.rb +2 -1
- data/spec/rails_app/config/application.rb +6 -7
- data/spec/rails_app/config/dynamoid.rb +11 -3
- data/spec/rails_app/config/environments/production.rb +3 -0
- data/spec/rails_app/config/environments/test.rb +2 -11
- data/spec/rails_app/config/initializers/activity_notification.rb +3 -3
- data/spec/rails_app/config/initializers/copy_it.aws.rb.template +6 -0
- data/spec/rails_app/config/routes.rb +5 -1
- data/spec/rails_app/db/seeds.rb +9 -2
- data/spec/roles/acts_as_notifiable_spec.rb +5 -5
- data/spec/spec_helper.rb +1 -5
- metadata +11 -10
- data/gemfiles/Gemfile.rails-4.2 +0 -23
- data/spec/support/patch_rails_42_action_controller_test_response.rb +0 -11
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
|
|
20
20
|
<script>
|
|
21
21
|
import axios from 'axios'
|
|
22
|
-
import authStore from "../store/auth"
|
|
23
22
|
|
|
24
23
|
export default {
|
|
25
24
|
name: 'DeviseTokenAuth',
|
|
@@ -53,7 +52,7 @@ export default {
|
|
|
53
52
|
authHeaders[authHeader] = response.headers[authHeader];
|
|
54
53
|
axios.defaults.headers.common[authHeader] = authHeaders[authHeader];
|
|
55
54
|
}
|
|
56
|
-
|
|
55
|
+
this.$store.commit('signIn', { user: response.data.data, authHeaders: authHeaders });
|
|
57
56
|
if (this.$route.query.redirect) {
|
|
58
57
|
this.$router.push(this.$route.query.redirect);
|
|
59
58
|
} else {
|
|
@@ -69,10 +68,10 @@ export default {
|
|
|
69
68
|
})
|
|
70
69
|
},
|
|
71
70
|
logout () {
|
|
72
|
-
for (var authHeader of Object.keys(
|
|
71
|
+
for (var authHeader of Object.keys(this.$store.getters.authHeaders)) {
|
|
73
72
|
delete axios.defaults.headers.common[authHeader];
|
|
74
73
|
}
|
|
75
|
-
|
|
74
|
+
this.$store.commit('signOut');
|
|
76
75
|
this.$router.push('/');
|
|
77
76
|
}
|
|
78
77
|
}
|
|
@@ -70,14 +70,13 @@
|
|
|
70
70
|
|
|
71
71
|
<script>
|
|
72
72
|
import axios from 'axios'
|
|
73
|
-
import authStore from "../store/auth"
|
|
74
73
|
|
|
75
74
|
export default {
|
|
76
75
|
name: 'Top',
|
|
77
76
|
data () {
|
|
78
77
|
return {
|
|
79
|
-
userSignedIn:
|
|
80
|
-
currentUser:
|
|
78
|
+
userSignedIn: this.$store.getters.userSignedIn,
|
|
79
|
+
currentUser: this.$store.getters.currentUser,
|
|
81
80
|
users: [],
|
|
82
81
|
admins: []
|
|
83
82
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import Vue from 'vue'
|
|
2
|
-
import axios from 'axios'
|
|
3
2
|
import App from '../App.vue'
|
|
3
|
+
import router from '../router'
|
|
4
|
+
import store from '../store'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Vue.config.productionTip = false
|
|
6
7
|
|
|
7
8
|
document.addEventListener('DOMContentLoaded', () => {
|
|
8
|
-
|
|
9
|
+
new Vue({
|
|
10
|
+
router,
|
|
11
|
+
store,
|
|
9
12
|
render: h => h(App)
|
|
10
13
|
}).$mount('#spa')
|
|
11
14
|
})
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import VueRouter from 'vue-router'
|
|
3
|
+
import store from '../store'
|
|
4
|
+
import DeviseTokenAuth from '../components/DeviseTokenAuth.vue'
|
|
5
|
+
import Top from '../components/Top.vue'
|
|
6
|
+
import NotificationsIndex from '../components/notifications/Index.vue'
|
|
7
|
+
import SubscriptionsIndex from '../components/subscriptions/Index.vue'
|
|
8
|
+
|
|
9
|
+
Vue.use(VueRouter)
|
|
10
|
+
|
|
11
|
+
const routes = [
|
|
12
|
+
// Routes for common components
|
|
13
|
+
{ path: '/', component: Top },
|
|
14
|
+
{ path: '/login', component: DeviseTokenAuth },
|
|
15
|
+
{ path: '/logout', component: DeviseTokenAuth, props: { isLogout: true } },
|
|
16
|
+
// Routes for single page application working with activity_notification REST API backend for users
|
|
17
|
+
{
|
|
18
|
+
path: '/notifications',
|
|
19
|
+
name: 'AuthenticatedUserNotificationsIndex',
|
|
20
|
+
component: NotificationsIndex,
|
|
21
|
+
props: () => ({ target_type: 'users', target: store.getters.currentUser }),
|
|
22
|
+
meta: { requiresAuth: true }
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
path: '/subscriptions',
|
|
26
|
+
name: 'AuthenticatedUserSubscriptionsIndex',
|
|
27
|
+
component: SubscriptionsIndex,
|
|
28
|
+
props: () => ({ target_type: 'users', target: store.getters.currentUser }),
|
|
29
|
+
meta: { requiresAuth: true }
|
|
30
|
+
},
|
|
31
|
+
// Routes for single page application working with activity_notification REST API backend for admins
|
|
32
|
+
{
|
|
33
|
+
path: '/admins/notifications',
|
|
34
|
+
name: 'AuthenticatedAdminNotificationsIndex',
|
|
35
|
+
component: NotificationsIndex,
|
|
36
|
+
props: () => ({ target_type: 'admins', targetApiPath: 'admins', target: store.getters.currentUser.admin }),
|
|
37
|
+
meta: { requiresAuth: true }
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
path: '/admins/subscriptions',
|
|
41
|
+
name: 'AuthenticatedAdminSubscriptionsIndex',
|
|
42
|
+
component: SubscriptionsIndex,
|
|
43
|
+
props: () => ({ target_type: 'admins', targetApiPath: 'admins', target: store.getters.currentUser.admin }),
|
|
44
|
+
meta: { requiresAuth: true }
|
|
45
|
+
},
|
|
46
|
+
// Routes for single page application working with activity_notification REST API backend for unauthenticated targets
|
|
47
|
+
{
|
|
48
|
+
path: '/:target_type/:target_id/notifications',
|
|
49
|
+
name: 'UnauthenticatedTargetNotificationsIndex',
|
|
50
|
+
component: NotificationsIndex,
|
|
51
|
+
props : true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
path: '/:target_type/:target_id/subscriptions',
|
|
55
|
+
name: 'UnauthenticatedTargetSubscriptionsIndex',
|
|
56
|
+
component: SubscriptionsIndex,
|
|
57
|
+
props : true
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
const router = new VueRouter({
|
|
62
|
+
routes
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
router.beforeEach((to, from, next) => {
|
|
66
|
+
if (to.matched.some(record => record.meta.requiresAuth) && !store.getters.userSignedIn) {
|
|
67
|
+
next({ path: '/login', query: { redirect: to.fullPath }});
|
|
68
|
+
} else {
|
|
69
|
+
next();
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
export default router
|
|
File without changes
|
|
@@ -3,6 +3,14 @@ unless ENV['AN_TEST_DB'] == 'mongodb'
|
|
|
3
3
|
self.table_name = :articles
|
|
4
4
|
include ActivityNotification::Group
|
|
5
5
|
end
|
|
6
|
+
|
|
7
|
+
def printable_target_name
|
|
8
|
+
"dummy"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def printable_group_name
|
|
12
|
+
"dummy"
|
|
13
|
+
end
|
|
6
14
|
else
|
|
7
15
|
class Dummy::DummyGroup
|
|
8
16
|
include Mongoid::Document
|
|
@@ -3,6 +3,10 @@ unless ENV['AN_TEST_DB'] == 'mongodb'
|
|
|
3
3
|
self.table_name = :users
|
|
4
4
|
acts_as_target
|
|
5
5
|
acts_as_notifiable :dummy_notifiable_targets, targets: -> (n, key) { Dummy::DummyNotifiableTarget.all }, tracked: true
|
|
6
|
+
|
|
7
|
+
def notifiable_path(target_type, key = nil)
|
|
8
|
+
"dummy_path"
|
|
9
|
+
end
|
|
6
10
|
end
|
|
7
11
|
else
|
|
8
12
|
class Dummy::DummyNotifiableTarget
|
|
@@ -15,5 +19,9 @@ else
|
|
|
15
19
|
include ActivityNotification::Models
|
|
16
20
|
acts_as_target
|
|
17
21
|
acts_as_notifiable :dummy_notifiable_targets, targets: -> (n, key) { Dummy::DummyNotifiableTarget.all }, tracked: true
|
|
22
|
+
|
|
23
|
+
def notifiable_path(target_type, key = nil)
|
|
24
|
+
"dummy_path"
|
|
25
|
+
end
|
|
18
26
|
end
|
|
19
27
|
end
|
|
@@ -21,7 +21,8 @@ module UserModel
|
|
|
21
21
|
admin.present?
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def as_json(
|
|
24
|
+
def as_json(_options = {})
|
|
25
|
+
options = _options.deep_dup
|
|
25
26
|
options[:include] = (options[:include] || {}).merge(admin: { methods: [:printable_target_name, :notification_action_cable_allowed?, :notification_action_cable_with_devise?] })
|
|
26
27
|
options[:methods] = (options[:methods] || []).push(:printable_target_name, :notification_action_cable_allowed?, :notification_action_cable_with_devise?)
|
|
27
28
|
super(options)
|
|
@@ -24,18 +24,14 @@ require "action_controller/railtie"
|
|
|
24
24
|
require "action_mailer/railtie"
|
|
25
25
|
require "action_view/railtie"
|
|
26
26
|
require "sprockets/railtie"
|
|
27
|
-
require 'action_cable/engine'
|
|
27
|
+
require 'action_cable/engine'
|
|
28
28
|
|
|
29
29
|
Bundler.require(*Rails.groups)
|
|
30
30
|
require "activity_notification"
|
|
31
31
|
|
|
32
32
|
module Dummy
|
|
33
33
|
class Application < Rails::Application
|
|
34
|
-
|
|
35
|
-
if Rails::VERSION::MAJOR == 4 && Rails::VERSION::MINOR >= 2 && ENV['AN_TEST_DB'] != 'mongodb'
|
|
36
|
-
config.active_record.raise_in_transactional_callbacks = true
|
|
37
|
-
end
|
|
38
|
-
if Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR >= 2 && ENV['AN_TEST_DB'] != 'mongodb'
|
|
34
|
+
if Gem::Version.new("5.2.0") <= Rails.gem_version && Rails.gem_version < Gem::Version.new("6.0.0") && ENV['AN_TEST_DB'] != 'mongodb'
|
|
39
35
|
config.active_record.sqlite3.represent_boolean_as_integer = true
|
|
40
36
|
end
|
|
41
37
|
|
|
@@ -44,7 +40,10 @@ module Dummy
|
|
|
44
40
|
config.middleware.insert_before 0, Rack::Cors do
|
|
45
41
|
allow do
|
|
46
42
|
origins '*'
|
|
47
|
-
resource '*',
|
|
43
|
+
resource '*',
|
|
44
|
+
headers: :any,
|
|
45
|
+
expose: ['access-token', 'client', 'uid'],
|
|
46
|
+
methods: [:get, :post, :put, :delete]
|
|
48
47
|
end
|
|
49
48
|
end
|
|
50
49
|
end
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
Dynamoid.configure do |config|
|
|
2
|
-
config.namespace = "activity_notification_#{Rails.env}"
|
|
3
|
-
|
|
4
|
-
# config.
|
|
2
|
+
config.namespace = ENV['AN_NO_DYNAMODB_NAMESPACE'] ? "" : "activity_notification_#{Rails.env}"
|
|
3
|
+
# TODO Update Dynamoid v3.4.0+
|
|
4
|
+
# config.capacity_mode = :on_demand
|
|
5
|
+
config.read_capacity = 5
|
|
6
|
+
config.write_capacity = 5
|
|
7
|
+
unless Rails.env.production?
|
|
8
|
+
config.endpoint = 'http://localhost:8000'
|
|
9
|
+
end
|
|
10
|
+
unless Rails.env.test?
|
|
11
|
+
config.store_datetime_as_string = true
|
|
12
|
+
end
|
|
5
13
|
end
|
|
@@ -13,17 +13,8 @@ Rails.application.configure do
|
|
|
13
13
|
config.eager_load = false
|
|
14
14
|
|
|
15
15
|
# Configure static file server for tests with Cache-Control for performance.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
else
|
|
19
|
-
config.serve_static_files = true
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
if Rails::VERSION::MAJOR >= 5
|
|
23
|
-
config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'}
|
|
24
|
-
else
|
|
25
|
-
config.static_cache_control = "public, max-age=3600"
|
|
26
|
-
end
|
|
16
|
+
config.public_file_server.enabled = true
|
|
17
|
+
config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'}
|
|
27
18
|
|
|
28
19
|
# Show full error reports and disable caching.
|
|
29
20
|
config.consider_all_requests_local = true
|
|
@@ -10,10 +10,10 @@ ActivityNotification.configure do |config|
|
|
|
10
10
|
config.orm = ENV['AN_ORM'].to_sym
|
|
11
11
|
|
|
12
12
|
# Configure table name to store notification data.
|
|
13
|
-
config.notification_table_name = "notifications"
|
|
13
|
+
config.notification_table_name = ENV['AN_NOTIFICATION_TABLE_NAME'] || "notifications"
|
|
14
14
|
|
|
15
15
|
# Configure table name to store subscription data.
|
|
16
|
-
config.subscription_table_name = "subscriptions"
|
|
16
|
+
config.subscription_table_name = ENV['AN_SUBSCRIPTION_TABLE_NAME'] || "subscriptions"
|
|
17
17
|
|
|
18
18
|
# Configure if email notification is enabled as default.
|
|
19
19
|
# Note that you can configure them for each model by acts_as roles.
|
|
@@ -64,7 +64,7 @@ ActivityNotification.configure do |config|
|
|
|
64
64
|
|
|
65
65
|
# Configure if activity_notification stores notificaion records including associated records like target and notifiable..
|
|
66
66
|
# This store_with_associated_records option can be set true only when you use mongoid or dynamoid ORM.
|
|
67
|
-
config.store_with_associated_records =
|
|
67
|
+
config.store_with_associated_records = (config.orm != :active_record)
|
|
68
68
|
|
|
69
69
|
# Configure if WebSocket subscription using ActionCable is enabled.
|
|
70
70
|
# Note that you can configure them for each model by acts_as roles.
|
|
@@ -29,7 +29,11 @@ Rails.application.routes.draw do
|
|
|
29
29
|
notify_to :users, api_mode: true, with_subscription: true
|
|
30
30
|
notify_to :users, api_mode: true, with_devise: :users, devise_default_routes: true, with_subscription: true
|
|
31
31
|
resources :apidocs, only: [:index], controller: 'activity_notification/apidocs'
|
|
32
|
-
resources :users, only: [:index, :show]
|
|
32
|
+
resources :users, only: [:index, :show] do
|
|
33
|
+
collection do
|
|
34
|
+
get :find
|
|
35
|
+
end
|
|
36
|
+
end
|
|
33
37
|
end
|
|
34
38
|
end
|
|
35
39
|
|
data/spec/rails_app/db/seeds.rb
CHANGED
|
@@ -2,8 +2,15 @@
|
|
|
2
2
|
# This file is seed file for test data on development environment.
|
|
3
3
|
|
|
4
4
|
def clean_database
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
models = [Comment, Article, Admin, User]
|
|
6
|
+
if ENV['AN_USE_EXISTING_DYNAMODB_TABLE']
|
|
7
|
+
ActivityNotification::Notification.where('id.not_null': true).delete_all
|
|
8
|
+
ActivityNotification::Subscription.where('id.not_null': true).delete_all
|
|
9
|
+
else
|
|
10
|
+
models.concat([ActivityNotification::Notification, ActivityNotification::Subscription])
|
|
11
|
+
end
|
|
12
|
+
models.each do |model|
|
|
13
|
+
model.delete_all
|
|
7
14
|
end
|
|
8
15
|
end
|
|
9
16
|
|
|
@@ -54,7 +54,7 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
|
54
54
|
|
|
55
55
|
context "true as :tracked" do
|
|
56
56
|
before do
|
|
57
|
-
dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: true
|
|
57
|
+
dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: true, notifiable_path: -> { "dummy_path" }
|
|
58
58
|
@created_notifiable = dummy_notifiable_class.create
|
|
59
59
|
end
|
|
60
60
|
|
|
@@ -103,7 +103,7 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
|
103
103
|
|
|
104
104
|
context "with :only option (creation only)" do
|
|
105
105
|
before do
|
|
106
|
-
dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { only: [:create] }
|
|
106
|
+
dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { only: [:create] }, notifiable_path: -> { "dummy_path" }
|
|
107
107
|
@created_notifiable = dummy_notifiable_class.create
|
|
108
108
|
end
|
|
109
109
|
|
|
@@ -133,7 +133,7 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
|
133
133
|
|
|
134
134
|
context "with :except option (except update)" do
|
|
135
135
|
before do
|
|
136
|
-
dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { except: [:update] }
|
|
136
|
+
dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { except: [:update] }, notifiable_path: -> { "dummy_path" }
|
|
137
137
|
@created_notifiable = dummy_notifiable_class.create
|
|
138
138
|
end
|
|
139
139
|
|
|
@@ -163,7 +163,7 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
|
163
163
|
|
|
164
164
|
context "with :key option" do
|
|
165
165
|
before do
|
|
166
|
-
dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { key: "test.key" }
|
|
166
|
+
dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { key: "test.key" }, notifiable_path: -> { "dummy_path" }
|
|
167
167
|
@created_notifiable = dummy_notifiable_class.create
|
|
168
168
|
end
|
|
169
169
|
|
|
@@ -199,7 +199,7 @@ describe ActivityNotification::ActsAsNotifiable do
|
|
|
199
199
|
context "with :notify_later option" do
|
|
200
200
|
before do
|
|
201
201
|
ActiveJob::Base.queue_adapter = :test
|
|
202
|
-
dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { notify_later: true }
|
|
202
|
+
dummy_notifiable_class.acts_as_notifiable :users, targets: [user_target], tracked: { notify_later: true }, notifiable_path: -> { "dummy_path" }
|
|
203
203
|
@created_notifiable = dummy_notifiable_class.create
|
|
204
204
|
end
|
|
205
205
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
ENV["RAILS_ENV"] ||= "test"
|
|
2
|
+
Warning[:deprecated] = true if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.2")
|
|
2
3
|
|
|
3
4
|
require 'bundler/setup'
|
|
4
5
|
Bundler.setup
|
|
@@ -25,11 +26,6 @@ SimpleCov.start('rails') do
|
|
|
25
26
|
add_filter '/lib/activity_notification/orm/mongoid'
|
|
26
27
|
add_filter '/lib/activity_notification/orm/dynamoid'
|
|
27
28
|
end
|
|
28
|
-
if Rails::VERSION::MAJOR < 5
|
|
29
|
-
add_filter '/app/channels/'
|
|
30
|
-
add_filter '/lib/activity_notification/optional_targets/action_cable_channel'
|
|
31
|
-
add_filter '/lib/activity_notification/optional_targets/action_cable_api_channel'
|
|
32
|
-
end
|
|
33
29
|
end
|
|
34
30
|
|
|
35
31
|
# Dummy application
|
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: 2.
|
|
4
|
+
version: 2.2.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: 2020-
|
|
11
|
+
date: 2020-12-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: railties
|
|
@@ -16,7 +16,7 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 5.0.0
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
22
|
version: '6.1'
|
|
@@ -26,7 +26,7 @@ dependencies:
|
|
|
26
26
|
requirements:
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
29
|
+
version: 5.0.0
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: '6.1'
|
|
@@ -385,7 +385,6 @@ files:
|
|
|
385
385
|
- docs/Functions.md
|
|
386
386
|
- docs/Setup.md
|
|
387
387
|
- docs/Testing.md
|
|
388
|
-
- gemfiles/Gemfile.rails-4.2
|
|
389
388
|
- gemfiles/Gemfile.rails-5.0
|
|
390
389
|
- gemfiles/Gemfile.rails-5.1
|
|
391
390
|
- gemfiles/Gemfile.rails-5.2
|
|
@@ -570,7 +569,8 @@ files:
|
|
|
570
569
|
- spec/rails_app/app/javascript/config/test.js
|
|
571
570
|
- spec/rails_app/app/javascript/packs/application.js
|
|
572
571
|
- spec/rails_app/app/javascript/packs/spa.js
|
|
573
|
-
- spec/rails_app/app/javascript/
|
|
572
|
+
- spec/rails_app/app/javascript/router/index.js
|
|
573
|
+
- spec/rails_app/app/javascript/store/index.js
|
|
574
574
|
- spec/rails_app/app/mailers/.keep
|
|
575
575
|
- spec/rails_app/app/mailers/custom_notification_mailer.rb
|
|
576
576
|
- spec/rails_app/app/models/admin.rb
|
|
@@ -621,6 +621,7 @@ files:
|
|
|
621
621
|
- spec/rails_app/config/initializers/assets.rb
|
|
622
622
|
- spec/rails_app/config/initializers/backtrace_silencers.rb
|
|
623
623
|
- spec/rails_app/config/initializers/cookies_serializer.rb
|
|
624
|
+
- spec/rails_app/config/initializers/copy_it.aws.rb.template
|
|
624
625
|
- spec/rails_app/config/initializers/devise.rb
|
|
625
626
|
- spec/rails_app/config/initializers/devise_token_auth.rb
|
|
626
627
|
- spec/rails_app/config/initializers/filter_parameter_logging.rb
|
|
@@ -660,7 +661,6 @@ files:
|
|
|
660
661
|
- spec/roles/acts_as_notifier_spec.rb
|
|
661
662
|
- spec/roles/acts_as_target_spec.rb
|
|
662
663
|
- spec/spec_helper.rb
|
|
663
|
-
- spec/support/patch_rails_42_action_controller_test_response.rb
|
|
664
664
|
- spec/version_spec.rb
|
|
665
665
|
homepage: https://github.com/simukappu/activity_notification
|
|
666
666
|
licenses:
|
|
@@ -681,7 +681,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
681
681
|
- !ruby/object:Gem::Version
|
|
682
682
|
version: '0'
|
|
683
683
|
requirements: []
|
|
684
|
-
rubygems_version: 3.
|
|
684
|
+
rubygems_version: 3.1.4
|
|
685
685
|
signing_key:
|
|
686
686
|
specification_version: 4
|
|
687
687
|
summary: Integrated user activity notifications for Ruby on Rails
|
|
@@ -788,7 +788,8 @@ test_files:
|
|
|
788
788
|
- spec/rails_app/app/javascript/config/test.js
|
|
789
789
|
- spec/rails_app/app/javascript/packs/application.js
|
|
790
790
|
- spec/rails_app/app/javascript/packs/spa.js
|
|
791
|
-
- spec/rails_app/app/javascript/
|
|
791
|
+
- spec/rails_app/app/javascript/router/index.js
|
|
792
|
+
- spec/rails_app/app/javascript/store/index.js
|
|
792
793
|
- spec/rails_app/app/mailers/.keep
|
|
793
794
|
- spec/rails_app/app/mailers/custom_notification_mailer.rb
|
|
794
795
|
- spec/rails_app/app/models/admin.rb
|
|
@@ -839,6 +840,7 @@ test_files:
|
|
|
839
840
|
- spec/rails_app/config/initializers/assets.rb
|
|
840
841
|
- spec/rails_app/config/initializers/backtrace_silencers.rb
|
|
841
842
|
- spec/rails_app/config/initializers/cookies_serializer.rb
|
|
843
|
+
- spec/rails_app/config/initializers/copy_it.aws.rb.template
|
|
842
844
|
- spec/rails_app/config/initializers/devise.rb
|
|
843
845
|
- spec/rails_app/config/initializers/devise_token_auth.rb
|
|
844
846
|
- spec/rails_app/config/initializers/filter_parameter_logging.rb
|
|
@@ -878,5 +880,4 @@ test_files:
|
|
|
878
880
|
- spec/roles/acts_as_notifier_spec.rb
|
|
879
881
|
- spec/roles/acts_as_target_spec.rb
|
|
880
882
|
- spec/spec_helper.rb
|
|
881
|
-
- spec/support/patch_rails_42_action_controller_test_response.rb
|
|
882
883
|
- spec/version_spec.rb
|