activity_notification 2.1.4 → 2.2.3

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +120 -0
  3. data/CHANGELOG.md +38 -0
  4. data/README.md +2 -2
  5. data/activity_notification.gemspec +1 -1
  6. data/app/controllers/activity_notification/notifications_controller.rb +0 -20
  7. data/app/controllers/activity_notification/subscriptions_controller.rb +2 -2
  8. data/app/views/activity_notification/subscriptions/default/_form.html.erb +1 -1
  9. data/app/views/activity_notification/subscriptions/default/_notification_keys.html.erb +2 -2
  10. data/app/views/activity_notification/subscriptions/default/_subscription.html.erb +2 -2
  11. data/app/views/activity_notification/subscriptions/default/index.html.erb +2 -2
  12. data/app/views/activity_notification/subscriptions/default/show.html.erb +2 -2
  13. data/bin/bundle_update.sh +0 -1
  14. data/docs/Functions.md +17 -1
  15. data/gemfiles/{Gemfile.rails-4.2 → Gemfile.rails-6.1} +2 -4
  16. data/gemfiles/Gemfile.rails-7.0 +28 -0
  17. data/lib/activity_notification/apis/notification_api.rb +5 -1
  18. data/lib/activity_notification/apis/subscription_api.rb +5 -5
  19. data/lib/activity_notification/common.rb +11 -3
  20. data/lib/activity_notification/config.rb +63 -23
  21. data/lib/activity_notification/controllers/common_controller.rb +1 -17
  22. data/lib/activity_notification/models/concerns/notifiable.rb +1 -1
  23. data/lib/activity_notification/models/concerns/subscriber.rb +6 -4
  24. data/lib/activity_notification/models/concerns/swagger/notification_schema.rb +16 -16
  25. data/lib/activity_notification/models/concerns/target.rb +8 -12
  26. data/lib/activity_notification/orm/active_record/notification.rb +3 -3
  27. data/lib/activity_notification/orm/active_record.rb +1 -1
  28. data/lib/activity_notification/orm/dynamoid/notification.rb +1 -1
  29. data/lib/activity_notification/orm/dynamoid/subscription.rb +1 -1
  30. data/lib/activity_notification/orm/mongoid/notification.rb +1 -1
  31. data/lib/activity_notification/orm/mongoid/subscription.rb +1 -1
  32. data/lib/activity_notification/renderable.rb +2 -2
  33. data/lib/activity_notification/roles/acts_as_notifiable.rb +11 -15
  34. data/lib/activity_notification/version.rb +1 -1
  35. data/lib/generators/templates/activity_notification.rb +15 -1
  36. data/lib/generators/templates/migrations/migration.rb +1 -1
  37. data/spec/channels/notification_api_channel_spec.rb +42 -44
  38. data/spec/channels/notification_api_with_devise_channel_spec.rb +57 -59
  39. data/spec/channels/notification_channel_spec.rb +41 -43
  40. data/spec/channels/notification_with_devise_channel_spec.rb +75 -77
  41. data/spec/concerns/apis/notification_api_spec.rb +26 -3
  42. data/spec/concerns/apis/subscription_api_spec.rb +144 -2
  43. data/spec/concerns/common_spec.rb +25 -3
  44. data/spec/concerns/models/subscriber_spec.rb +179 -6
  45. data/spec/concerns/models/target_spec.rb +10 -12
  46. data/spec/concerns/renderable_spec.rb +5 -5
  47. data/spec/controllers/controller_spec_utility.rb +15 -51
  48. data/spec/generators/migration/migration_generator_spec.rb +2 -10
  49. data/spec/helpers/view_helpers_spec.rb +1 -1
  50. data/spec/optional_targets/action_cable_api_channel_spec.rb +21 -24
  51. data/spec/optional_targets/action_cable_channel_spec.rb +26 -29
  52. data/spec/rails_app/config/application.rb +2 -6
  53. data/spec/rails_app/config/database.yml +1 -1
  54. data/spec/rails_app/config/environments/test.rb +2 -11
  55. data/spec/rails_app/config/initializers/activity_notification.rb +14 -0
  56. data/spec/rails_app/package.json +14 -14
  57. data/spec/spec_helper.rb +1 -5
  58. metadata +13 -14
  59. data/.travis.yml +0 -76
  60. data/spec/support/patch_rails_42_action_controller_test_response.rb +0 -11
@@ -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
- if Rails::VERSION::MAJOR >= 5
17
- config.public_file_server.enabled = true
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
@@ -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'
@@ -87,4 +97,8 @@ ActivityNotification.configure do |config|
87
97
  # Configure notification API channel prefix for ActionCable.
88
98
  config.notification_api_channel_prefix = 'activity_notification_api_channel'
89
99
 
100
+ # Configure if activity_notification internally rescues optional target errors. Default value is true.
101
+ # See https://github.com/simukappu/activity_notification/issues/155 for more details.
102
+ config.rescue_optional_target_errors = true
103
+
90
104
  end
@@ -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": "^4.2.0",
6
- "axios": "^0.19.0",
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"
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": "^3.9.0"
20
+ "webpack-dev-server": ">=3.11.0"
21
21
  },
22
22
  "license": "MIT"
23
23
  }
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.1.4
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shota Yamazaki
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-07 00:00:00.000000000 Z
11
+ date: 2022-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.0
19
+ version: 5.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6.1'
22
+ version: '7.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 4.2.0
29
+ version: 5.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.1'
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: i18n
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -316,10 +316,10 @@ files:
316
316
  - ".github/ISSUE_TEMPLATE/bug_report.md"
317
317
  - ".github/ISSUE_TEMPLATE/feature_request.md"
318
318
  - ".github/pull_request_template.md"
319
+ - ".github/workflows/build.yml"
319
320
  - ".gitignore"
320
321
  - ".rspec"
321
322
  - ".rubocop.yml"
322
- - ".travis.yml"
323
323
  - ".yardopts"
324
324
  - CHANGELOG.md
325
325
  - Gemfile
@@ -385,11 +385,12 @@ 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
392
391
  - gemfiles/Gemfile.rails-6.0
392
+ - gemfiles/Gemfile.rails-6.1
393
+ - gemfiles/Gemfile.rails-7.0
393
394
  - lib/activity_notification.rb
394
395
  - lib/activity_notification/apis/notification_api.rb
395
396
  - lib/activity_notification/apis/subscription_api.rb
@@ -662,13 +663,12 @@ files:
662
663
  - spec/roles/acts_as_notifier_spec.rb
663
664
  - spec/roles/acts_as_target_spec.rb
664
665
  - spec/spec_helper.rb
665
- - spec/support/patch_rails_42_action_controller_test_response.rb
666
666
  - spec/version_spec.rb
667
667
  homepage: https://github.com/simukappu/activity_notification
668
668
  licenses:
669
669
  - MIT
670
670
  metadata: {}
671
- post_install_message:
671
+ post_install_message:
672
672
  rdoc_options: []
673
673
  require_paths:
674
674
  - lib
@@ -683,8 +683,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
683
683
  - !ruby/object:Gem::Version
684
684
  version: '0'
685
685
  requirements: []
686
- rubygems_version: 3.0.3
687
- signing_key:
686
+ rubygems_version: 3.2.32
687
+ signing_key:
688
688
  specification_version: 4
689
689
  summary: Integrated user activity notifications for Ruby on Rails
690
690
  test_files:
@@ -882,5 +882,4 @@ test_files:
882
882
  - spec/roles/acts_as_notifier_spec.rb
883
883
  - spec/roles/acts_as_target_spec.rb
884
884
  - spec/spec_helper.rb
885
- - spec/support/patch_rails_42_action_controller_test_response.rb
886
885
  - spec/version_spec.rb
data/.travis.yml DELETED
@@ -1,76 +0,0 @@
1
- language: ruby
2
-
3
- branches:
4
- except:
5
- - images
6
-
7
- rvm:
8
- # - 2.7.0 # Need to respond to warnings for Ruby 3.0
9
- - 2.6.5
10
- # - 2.5.7
11
- # - 2.4.9
12
- # - 2.3.8 #EOL
13
-
14
- gemfile:
15
- - gemfiles/Gemfile.rails-4.2
16
- - gemfiles/Gemfile.rails-5.0
17
- - gemfiles/Gemfile.rails-5.1
18
- - gemfiles/Gemfile.rails-5.2
19
- - gemfiles/Gemfile.rails-6.0
20
-
21
- env:
22
- - AN_ORM=active_record
23
- - AN_ORM=active_record AN_TEST_DB=mysql
24
- - AN_ORM=active_record AN_TEST_DB=postgresql
25
- - AN_ORM=mongoid
26
- - AN_ORM=mongoid AN_TEST_DB=mongodb
27
- - AN_ORM=dynamoid
28
-
29
- matrix:
30
- exclude:
31
- - gemfile: gemfiles/Gemfile.rails-4.2
32
- env: AN_ORM=dynamoid
33
- include:
34
- - rvm: ruby-head
35
- gemfile: Gemfile
36
- env: AN_ORM=active_record
37
- - rvm: ruby-head
38
- gemfile: Gemfile
39
- env: AN_ORM=mongoid
40
- - rvm: ruby-head
41
- gemfile: Gemfile
42
- env: AN_ORM=dynamoid
43
- allow_failures:
44
- - rvm: ruby-head
45
- fast_finish: true
46
-
47
- services:
48
- - mysql
49
- - postgresql
50
- - mongodb
51
-
52
- sudo: false
53
-
54
- cache: bundler
55
-
56
- before_install:
57
- # Specify bundler version as '< 2.0' for Rails 4.2
58
- - gem install bundler --no-document -v '1.17.3'
59
-
60
- install:
61
- # Specify bundler version as '< 2.0' for Rails 4.2
62
- - bundle _1.17.3_ install
63
- - if [ "$AN_ORM" = "dynamoid" ]; then bin/install_dynamodblocal.sh; fi
64
-
65
- before_script:
66
- # Specify bundler version as '< 2.0' for Rails 4.2
67
- - bundle _1.17.3_ update
68
- - if [ "$AN_TEST_DB" = "mysql" ]; then mysql -e 'create database activity_notification_test'; fi
69
- - if [ "$AN_TEST_DB" = "postgresql" ]; then psql -c 'create database activity_notification_test' -U postgres; fi
70
- - if [ "$AN_ORM" = "dynamoid" ]; then bin/start_dynamodblocal.sh; fi
71
- - if [ "$AN_ORM" = "dynamoid" ]; then export AWS_DEFAULT_REGION=ap-northeast-1 AWS_ACCESS_KEY_ID=dummy AWS_SECRET_ACCESS_KEY=dummy; fi
72
-
73
- script: bundle exec rspec
74
-
75
- notifications:
76
- email: true
@@ -1,11 +0,0 @@
1
- # Rails 4.2 call `initialize` inside `recycle!`. However Ruby 2.6 doesn't allow calling `initialize` twice.
2
- # See for detail: https://github.com/rails/rails/issues/34790
3
- if RUBY_VERSION.to_f >= 2.6 && Rails::VERSION::MAJOR < 5
4
- class ActionController::TestResponse < ActionDispatch::TestResponse
5
- def recycle!
6
- @mon_mutex_owner_object_id = nil
7
- @mon_mutex = nil
8
- initialize
9
- end
10
- end
11
- end