activity_notification 2.1.2 → 2.2.2
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 +10 -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_controller.rb +0 -20
- data/app/controllers/activity_notification/subscriptions_api_controller.rb +1 -1
- data/app/controllers/activity_notification/subscriptions_controller.rb +2 -2
- data/app/views/activity_notification/subscriptions/default/_form.html.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/_notification_keys.html.erb +2 -2
- data/app/views/activity_notification/subscriptions/default/_subscription.html.erb +2 -2
- data/app/views/activity_notification/subscriptions/default/index.html.erb +2 -2
- data/app/views/activity_notification/subscriptions/default/show.html.erb +2 -2
- data/bin/bundle_update.sh +0 -1
- data/docs/Functions.md +19 -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/gemfiles/{Gemfile.rails-4.2 → Gemfile.rails-6.1} +4 -5
- data/lib/activity_notification/apis/notification_api.rb +7 -0
- data/lib/activity_notification/apis/subscription_api.rb +5 -5
- data/lib/activity_notification/common.rb +15 -4
- data/lib/activity_notification/config.rb +53 -23
- data/lib/activity_notification/controllers/common_controller.rb +2 -18
- data/lib/activity_notification/models/concerns/notifiable.rb +12 -12
- data/lib/activity_notification/models/concerns/subscriber.rb +6 -4
- 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 +8 -12
- 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 +2 -2
- 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/activity_notification.rb +11 -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/subscription_api_spec.rb +144 -2
- data/spec/concerns/common_spec.rb +25 -3
- data/spec/concerns/models/notifiable_spec.rb +35 -35
- data/spec/concerns/models/subscriber_spec.rb +179 -6
- 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/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 +13 -3
- data/spec/rails_app/config/routes.rb +5 -1
- data/spec/rails_app/db/seeds.rb +9 -2
- data/spec/rails_app/package.json +14 -14
- data/spec/roles/acts_as_notifiable_spec.rb +5 -5
- data/spec/spec_helper.rb +1 -5
- metadata +12 -12
- 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.
|
|
@@ -31,6 +31,16 @@ ActivityNotification.configure do |config|
|
|
|
31
31
|
# Set false when you want to unsubscribe to any notifications as default.
|
|
32
32
|
config.subscribe_as_default = true
|
|
33
33
|
|
|
34
|
+
# Configure default email subscription value to use when the subscription record does not configured.
|
|
35
|
+
# Note that you can configure them for each method calling as default argument.
|
|
36
|
+
# Set false when you want to unsubscribe to email notifications as default.
|
|
37
|
+
# config.subscribe_to_email_as_default = true
|
|
38
|
+
|
|
39
|
+
# Configure default optional target subscription value to use when the subscription record does not configured.
|
|
40
|
+
# Note that you can configure them for each method calling as default argument.
|
|
41
|
+
# Set false when you want to unsubscribe to optinal target notifications as default.
|
|
42
|
+
# config.subscribe_to_optional_targets_as_default = true
|
|
43
|
+
|
|
34
44
|
# Configure the e-mail address which will be shown in ActivityNotification::Mailer,
|
|
35
45
|
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
|
36
46
|
config.mailer_sender = 'please-change-me-at-config-initializers-activity_notification@example.com'
|
|
@@ -64,7 +74,7 @@ ActivityNotification.configure do |config|
|
|
|
64
74
|
|
|
65
75
|
# Configure if activity_notification stores notificaion records including associated records like target and notifiable..
|
|
66
76
|
# This store_with_associated_records option can be set true only when you use mongoid or dynamoid ORM.
|
|
67
|
-
config.store_with_associated_records =
|
|
77
|
+
config.store_with_associated_records = (config.orm != :active_record)
|
|
68
78
|
|
|
69
79
|
# Configure if WebSocket subscription using ActionCable is enabled.
|
|
70
80
|
# 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
|
|
data/spec/rails_app/package.json
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
"name": "activity_notification",
|
|
3
3
|
"description": "Sample single page application for activity_notification using Vue.js",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@rails/webpacker": "
|
|
6
|
-
"axios": "
|
|
7
|
-
"vue": "
|
|
8
|
-
"vuex": "
|
|
9
|
-
"vuex-persistedstate": "
|
|
10
|
-
"vue-loader": "
|
|
11
|
-
"vue-router": "
|
|
12
|
-
"vue-template-compiler": "
|
|
13
|
-
"vue-moment": "
|
|
14
|
-
"vue-moment-tz": "
|
|
15
|
-
"vue-pluralize": "
|
|
16
|
-
"actioncable-vue": "
|
|
17
|
-
"push.js": "
|
|
5
|
+
"@rails/webpacker": ">=4.3.0",
|
|
6
|
+
"axios": ">=0.21.1",
|
|
7
|
+
"vue": ">=2.6.10",
|
|
8
|
+
"vuex": ">=3.1.2",
|
|
9
|
+
"vuex-persistedstate": ">=2.7.0",
|
|
10
|
+
"vue-loader": ">=15.7.2",
|
|
11
|
+
"vue-router": ">=3.1.3",
|
|
12
|
+
"vue-template-compiler": ">=2.6.10",
|
|
13
|
+
"vue-moment": ">=4.1.0",
|
|
14
|
+
"vue-moment-tz": ">=2.1.1",
|
|
15
|
+
"vue-pluralize": ">=0.0.2",
|
|
16
|
+
"actioncable-vue": ">=1.5.1",
|
|
17
|
+
"push.js": ">=1.0.12"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"webpack-dev-server": "
|
|
20
|
+
"webpack-dev-server": ">=3.11.0"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT"
|
|
23
23
|
}
|
|
@@ -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
|